svn commit: r339273 - in stable/11/sys: amd64/amd64 i386/i386
John Baldwin
jhb at FreeBSD.org
Tue Oct 9 22:35:44 UTC 2018
Author: jhb
Date: Tue Oct 9 22:35:43 2018
New Revision: 339273
URL: https://svnweb.freebsd.org/changeset/base/339273
Log:
MFC 338976: Don't clear DR6 for debug exceptions from userland.
This reverts part of r333368. The attempt to clear DR6 was occuring
too soon as trapsignal() does not pause to let the debugger notice the
SIGTRAP and query DR6. The signal exchange does not occur until much
later during ast(). As a result, GDB was no longer recognizing
hardware breakpoints and watchpoints on x86.
In addition, any userland programs that want to inspect DR6 in a
SIGTRAP handler don't have a way to do this if we clear DR6 in the
exception handler.
Instead of relying on the kernel to clear DR6, debuggers will have to
explicitly clear it after a trace trap (which they needed to do on
older kernels anyway).
Modified:
stable/11/sys/amd64/amd64/trap.c
stable/11/sys/i386/i386/trap.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/amd64/amd64/trap.c
==============================================================================
--- stable/11/sys/amd64/amd64/trap.c Tue Oct 9 22:22:15 2018 (r339272)
+++ stable/11/sys/amd64/amd64/trap.c Tue Oct 9 22:35:43 2018 (r339273)
@@ -656,12 +656,6 @@ trap(struct trapframe *frame)
KASSERT((read_rflags() & PSL_I) != 0, ("interrupts disabled"));
trapsignal(td, &ksi);
- /*
- * Clear any pending debug exceptions after allowing a
- * debugger to read DR6 while stopped in trapsignal().
- */
- if (type == T_TRCTRAP)
- load_dr6(0);
userret:
userret(td, frame);
KASSERT(PCB_USER_FPU(td->td_pcb),
Modified: stable/11/sys/i386/i386/trap.c
==============================================================================
--- stable/11/sys/i386/i386/trap.c Tue Oct 9 22:22:15 2018 (r339272)
+++ stable/11/sys/i386/i386/trap.c Tue Oct 9 22:35:43 2018 (r339273)
@@ -758,12 +758,6 @@ kernel_trctrap:
KASSERT((read_eflags() & PSL_I) != 0, ("interrupts disabled"));
trapsignal(td, &ksi);
- /*
- * Clear any pending debug exceptions after allowing a
- * debugger to read DR6 while stopped in trapsignal().
- */
- if (type == T_TRCTRAP)
- load_dr6(0);
user:
userret(td, frame);
KASSERT(PCB_USER_FPU(td->td_pcb),
More information about the svn-src-stable
mailing list