Re: [PATCH] Uninline kcalloc()

From: Valdis . Kletnieks
Date: Mon Sep 24 2007 - 09:17:48 EST


On Mon, 24 Sep 2007 08:59:56 EDT, Kyle Moffett said:

> Proper fix is to give __kmalloc a "void *caller" parameter and have
> all of the various wrapper functions pass in the value of
> __builtin_return_address() appropriately. I believe that even works
> properly for inline functions which may or may not be inlined.

I think I looked at that, and it wasn't as easy as it looked, because there
were ugly corner cases for what __builtin_return_address() returned depending
on exactly what did or didn't get inlined. Basically, it's ugly stuff - if you
try to use __builtin_retur_address inside kcalloc to pass to __kmalloc, and
then kcalloc gets inlined, you end up passing not the routine you wanted (the
caller of kcalloc), but the *parent* of that...

Attachment: pgp00000.pgp
Description: PGP signature