Patch "x86/entry/64: Don't use IST entry for #BP stack" has been added to the 4.15-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
x86/entry/64: Don't use IST entry for #BP stack
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
x86-entry-64-don-t-use-ist-entry-for-bp-stack.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
d8ba61ba58c88d5207c1ba2f7d9a2280e7d03be9Mon Sep 17 00:00:00 2001
From: Andy Lutomirski <[email protected]>
Date: Thu, 23 Jul 2015 15:37:48 -0700
Subject: x86/entry/64: Don't use IST entry for #BP stack
From: Andy Lutomirski <[email protected]>
commit d8ba61ba58c88d5207c1ba2f7d9a2280e7d03be9 upstream.
There's nothing IST-worthy about #BP/int3. We don't allow kprobes in the small handful of places in the kernel that run at CPL0 with an invalid stack, and 32-bit kernels have used normal interrupt gates for #BP forever.
Furthermore, we don't allow kprobes in places that have usergs while in kernel mode, so "paranoid" is also unnecessary.
--- arch/x86/entry/entry_64.S | 2 +- arch/x86/kernel/idt.c | 2 -- arch/x86/kernel/traps.c | 15 ++++++++------- 3 files changed, 9 insertions(+), 10 deletions(-)
arch/x86/entry/entry_64.S +1 -1
@@ -1097,7 +1097,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTO #endif /* CONFIG_HYPERV */ idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK -idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK +idtentry int3 do_int3 has_error_code=0 idtentry stack_segment do_stack_segment has_error_code=1 #ifdef CONFIG_XEN
arch/x86/kernel/idt.c +0 -2
@@ -160,7 +160,6 @@ static const __initconst struct idt_data*/ static const __initconst struct idt_data dbg_idts[] = {INTG (X86_TRAP_DB , debug), -INTG (X86_TRAP_BP , int3), };#endif
@@ -183,7 +182,6 @@ gate_desc debug_idt_table[IDT_ENTRIES] _static const __initconst struct idt_data ist_idts[] = {ISTG (X86_TRAP_DB , debug,DEBUG_STACK ),ISTG (X86_TRAP_NMI , nmi,NMI_STACK ), -SISTG (X86_TRAP_BP , int3,DEBUG_STACK ),ISTG (X86_TRAP_DF , double_fault,DOUBLEFAULT_STACK ), #ifdef CONFIG_X86_MCE ISTG(X86_TRAP_MC, &machine_check, MCE_STACK),
arch/x86/kernel/traps.c +8 -7
@@ -577,7 +577,6 @@ do_general_protection(struct pt_regs *re }NOKPROBE_SYMBOL (do_general_protection); -/* May run on IST stack. */ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) {#ifdef CONFIG_DYNAMIC_FTRACE
@@ -592,6 +591,13 @@ dotraplinkage void notrace do_int3(strucif (poke_int3_handler (regs))return ; +/* +* Use ist_enter despite the fact that we don't use an IST stack. +* We can be called from a kprobe in non-CONTEXT_KERNEL kernel +* mode or even during context tracking state changes. +* +* This means that we can't schedule. That's okay. +*/ ist_enter (regs);RCU_LOCKDEP_WARN (!rcu_is_watching (),"entry code didn't wake RCU" );#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -609,15 +615,10 @@ dotraplinkage void notrace do_int3(struc SIGTRAP) == NOTIFY_STOP) goto exit; -/* -* Let others (NMI) know that the debug stack is in use -* as we may switch to the interrupt stack. -*/ -debug_stack_usage_inc ();cond_local_irq_enable (regs);do_trap (X86_TRAP_BP ,SIGTRAP ,"int3" , regs, error_code,NULL );cond_local_irq_disable (regs); -debug_stack_usage_dec (); + exit:ist_exit (regs); }
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/x86-entry-64-don-t-use-ist-entry-for-bp-stack.patch queue-4.15/selftests-x86-ptrace_syscall-fix-for-yet-more-glibc-interference.patch queue-4.15/x86-vsyscall-64-use-proper-accessor-to-update-p4d-entry.patch queue-4.15/kvm-x86-fix-icebp-instruction-handling.patch