linux/mm/kfence
Alexander Potapenko 45785772d5 mm/kfence: disable KFENCE upon KASAN HW tags enablement
commit 09833d99db upstream.

KFENCE does not currently support KASAN hardware tags.  As a result, the
two features are incompatible when enabled simultaneously.

Given that MTE provides deterministic protection and KFENCE is a
sampling-based debugging tool, prioritize the stronger hardware
protections.  Disable KFENCE initialization and free the pre-allocated
pool if KASAN hardware tags are detected to ensure the system maintains
the security guarantees provided by MTE.

Link: https://lkml.kernel.org/r/20260213095410.1862978-1-glider@google.com
Fixes: 0ce20dd840 ("mm: add Kernel Electric-Fence infrastructure")
Signed-off-by: Alexander Potapenko <glider@google.com>
Suggested-by: Marco Elver <elver@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Ernesto Martinez Garcia <ernesto.martinezgarcia@tugraz.at>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Kees Cook <kees@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-03-19 16:08:29 +01:00
..
.kunitconfig kfence: test: use new suite_{init/exit} support, add .kunitconfig 2022-05-02 12:35:57 -06:00
core.c mm/kfence: disable KFENCE upon KASAN HW tags enablement 2026-03-19 16:08:29 +01:00
kfence.h kfence: save freeing stack trace at calling time instead of freeing time 2024-09-01 20:26:12 -07:00
kfence_test.c mm/kfence: use str_write_read() helper in get_access_type() 2025-01-25 20:22:45 -08:00
Makefile kfence: avoid passing -g for test 2023-03-23 17:18:35 -07:00
report.c mm/kfence: use str_write_read() helper in get_access_type() 2025-01-25 20:22:45 -08:00