Handle non-dtrace-triggered kernel breakpoint traps in mips.

If DTRACE is enabled at compile time, all kernel breakpoint traps are
first given to dtrace to see if they are triggered by a FBT probe.
Previously if dtrace didn't recognize the trap, it was silently
ignored breaking the handling of other kernel breakpoint traps such as
the debug.kdb.enter sysctl.  This only returns early from the trap
handler if dtrace recognizes the trap and handles it.

Submitted by:	Nicolò Mazzucato <nicomazz97@gmail.com>
Reviewed by:	markj
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D24478
This commit is contained in:
John Baldwin 2020-04-21 17:38:07 +00:00
parent 0c0119856b
commit 5c4309b474
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360168
2 changed files with 5 additions and 3 deletions

View File

@ -251,6 +251,9 @@ dtrace_invop_start(struct trapframe *frame)
int invop;
invop = dtrace_invop(frame->pc, frame, frame->pc);
if (invop == 0)
return (-1);
offs = (invop & LDSD_DATA_MASK);
sp = (register_t *)((uint8_t *)frame->sp + offs);

View File

@ -807,10 +807,9 @@ trap(struct trapframe *trapframe)
#if defined(KDTRACE_HOOKS) || defined(DDB)
case T_BREAK:
#ifdef KDTRACE_HOOKS
if (!usermode && dtrace_invop_jump_addr != 0) {
dtrace_invop_jump_addr(trapframe);
if (!usermode && dtrace_invop_jump_addr != NULL &&
dtrace_invop_jump_addr(trapframe) == 0)
return (trapframe->pc);
}
#endif
#ifdef DDB
kdb_trap(type, 0, trapframe);