x86/nmi: Protect NMI entry against instrumentation
Mark all functions in the fragile code parts noinstr or force inlining so they can't be instrumented. Also make the hardware latency tracer invocation explicit outside of non-instrumentable section. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Andy Lutomirski <luto@kernel.org> Link: https://lkml.kernel.org/r/20200505135314.716186134@linutronix.de
This commit is contained in:
@@ -1709,21 +1709,19 @@ void syscall_init(void)
|
||||
DEFINE_PER_CPU(int, debug_stack_usage);
|
||||
DEFINE_PER_CPU(u32, debug_idt_ctr);
|
||||
|
||||
void debug_stack_set_zero(void)
|
||||
noinstr void debug_stack_set_zero(void)
|
||||
{
|
||||
this_cpu_inc(debug_idt_ctr);
|
||||
load_current_idt();
|
||||
}
|
||||
NOKPROBE_SYMBOL(debug_stack_set_zero);
|
||||
|
||||
void debug_stack_reset(void)
|
||||
noinstr void debug_stack_reset(void)
|
||||
{
|
||||
if (WARN_ON(!this_cpu_read(debug_idt_ctr)))
|
||||
return;
|
||||
if (this_cpu_dec_return(debug_idt_ctr) == 0)
|
||||
load_current_idt();
|
||||
}
|
||||
NOKPROBE_SYMBOL(debug_stack_reset);
|
||||
|
||||
#else /* CONFIG_X86_64 */
|
||||
|
||||
|
Reference in New Issue
Block a user