Page MenuHomeFreeBSD

dtrace/amd64: Fix probe argument fetching
ClosedPublic

Authored by markj on Sep 14 2024, 6:49 PM.
Tags
None
Referenced Files
F110747780: D46672.diff
Sat, Feb 22, 2:31 PM
F110743482: D46672.id143445.diff
Sat, Feb 22, 1:51 PM
F110741938: D46672.id143340.diff
Sat, Feb 22, 1:36 PM
Unknown Object (File)
Sat, Jan 25, 12:56 PM
Unknown Object (File)
Sat, Jan 25, 10:33 AM
Unknown Object (File)
Jan 10 2025, 3:08 PM
Unknown Object (File)
Jan 10 2025, 2:43 PM
Unknown Object (File)
Jan 10 2025, 4:52 AM
Subscribers

Details

Summary

dtrace_getarg() previously walked the call stack looking for a frame
matching the dtrace_invop_callsite symbol, in order to look for a
trapframe corresponding to an invop (i.e., FBT or kinst) probe. Commit
3ba8e9dc4a0e broke this in some cases by breaking the expected alignment
of the dtrace_invop_callsite symbol.

Rather than groveling around the stack to find invop probe arguments,
simply use the trapframe reference saved by dtrace_invop(). This is
simpler and less fragile.

Reported by: avg
MFC after: 2 weeks
Fixes: 3ba8e9dc4a0e ("dtrace/amd64: Implement emulation of call instructions")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Sep 14 2024, 6:49 PM
avg added a subscriber: avg.

I like how using t_dtrace_trapframe both eliminates the search for the frame below the trap frame and the assumption on the position of the trap frame.

The change looks good to me.

sys/cddl/dev/dtrace/amd64/dtrace_isa.c
35

Just curious, what requires this header?

This revision is now accepted and ready to land.Sep 15 2024, 8:55 AM
markj added inline comments.
sys/cddl/dev/dtrace/amd64/dtrace_isa.c
35

This is for the t_dtrace_trapframe macro and per-thread struct kdtrace_thread.

It's a bit silly having these in a separate cddl header. I'd like to get rid of it someday.

This revision was automatically updated to reflect the committed changes.
markj marked an inline comment as done.