FAILED: patch "[PATCH] mm/kfence: disable KFENCE upon KASAN HW tags enablement" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 09833d99db36d74456a4d13eb29c32d56ff8f2b6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026031757-abreast-angling-34e3@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 09833d99db36d74456a4d13eb29c32d56ff8f2b6 Mon Sep 17 00:00:00 2001
From: Alexander Potapenko <[email protected]>
Date: Fri, 13 Feb 2026 10:54:10 +0100
Subject: [PATCH] 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.
mm/kfence/core.c +15 -0
@@ -13,6 +13,7 @@#include <linux/hash.h> #include <linux/irq_work.h> #include <linux/jhash.h> +#include <linux/kasan-enabled.h> #include <linux/kcsan-checks.h> #include <linux/kfence.h> #include <linux/kmemleak.h>
@@ -916,6 +917,20 @@ void __init kfence_alloc_pool_and_metadata(void)if (!kfence_sample_interval)return ; +/* +* If KASAN hardware tags are enabled, disable KFENCE, because it +* does not support MTE yet. +*/ +if (kasan_hw_tags_enabled ()) { +pr_info ("disabled as KASAN HW tags are enabled\n" ); +if (__kfence_pool) { +memblock_free (__kfence_pool,KFENCE_POOL_SIZE ); + __kfence_pool =NULL ; + } + kfence_sample_interval =0 ; +return ; + } +/* * If the pool has already been initialized by arch, there is no need to * re-allocate the memory pool.
Sasha Levin
maintainerPATCH 1/1 mm/kfence: disable KFENCE upon KASAN HW tags enablement
From: Alexander Potapenko <[email protected]>
[ Upstream commit 09833d99db36d74456a4d13eb29c32d56ff8f2b6 ]
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.
--- mm/kfence/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
mm/kfence/core.c +15 -0
@@ -13,6 +13,7 @@#include <linux/hash.h> #include <linux/irq_work.h> #include <linux/jhash.h> +#include <linux/kasan.h> #include <linux/kcsan-checks.h> #include <linux/kfence.h> #include <linux/kmemleak.h>
@@ -807,6 +808,20 @@ void __init kfence_alloc_pool(void)if (!kfence_sample_interval)return ; +/* +* If KASAN hardware tags are enabled, disable KFENCE, because it +* does not support MTE yet. +*/ +if (IS_ENABLED (CONFIG_KASAN_HW_TAGS ) &&kasan_enabled ()) { +pr_info ("disabled as KASAN HW tags are enabled\n" ); +if (__kfence_pool) { +memblock_free (__pa (__kfence_pool),KFENCE_POOL_SIZE ); + __kfence_pool =NULL ; + } + kfence_sample_interval =0 ; +return ; + } + __kfence_pool =memblock_alloc (KFENCE_POOL_SIZE ,PAGE_SIZE );if (!__kfence_pool)
Signature · 1 line
2.51.0