aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
authorAlexander Potapenko <glider@google.com>2026-05-07 11:52:37 +0200
committerAndrew Morton <akpm@linux-foundation.org>2026-05-28 21:24:46 -0700
commite4f5f6f3c199ae7fbe142da6b79a97a504ac7e55 (patch)
tree86b760b752dad3eed4b663af81fe8fd57be9ad0a /mm
parent83544c68f71da543f59fdc9b30c1f5ff66de1a25 (diff)
downloadlinux-next-history-e4f5f6f3c199ae7fbe142da6b79a97a504ac7e55.tar.gz
kfence: fix KASAN HW tags bypass via runtime sample_interval change
If a user writes a non-zero value to the sample_interval module parameter at runtime, the missing KASAN HW tags check in the late init path allows KFENCE to be enabled alongside KASAN HW tags, bypassing the boot restriction. This patch adds the missing check to param_set_sample_interval() to reject the parameter change if KASAN HW tags are enabled. Link: https://lore.kernel.org/20260507095237.741017-1-glider@google.com Fixes: 09833d99db36 ("mm/kfence: disable KFENCE upon KASAN HW tags enablement") Signed-off-by: Alexander Potapenko <glider@google.com> Cc: Marco Elver <elver@google.com> Cc: Greg Thelen <gthelen@google.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Pimyn Girgis <pimyn@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/kfence/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index 655dc5ce32409..ee6ae01de5aef 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -77,6 +77,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_param
WRITE_ONCE(kfence_enabled, false);
}
+ if (num && kasan_hw_tags_enabled()) {
+ pr_info("disabled as KASAN HW tags are enabled\n");
+ return -EINVAL;
+ }
+
*((unsigned long *)kp->arg) = num;
if (num && !READ_ONCE(kfence_enabled) && system_state != SYSTEM_BOOTING)