Page MenuHomeFreeBSD

fix debug.kdb.enter=1 with dtrace-enabled kernel
ClosedPublic

Authored by br on Mar 10 2020, 3:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 16 2024, 10:48 PM
Unknown Object (File)
Feb 16 2024, 10:48 PM
Unknown Object (File)
Feb 16 2024, 10:47 PM
Unknown Object (File)
Feb 16 2024, 10:47 PM
Unknown Object (File)
Feb 16 2024, 10:47 PM
Unknown Object (File)
Feb 16 2024, 10:47 PM
Unknown Object (File)
Feb 16 2024, 10:30 PM
Unknown Object (File)
Feb 11 2024, 1:57 AM

Details

Summary

Fix debug enter with "sysctl debug.kdb.enter=1" when dtrace compiled-in to the kernel.

The change to dtrace_subr.c is optimization only and is not mandatory for this patch.

Test Plan

Tested with this one-liner:
dtrace -n 'fbt::malloc:entry { @[stack()] = count(); }'

Other one-liners are available here:
https://wiki.freebsd.org/DTrace/One-Liners

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This is not a RISC-V-specific thing; every architecture currently ignores the return value of dtrace_invop_jump_addr.

Hmm, I'm curious if this breaks on other platforms then.

In D24018#528102, @jhb wrote:

Hmm, I'm curious if this breaks on other platforms then.

This does not break on arm64 because brk instruction != FBT_PATCHVAL.

In D24018#528102, @jhb wrote:

Hmm, I'm curious if this breaks on other platforms then.

It seems to also be broken on !x86. i386 and amd64 return control if dtrace determines that it wasn't the source of the breakpoint.

sys/cddl/dev/dtrace/riscv/dtrace_subr.c
297 ↗(On Diff #69361)

I'd think we should panic in this case, at least with INVARIANTS enabled.

This revision is now accepted and ready to land.Mar 11 2020, 8:05 PM
This revision now requires review to proceed.Mar 12 2020, 1:58 PM
markj added inline comments.
sys/riscv/riscv/trap.c
278 ↗(On Diff #69423)

Since you're changing this line, it should be updated to compare with NULL instead of 0.

This revision is now accepted and ready to land.Mar 12 2020, 11:37 PM
This revision now requires review to proceed.Mar 13 2020, 12:50 PM
sys/cddl/dev/dtrace/riscv/dtrace_subr.c
298 ↗(On Diff #69479)

"doesn't"

This revision is now accepted and ready to land.Apr 17 2020, 7:23 PM

Any reason not to land this?

This revision was automatically updated to reflect the committed changes.