Skip to content

Commit b0f5188

Browse files
Peter ZijlstraKAGA-KOKO
authored andcommitted
printk: Disallow instrumenting print_nmi_enter()
It happens early in nmi_enter(), no tracing, probing or other funnies allowed. Specifically as nmi_enter() will be used in do_debug(), which would cause recursive exceptions when kprobed. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Alexandre Chartre <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 8c4e93c commit b0f5188

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/printk/printk_safe.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/cpumask.h>
1111
#include <linux/irq_work.h>
1212
#include <linux/printk.h>
13+
#include <linux/kprobes.h>
1314

1415
#include "internal.h"
1516

@@ -293,12 +294,12 @@ static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args)
293294
return printk_safe_log_store(s, fmt, args);
294295
}
295296

296-
void notrace printk_nmi_enter(void)
297+
void noinstr printk_nmi_enter(void)
297298
{
298299
this_cpu_add(printk_context, PRINTK_NMI_CONTEXT_OFFSET);
299300
}
300301

301-
void notrace printk_nmi_exit(void)
302+
void noinstr printk_nmi_exit(void)
302303
{
303304
this_cpu_sub(printk_context, PRINTK_NMI_CONTEXT_OFFSET);
304305
}

0 commit comments

Comments
 (0)