Commit 389cd0cd authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

x86/debug: Remove the historical junk

Remove the historical junk and replace it with a WARN and a comment.

The problem is that even though the kernel only uses TF single-step in
kprobes and KGDB, both of which consume the event before this, QEMU/KVM has
bugs in this area that can trigger this state so it has to be dealt with.
Suggested-by: default avatarBrian Gerst <brgerst@gmail.com>
Suggested-by: default avatarAndy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20200902133201.170216274@infradead.org
parent f0b67c39
...@@ -843,18 +843,19 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs, ...@@ -843,18 +843,19 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs,
if (notify_debug(regs, &dr6)) if (notify_debug(regs, &dr6))
goto out; goto out;
if (WARN_ON_ONCE(dr6 & DR_STEP)) { /*
/* * The kernel doesn't use TF single-step outside of:
* Historical junk that used to handle SYSENTER single-stepping. *
* This should be unreachable now. If we survive for a while * - Kprobes, consumed through kprobe_debug_handler()
* without anyone hitting this warning, we'll turn this into * - KGDB, consumed through notify_debug()
* an oops. *
*/ * So if we get here with DR_STEP set, something is wonky.
dr6 &= ~DR_STEP; *
set_thread_flag(TIF_SINGLESTEP); * A known way to trigger this is through QEMU's GDB stub,
* which leaks #DB into the guest and causes IST recursion.
*/
if (WARN_ON_ONCE(current->thread.debugreg6 & DR_STEP))
regs->flags &= ~X86_EFLAGS_TF; regs->flags &= ~X86_EFLAGS_TF;
}
out: out:
instrumentation_end(); instrumentation_end();
idtentry_exit_nmi(regs, irq_state); idtentry_exit_nmi(regs, irq_state);
......
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