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: <12881182-2459-910a-8f3a-04b3e85f08b6@suse.cz>
Date:   Tue, 16 Oct 2018 15:59:52 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Dmitry Vyukov <dvyukov@...il.com>, cl@...ux.com,
        penberg@...nel.org, akpm@...ux-foundation.org, rientjes@...gle.com,
        iamjoonsoo.kim@....com
Cc:     Dmitry Vyukov <dvyukov@...gle.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm: don't warn about large allocations for slab

On 9/27/18 7:15 PM, Dmitry Vyukov wrote:
> From: Dmitry Vyukov <dvyukov@...gle.com>
> 
> Slub does not call kmalloc_slab() for sizes > KMALLOC_MAX_CACHE_SIZE,
> instead it falls back to kmalloc_large().
> For slab KMALLOC_MAX_CACHE_SIZE == KMALLOC_MAX_SIZE and it calls
> kmalloc_slab() for all allocations relying on NULL return value
> for over-sized allocations.
> This inconsistency leads to unwanted warnings from kmalloc_slab()
> for over-sized allocations for slab. Returning NULL for failed
> allocations is the expected behavior.
> 
> Make slub and slab code consistent by checking size >
> KMALLOC_MAX_CACHE_SIZE in slab before calling kmalloc_slab().
> 
> While we are here also fix the check in kmalloc_slab().
> We should check against KMALLOC_MAX_CACHE_SIZE rather than
> KMALLOC_MAX_SIZE. It all kinda worked because for slab the
> constants are the same, and slub always checks the size against
> KMALLOC_MAX_CACHE_SIZE before kmalloc_slab().
> But if we get there with size > KMALLOC_MAX_CACHE_SIZE anyhow
> bad things will happen. For example, in case of a newly introduced
> bug in slub code.
> 
> Also move the check in kmalloc_slab() from function entry
> to the size > 192 case. This partially compensates for the additional
> check in slab code and makes slub code a bit faster
> (at least theoretically).
> 
> Also drop __GFP_NOWARN in the warning check.
> This warning means a bug in slab code itself,
> user-passed flags have nothing to do with it.
> 
> Nothing of this affects slob.
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@...gle.com>
> Cc: Christoph Lameter <cl@...ux.com>
> Cc: Pekka Enberg <penberg@...nel.org>
> Cc: David Rientjes <rientjes@...gle.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@....com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: linux-mm@...ck.org
> Cc: linux-kernel@...r.kernel.org
> Reported-by: syzbot+87829a10073277282ad1@...kaller.appspotmail.com
> Reported-by: syzbot+ef4e8fc3a06e9019bb40@...kaller.appspotmail.com
> Reported-by: syzbot+6e438f4036df52cbb863@...kaller.appspotmail.com
> Reported-by: syzbot+8574471d8734457d98aa@...kaller.appspotmail.com
> Reported-by: syzbot+af1504df0807a083dbd9@...kaller.appspotmail.com

Acked-by: Vlastimil Babka <vbabka@...e.cz>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ