kfence: fix KASAN HW tags bypass via runtime sample_interval change
Subsystems (2)
Alexander Potapenko
maintainerPATCH 1/1 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.
Fixes 09833d99db36 ("mm/kfence: disable KFENCE upon KASAN HW tags enablement")
Cc Marco Elver <[email protected]>
Cc Greg Thelen <[email protected]>
Cc Roman Gushchin <[email protected]>
Signed-off-by Alexander Potapenko <[email protected]>
--- mm/kfence/core.c | 5 +++++ 1 file changed, 5 insertions(+)
mm/kfence/core.c +5 -0
@@ -77,6 +77,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_paramWRITE_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 )
Signature · 1 line
2.54.0.545.g6539524ca2-goog