]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm/kfence: disable KFENCE upon KASAN HW tags enablement
authorAlexander Potapenko <glider@google.com>
Fri, 13 Feb 2026 09:54:10 +0000 (10:54 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 24 Feb 2026 19:13:25 +0000 (11:13 -0800)
commit09833d99db36d74456a4d13eb29c32d56ff8f2b6
tree269802372892995151f6753a0a0061ac0a278a16
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
mm/kfence: disable KFENCE upon KASAN HW tags enablement

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: 0ce20dd84089 ("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>
mm/kfence/core.c