Commit 83d7d04f authored by Jackie Liu's avatar Jackie Liu Committed by akpm

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.devSigned-off-by: default avatarJackie Liu <liuyun01@kylinos.cn>
Co-developed-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarMarco Elver <elver@google.com>
Reviewed-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent e5c3f619
...@@ -69,8 +69,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_param ...@@ -69,8 +69,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_param
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!num) /* Using 0 to indicate KFENCE is disabled. */ /* Using 0 to indicate KFENCE is disabled. */
if (!num && READ_ONCE(kfence_enabled)) {
pr_info("disabled\n");
WRITE_ONCE(kfence_enabled, false); WRITE_ONCE(kfence_enabled, false);
}
*((unsigned long *)kp->arg) = num; *((unsigned long *)kp->arg) = num;
...@@ -898,6 +901,7 @@ static int kfence_enable_late(void) ...@@ -898,6 +901,7 @@ static int kfence_enable_late(void)
WRITE_ONCE(kfence_enabled, true); WRITE_ONCE(kfence_enabled, true);
queue_delayed_work(system_unbound_wq, &kfence_timer, 0); queue_delayed_work(system_unbound_wq, &kfence_timer, 0);
pr_info("re-enabled\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment