linux/mm/kasan
Andrey Konovalov 1123c2fb9d kasan: fix quarantine conflicting with init_on_free
[ Upstream commit 26dca996ea ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-03-08 19:12:38 +01:00
..
common.c Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
generic.c kasan: allow architectures to provide an outline readiness check 2021-06-29 10:53:53 -07:00
hw_tags.c Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07: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-09-03 10:08:28 -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-03-08 19:12:38 +01: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 mm/kasan: move kasan.fault to mm/kasan/report.c 2021-09-03 09:58:14 -07:00
shadow.c mm: defer kmemleak object creation of module_alloc() 2022-03-08 19:12:38 +01:00
sw_tags.c Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
tags.c kasan: integrate the common part of two KASAN tag-based modes 2021-06-29 10:53:53 -07:00