Skip to content

Commit 83d7d04

Browse files
JackieLiu1akpm00
authored andcommitted
mm/kfence: print disabling or re-enabling message
By printing information, we can friendly prompt the status change information of kfence by dmesg and record by syslog. Also, set kfence_enabled to false only when needed. Link: https://lkml.kernel.org/r/20220518073105.3160335-1-liu.yun@linux.dev Signed-off-by: Jackie Liu <liuyun01@kylinos.cn> Co-developed-by: Marco Elver <elver@google.com> Signed-off-by: Marco Elver <elver@google.com> Reviewed-by: Marco Elver <elver@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent e5c3f61 commit 83d7d04

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mm/kfence/core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_param
6969
if (ret < 0)
7070
return ret;
7171

72-
if (!num) /* Using 0 to indicate KFENCE is disabled. */
72+
/* Using 0 to indicate KFENCE is disabled. */
73+
if (!num && READ_ONCE(kfence_enabled)) {
74+
pr_info("disabled\n");
7375
WRITE_ONCE(kfence_enabled, false);
76+
}
7477

7578
*((unsigned long *)kp->arg) = num;
7679

@@ -898,6 +901,7 @@ static int kfence_enable_late(void)
898901

899902
WRITE_ONCE(kfence_enabled, true);
900903
queue_delayed_work(system_unbound_wq, &kfence_timer, 0);
904+
pr_info("re-enabled\n");
901905
return 0;
902906
}
903907

0 commit comments

Comments
 (0)