Skip to content

Commit 2778793

Browse files
melverpaulmckrcu
authored andcommitted
kcsan: Show message if enabled early
Show a message in the kernel log if KCSAN was enabled early. Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 4700ccd commit 2778793

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

kernel/kcsan/core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3+
#define pr_fmt(fmt) "kcsan: " fmt
4+
35
#include <linux/atomic.h>
46
#include <linux/bug.h>
57
#include <linux/delay.h>
@@ -463,7 +465,7 @@ kcsan_setup_watchpoint(const volatile void *ptr, size_t size, int type)
463465

464466
if (IS_ENABLED(CONFIG_KCSAN_DEBUG)) {
465467
kcsan_disable_current();
466-
pr_err("KCSAN: watching %s, size: %zu, addr: %px [slot: %d, encoded: %lx]\n",
468+
pr_err("watching %s, size: %zu, addr: %px [slot: %d, encoded: %lx]\n",
467469
is_write ? "write" : "read", size, ptr,
468470
watchpoint_slot((unsigned long)ptr),
469471
encode_watchpoint((unsigned long)ptr, size, is_write));
@@ -623,8 +625,10 @@ void __init kcsan_init(void)
623625
* We are in the init task, and no other tasks should be running;
624626
* WRITE_ONCE without memory barrier is sufficient.
625627
*/
626-
if (kcsan_early_enable)
628+
if (kcsan_early_enable) {
629+
pr_info("enabled early\n");
627630
WRITE_ONCE(kcsan_enabled, true);
631+
}
628632
}
629633

630634
/* === Exported interface =================================================== */

0 commit comments

Comments
 (0)