aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/entry/entry_64.S2
-rw-r--r--arch/x86/kernel/idt.c2
-rw-r--r--arch/x86/kernel/traps.c15
3 files changed, 9 insertions, 10 deletions
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index d5c7f18f79ac..9b114675fbc0 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1138,7 +1138,7 @@ apicinterrupt3 HYPERV_REENLIGHTENMENT_VECTOR \
1138#endif /* CONFIG_HYPERV */ 1138#endif /* CONFIG_HYPERV */
1139 1139
1140idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK 1140idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
1141idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK 1141idtentry int3 do_int3 has_error_code=0
1142idtentry stack_segment do_stack_segment has_error_code=1 1142idtentry stack_segment do_stack_segment has_error_code=1
1143 1143
1144#ifdef CONFIG_XEN 1144#ifdef CONFIG_XEN
diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c
index 56d99be3706a..50bee5fe1140 100644
--- a/arch/x86/kernel/idt.c
+++ b/arch/x86/kernel/idt.c
@@ -160,7 +160,6 @@ static const __initconst struct idt_data early_pf_idts[] = {
160 */ 160 */
161static const __initconst struct idt_data dbg_idts[] = { 161static const __initconst struct idt_data dbg_idts[] = {
162 INTG(X86_TRAP_DB, debug), 162 INTG(X86_TRAP_DB, debug),
163 INTG(X86_TRAP_BP, int3),
164}; 163};
165#endif 164#endif
166 165
@@ -183,7 +182,6 @@ gate_desc debug_idt_table[IDT_ENTRIES] __page_aligned_bss;
183static const __initconst struct idt_data ist_idts[] = { 182static const __initconst struct idt_data ist_idts[] = {
184 ISTG(X86_TRAP_DB, debug, DEBUG_STACK), 183 ISTG(X86_TRAP_DB, debug, DEBUG_STACK),
185 ISTG(X86_TRAP_NMI, nmi, NMI_STACK), 184 ISTG(X86_TRAP_NMI, nmi, NMI_STACK),
186 SISTG(X86_TRAP_BP, int3, DEBUG_STACK),
187 ISTG(X86_TRAP_DF, double_fault, DOUBLEFAULT_STACK), 185 ISTG(X86_TRAP_DF, double_fault, DOUBLEFAULT_STACK),
188#ifdef CONFIG_X86_MCE 186#ifdef CONFIG_X86_MCE
189 ISTG(X86_TRAP_MC, &machine_check, MCE_STACK), 187 ISTG(X86_TRAP_MC, &machine_check, MCE_STACK),
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 3d9b2308e7fa..03f3d7695dac 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -577,7 +577,6 @@ do_general_protection(struct pt_regs *regs, long error_code)
577} 577}
578NOKPROBE_SYMBOL(do_general_protection); 578NOKPROBE_SYMBOL(do_general_protection);
579 579
580/* May run on IST stack. */
581dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) 580dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
582{ 581{
583#ifdef CONFIG_DYNAMIC_FTRACE 582#ifdef CONFIG_DYNAMIC_FTRACE
@@ -592,6 +591,13 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
592 if (poke_int3_handler(regs)) 591 if (poke_int3_handler(regs))
593 return; 592 return;
594 593
594 /*
595 * Use ist_enter despite the fact that we don't use an IST stack.
596 * We can be called from a kprobe in non-CONTEXT_KERNEL kernel
597 * mode or even during context tracking state changes.
598 *
599 * This means that we can't schedule. That's okay.
600 */
595 ist_enter(regs); 601 ist_enter(regs);
596 RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); 602 RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
597#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 603#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -609,15 +615,10 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
609 SIGTRAP) == NOTIFY_STOP) 615 SIGTRAP) == NOTIFY_STOP)
610 goto exit; 616 goto exit;
611 617
612 /*
613 * Let others (NMI) know that the debug stack is in use
614 * as we may switch to the interrupt stack.
615 */
616 debug_stack_usage_inc();
617 cond_local_irq_enable(regs); 618 cond_local_irq_enable(regs);
618 do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL); 619 do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
619 cond_local_irq_disable(regs); 620 cond_local_irq_disable(regs);
620 debug_stack_usage_dec(); 621
621exit: 622exit:
622 ist_exit(regs); 623 ist_exit(regs);
623} 624}