Commit b0f51883 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

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: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarAlexandre Chartre <alexandre.chartre@oracle.com>
Link: https://lkml.kernel.org/r/20200505134101.139720912@linutronix.de
parent 8c4e93c3
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/irq_work.h> #include <linux/irq_work.h>
#include <linux/printk.h> #include <linux/printk.h>
#include <linux/kprobes.h>
#include "internal.h" #include "internal.h"
...@@ -293,12 +294,12 @@ static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args) ...@@ -293,12 +294,12 @@ static __printf(1, 0) int vprintk_nmi(const char *fmt, va_list args)
return printk_safe_log_store(s, fmt, args); return printk_safe_log_store(s, fmt, args);
} }
void notrace printk_nmi_enter(void) void noinstr printk_nmi_enter(void)
{ {
this_cpu_add(printk_context, PRINTK_NMI_CONTEXT_OFFSET); this_cpu_add(printk_context, PRINTK_NMI_CONTEXT_OFFSET);
} }
void notrace printk_nmi_exit(void) void noinstr printk_nmi_exit(void)
{ {
this_cpu_sub(printk_context, PRINTK_NMI_CONTEXT_OFFSET); this_cpu_sub(printk_context, PRINTK_NMI_CONTEXT_OFFSET);
} }
......
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