Alexander Potapenko 0f181f9fbe mm/slub.c: init_on_free=1 should wipe freelist ptr for bulk allocations
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: Alexander Potapenko <glider@google.com>
Reported-by: Thibaut Sautereau <thibaut@sautereau.fr>
Reported-by: Kees Cook <keescook@chromium.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Laura Abbott <labbott@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-10-14 15:04:01 -07:00
..
2019-09-24 15:54:08 -07:00
2019-08-30 22:43:58 -07:00
2019-09-25 17:51:41 -07:00
2019-09-24 15:54:08 -07:00
2019-09-25 17:51:41 -07:00
2019-09-24 15:54:09 -07:00
2019-07-14 19:42:11 -07:00
2019-09-24 15:54:08 -07:00
2019-09-25 17:51:41 -07:00
2018-06-07 17:34:36 -07:00
2019-07-12 11:05:43 -07:00
2019-09-24 15:54:08 -07:00
2019-09-04 13:40:49 -07:00
2019-10-07 15:47:19 -07:00
2019-09-25 17:51:41 -07:00
2019-09-17 15:20:17 -07:00
2019-09-24 15:54:11 -07:00
2019-09-24 15:54:12 -07:00