Re: [PATCH] Uninline kcalloc()

2007-09-25 Thread Christoph Lameter
On Mon, 24 Sep 2007, [EMAIL PROTECTED] wrote: > 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

Re: [PATCH] Uninline kcalloc()

2007-09-25 Thread Christoph Lameter
On Mon, 24 Sep 2007, [EMAIL PROTECTED] wrote: 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

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
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

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Kyle Moffett
On Sep 24, 2007, at 01:35:08, [EMAIL PROTECTED] wrote: On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (n != 0 && size > ULONG_MAX / n) - return NULL; - return __kmalloc(n * size, flags

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
On Mon, 24 Sep 2007 11:44:35 +0400, Alexey Dobriyan said: > Interesting. Here is output from kernel with patch applied and leak > plugged into proc_dointvec() (I checked twice): > > $ grep kcalloc /proc/slab_allocators > $ grep proc_dointvec /proc/slab_allocators >

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
On Mon, 24 Sep 2007 11:44:35 +0400, Alexey Dobriyan said: > On 9/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: > > > > > -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) > > > -{ > > > - if (n != 0 && size >

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Alexey Dobriyan
On 9/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: > > > -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) > > -{ > > - if (n != 0 && size > ULONG_MAX / n) > > - return NULL; > > - return __kmalloc(n *

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
On Mon, 24 Sep 2007 08:22:31 +0200, Jan Engelhardt said: > > On Sep 24 2007 01:35, [EMAIL PROTECTED] wrote: > >On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: > > > >> -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) > >> -{ > >> - if (n != 0 && size > ULONG_MAX / n) >

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Jan Engelhardt
On Sep 24 2007 01:35, [EMAIL PROTECTED] wrote: >On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: > >> -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) >> -{ >> -if (n != 0 && size > ULONG_MAX / n) >> -return NULL; >> -return __kmalloc(n * size, flags |

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Jan Engelhardt
On Sep 24 2007 01:35, [EMAIL PROTECTED] wrote: On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ -if (n != 0 size ULONG_MAX / n) -return NULL; -return __kmalloc(n * size, flags | __GFP_ZERO);

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
On Mon, 24 Sep 2007 08:22:31 +0200, Jan Engelhardt said: On Sep 24 2007 01:35, [EMAIL PROTECTED] wrote: On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (n != 0 size ULONG_MAX / n) - return

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Alexey Dobriyan
On 9/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (n != 0 size ULONG_MAX / n) - return NULL; - return __kmalloc(n * size, flags |

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
On Mon, 24 Sep 2007 11:44:35 +0400, Alexey Dobriyan said: On 9/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (n != 0 size ULONG_MAX / n) -

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
On Mon, 24 Sep 2007 11:44:35 +0400, Alexey Dobriyan said: Interesting. Here is output from kernel with patch applied and leak plugged into proc_dointvec() (I checked twice): $ grep kcalloc /proc/slab_allocators $ grep proc_dointvec /proc/slab_allocators size-64: 19

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Kyle Moffett
On Sep 24, 2007, at 01:35:08, [EMAIL PROTECTED] wrote: On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (n != 0 size ULONG_MAX / n) - return NULL; - return __kmalloc(n * size, flags |

Re: [PATCH] Uninline kcalloc()

2007-09-24 Thread Valdis . Kletnieks
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

Re: [PATCH] Uninline kcalloc()

2007-09-23 Thread Valdis . Kletnieks
On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: > -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) > -{ > - if (n != 0 && size > ULONG_MAX / n) > - return NULL; > - return __kmalloc(n * size, flags | __GFP_ZERO); > -} > +void *kcalloc(size_t n, size_t

Re: [PATCH] Uninline kcalloc()

2007-09-23 Thread Valdis . Kletnieks
On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said: -static inline void *kcalloc(size_t n, size_t size, gfp_t flags) -{ - if (n != 0 size ULONG_MAX / n) - return NULL; - return __kmalloc(n * size, flags | __GFP_ZERO); -} +void *kcalloc(size_t n, size_t size,

[PATCH] Uninline kcalloc()

2007-09-22 Thread Alexey Dobriyan
This saves some bytes on usual config here and allows inserting integer overflow warning without pissing off printk-haters crowd later on. textdata bss dec hex filename 2662791 195347 159744 3017882 2e0c9a vmlinux -O2 before 2662535 195347 159744 3017626 2e0b9a

[PATCH] Uninline kcalloc()

2007-09-22 Thread Alexey Dobriyan
This saves some bytes on usual config here and allows inserting integer overflow warning without pissing off printk-haters crowd later on. textdata bss dec hex filename 2662791 195347 159744 3017882 2e0c9a vmlinux -O2 before 2662535 195347 159744 3017626 2e0b9a