linux/mm/kasan
Vincenzo Frascino b1add418d4 kasan: fix hw tags enablement when KUNIT tests are disabled
Kasan enables hw tags via kasan_enable_tagging() which based on the mode
passed via kernel command line selects the correct hw backend.
kasan_enable_tagging() is meant to be invoked indirectly via the cpu
features framework of the architectures that support these backends.
Currently the invocation of this function is guarded by
CONFIG_KASAN_KUNIT_TEST which allows the enablement of the correct backend
only when KUNIT tests are enabled in the kernel.

This inconsistency was introduced in commit:

  ed6d74446c ("kasan: test: support async (again) and asymm modes for HW_TAGS")

... and prevents to enable MTE on arm64 when KUNIT tests for kasan hw_tags are
disabled.

Fix the issue making sure that the CONFIG_KASAN_KUNIT_TEST guard does not
prevent the correct invocation of kasan_enable_tagging().

Link: https://lkml.kernel.org/r/20220408124323.10028-1-vincenzo.frascino@arm.com
Fixes: ed6d74446c ("kasan: test: support async (again) and asymm modes for HW_TAGS")
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-15 14:49:55 -07:00
..
common.c kasan, page_alloc: merge kasan_alloc_pages into post_alloc_hook 2022-03-24 19:06:46 -07:00
generic.c mm/kasan: Convert to struct folio and struct slab 2022-01-06 12:26:14 +01:00
hw_tags.c kasan: fix hw tags enablement when KUNIT tests are disabled 2022-04-15 14:49:55 -07:00
init.c kasan: use MAX_PTRS_PER_* for early shadow tables 2021-06-29 10:53:53 -07:00
kasan.h kasan: fix hw tags enablement when KUNIT tests are disabled 2022-04-15 14:49:55 -07:00
Makefile mm/kasan: remove unnecessary CONFIG_KASAN option 2022-03-24 19:06:48 -07:00
quarantine.c Merge branch 'akpm' (patches from Andrew) 2022-01-15 20:37:06 +02:00
report_generic.c kasan: rename kasan_access_info to kasan_report_info 2022-03-24 19:06:50 -07:00
report_hw_tags.c kasan: simplify kasan_find_first_bad_addr call sites 2022-03-24 19:06:49 -07:00
report_sw_tags.c kasan: simplify kasan_find_first_bad_addr call sites 2022-03-24 19:06:49 -07:00
report_tags.c kasan: rename kasan_access_info to kasan_report_info 2022-03-24 19:06:50 -07:00
report.c kasan: disable LOCKDEP when printing reports 2022-03-24 19:06:50 -07:00
shadow.c kasan, vmalloc: only tag normal vmalloc allocations 2022-03-24 19:06:48 -07: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