Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 6fc3e71c authored by Alexander Potapenko's avatar Alexander Potapenko
Browse files

UPSTREAM: mm/slub.c: init_on_free=1 should wipe freelist ptr for bulk allocations

Upstream commit 0f181f9fbea8bc7ea2f7e13ae7f8c256b39e254c.

slab_alloc_node() already zeroed out the freelist pointer if
init_on_free was on.  Thibaut Sautereau noticed that the same needs to
be done for kmem_cache_alloc_bulk(), which performs the allocations
separately.

kmem_cache_alloc_bulk() is currently used in two places in the kernel,
so this change is unlikely to have a major performance impact.

SLAB doesn't require a similar change, as auto-initialization makes the
allocator store the freelist pointers off-slab.

Link: http://lkml.kernel.org/r/20191007091605.30530-1-glider@google.com


Fixes: 6471384af2a6 ("mm: security: introduce init_on_alloc=1 and init_on_free=1 boot options")
Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
Reported-by: default avatarThibaut Sautereau <thibaut@sautereau.fr>
Reported-by: default avatarKees Cook <keescook@chromium.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Laura Abbott <labbott@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>

Bug: 138435492
Test: Boot an ARM64 mobile device with and without init_on_alloc=1
Change-Id: I05281c27d830867567d47d6a52faec7dc55e82fa
Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
parent 571f9685
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment