linux/mm/kasan
Andrey Konovalov 26dca996ea kasan: fix quarantine conflicting with init_on_free
KASAN's quarantine might save its metadata inside freed objects.  As
this happens after the memory is zeroed by the slab allocator when
init_on_free is enabled, the memory coming out of quarantine is not
properly zeroed.

This causes lib/test_meminit.c tests to fail with Generic KASAN.

Zero the metadata when the object is removed from quarantine.

Link: https://lkml.kernel.org/r/2805da5df4b57138fdacd671f5d227d58950ba54.1640037083.git.andreyknvl@google.com
Fixes: 6471384af2 ("mm: security: introduce init_on_alloc=1 and init_on_free=1 boot options")
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-01-15 16:30:26 +02:00
..
common.c kasan: fix tag for large allocations when using CONFIG_SLAB 2021-11-06 13:30:33 -07:00
generic.c kasan: generic: introduce kasan_record_aux_stack_noalloc() 2021-11-06 13:30:33 -07:00
hw_tags.c kasan: add kasan mode messages when kasan init 2021-11-11 09:34:35 -08:00
init.c kasan: use MAX_PTRS_PER_* for early shadow tables 2021-06-29 10:53:53 -07:00
kasan.h Merge branch 'akpm' (patches from Andrew) 2021-11-06 14:08:17 -07:00
Makefile kasan: integrate the common part of two KASAN tag-based modes 2021-06-29 10:53:53 -07:00
quarantine.c kasan: fix quarantine conflicting with init_on_free 2022-01-15 16:30:26 +02:00
report_generic.c mm/kasan: switch from strlcpy to strscpy 2021-04-30 11:20:41 -07:00
report_hw_tags.c kasan: integrate the common part of two KASAN tag-based modes 2021-06-29 10:53:53 -07:00
report_sw_tags.c kasan: integrate the common part of two KASAN tag-based modes 2021-06-29 10:53:53 -07:00
report_tags.c kasan: integrate the common part of two KASAN tag-based modes 2021-06-29 10:53:53 -07:00
report.c Merge branch 'akpm' (patches from Andrew) 2021-11-09 10:11:53 -08:00
shadow.c mm: defer kmemleak object creation of module_alloc() 2022-01-15 16:30:25 +02:00
sw_tags.c kasan: add kasan mode messages when kasan init 2021-11-11 09:34:35 -08:00
tags.c kasan: integrate the common part of two KASAN tag-based modes 2021-06-29 10:53:53 -07:00