Skip to content

Commit

Permalink
mm/kfence: print disabling or re-enabling message
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
JackieLiu1 authored and akpm00 committed May 25, 2022
1 parent e5c3f61 commit 83d7d04
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mm/kfence/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ static int param_set_sample_interval(const char *val, const struct kernel_param
if (ret < 0)
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);
}

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

Expand Down Expand Up @@ -898,6 +901,7 @@ static int kfence_enable_late(void)

WRITE_ONCE(kfence_enabled, true);
queue_delayed_work(system_unbound_wq, &kfence_timer, 0);
pr_info("re-enabled\n");
return 0;
}

Expand Down

0 comments on commit 83d7d04

Please sign in to comment.