Re: slab quirks in DEBUG, ctor, and initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

On Mon, 17 Dec 2007, John Reiser wrote:
> idr_pre_get calls kmem_cache_alloc, which constructs 'struct idr_layer'
> via the cachep->ctor() call from cache_alloc_debugcheck_after to
> idr_cache_ctor, and not via cache_init_objs.  So if DEBUG is off,
> then idr_cache_ctor does not get its chance to call memset,
> which could leave the struct idr_layer potentially undefined.

No, init_cache_objs() will call the constructor, if the cache has one when 
DEBUG is not set so the struct idr_layer can never be undefined. However, 
struct idr_layer can contain non-zero elements if someone does a 
kmem_cache_free() on an object that hasn't been zeroed. If that matters 
here, idr_pre_get should call kmem_cache_zalloc() and drop the 
constructor.

				Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux