lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALvZod7sG9s+K481rygGDAE3r96ytoJ4Usp-1KfXsN3RFVx2qQ@mail.gmail.com>
Date:   Wed, 14 Mar 2018 10:02:30 -0700
From:   Shakeel Butt <shakeelb@...gle.com>
To:     Vladimir Davydov <vdavydov.dev@...il.com>
Cc:     Christopher Lameter <cl@...ux.com>,
        Suleiman Souhlal <suleiman@...gle.com>,
        Greg Thelen <gthelen@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Linux MM <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] slab, slub: remove size disparity on debug kernel

On Wed, Mar 14, 2018 at 1:43 AM, Vladimir Davydov
<vdavydov.dev@...il.com> wrote:
> On Tue, Mar 13, 2018 at 10:36:52AM -0700, Shakeel Butt wrote:
>> On Tue, Mar 13, 2018 at 10:19 AM, Christopher Lameter <cl@...ux.com> wrote:
>> > On Tue, 13 Mar 2018, Shakeel Butt wrote:
>> >
>> >> However for SLUB in debug kernel, the sizes were same. On further
>> >> inspection it is found that SLUB always use kmem_cache.object_size to
>> >> measure the kmem_cache.size while SLAB use the given kmem_cache.size. In
>> >> the debug kernel the slab's size can be larger than its object_size.
>> >> Thus in the creation of non-root slab, the SLAB uses the root's size as
>> >> base to calculate the non-root slab's size and thus non-root slab's size
>> >> can be larger than the root slab's size. For SLUB, the non-root slab's
>> >> size is measured based on the root's object_size and thus the size will
>> >> remain same for root and non-root slab.
>> >
>> > Note that the object_size and size may differ for SLUB based on kernel
>> > parameters and slab configuration. For SLAB these are compilation options.
>> >
>>
>> Thanks for the explanation.
>>
>> >> @@ -379,7 +379,7 @@ struct kmem_cache *find_mergeable(unsigned int size, unsigned int align,
>> >>  }
>> >>
>> >>  static struct kmem_cache *create_cache(const char *name,
>> >> -             unsigned int object_size, unsigned int size, unsigned int align,
>> >> +             unsigned int object_size, unsigned int align,
>> >>               slab_flags_t flags, unsigned int useroffset,
>> >
>> > Why was both the size and object_size passed during cache creation in the
>> > first place? From the flags etc the slab logic should be able to compute
>> > the actual bytes required for each object and its metadata.
>> >
>>
>> +Vladimir
>>
>> I think it was introduced by 794b1248be4e7 ("memcg, slab: separate
>> memcg vs root cache creation paths") but I could not find out the
>> reason.
>
> This was a mistake - I missed that __kmem_cache_create() overwrites
> kmem_cache->size. Thanks for fixing this.

Thanks for confirming.

Andrew, can you please add following line to the patch commit message.

Fixes: 794b1248be4e ("memcg, slab: separate memcg vs root cache creation paths")

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ