#
70c712a8 |
| 20-Jun-2024 |
Mark Johnston <markj@FreeBSD.org> |
sdt: Support fetching the probe sixth argument with MI machinery
SDT calls dtrace_probe() directly, and this can be used to pass up to five probe arguments directly. To pass the sixth argument (SDT
sdt: Support fetching the probe sixth argument with MI machinery
SDT calls dtrace_probe() directly, and this can be used to pass up to five probe arguments directly. To pass the sixth argument (SDT currently doesn't support more than this), we use a hack: just add additional parameters to the call and cast dtrace_probe accordingly. This happens to work on amd64, but doesn't work in general.
Modify SDT to call dtrace_probe() after storing arguments beyond the first five in thread-local storage. Implement sdt_getargval() to fetch extra argument values this way. An alternative would be to use invop handlers instead and make sdt_probe_func point to a breakpoint instruction, so that one can extract arguments using the breakpoint exception trapframe, but this makes the providers more expensive when enabled and doesn't seem justified. This approach works well unless we want to add more than one or two more parameters to SDT probes, which seems unlikely at present.
In particular, this fixes fetching the last argument of most ip and tcp probes on arm64.
Reported by: rwatson Reviewed by: Domagoj Stolfa MFC after: 1 month Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45648
show more ...
|
#
bc290114 |
| 19-Jun-2024 |
Mark Johnston <markj@FreeBSD.org> |
dtrace: Remove LOCK_LEVEL
It is unused on FreeBSD. No functional change intended.
MFC after: 1 week
|
Revision tags: release/14.1.0, release/13.3.0, release/14.0.0 |
|
#
95ee2897 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
e967a9a5 |
| 19-Jul-2023 |
Christos Margiolis <christos@FreeBSD.org> |
Revert "dtrace: cache current probe in kdtrace_thread_t"
This reverts commit 22508c8b6c284ad9ad1385c703e224e1ed3fbd7c.
The t_kinst_curprobe field is no longer needed by kinst.
Reviewed by: markj A
Revert "dtrace: cache current probe in kdtrace_thread_t"
This reverts commit 22508c8b6c284ad9ad1385c703e224e1ed3fbd7c.
The t_kinst_curprobe field is no longer needed by kinst.
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41031
show more ...
|
#
22508c8b |
| 04-Jul-2023 |
Christos Margiolis <christos@FreeBSD.org> |
dtrace: cache current probe in kdtrace_thread_t
Needed by the forthcoming RISC-V and ARM64 ports.
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Re
dtrace: cache current probe in kdtrace_thread_t
Needed by the forthcoming RISC-V and ARM64 ports.
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40872
show more ...
|
#
1aa48621 |
| 13-Jun-2023 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: rename t_kinst to t_kinst_tramp
The forthcoming RISC-V and ARM64 ports of kinst introduce a new field named "t_kinst_curprobe", so "t_kinst" (which points to a trampoline) becomes a misleadin
kinst: rename t_kinst to t_kinst_tramp
The forthcoming RISC-V and ARM64 ports of kinst introduce a new field named "t_kinst_curprobe", so "t_kinst" (which points to a trampoline) becomes a misleading name.
No functional change intended.
Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40507
show more ...
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
f0bc4ed1 |
| 11-Oct-2022 |
Christos Margiolis <christos@FreeBSD.org> |
kinst: Initial revision
This is a new DTrace provider which allows arbitrary kernel instructions to be traced. Currently it is implemented only for amd64.
kinst probes are created on demand by lib
kinst: Initial revision
This is a new DTrace provider which allows arbitrary kernel instructions to be traced. Currently it is implemented only for amd64.
kinst probes are created on demand by libdtrace, and there is a probe for each kernel instruction. Probes are named kinst:<module>:<function>:<offset>, where "offset" is the offset of the target instruction relative to the beginning of the function. Omitting "offset" causes all instructions in the function to be traced.
kinst works similarly to FBT in that it places a breakpoint on the target instruction and hooks into the kernel breakpoint handler. Because kinst has to be able to trace arbitrary instructions, it does not emulate most of them in software but rather causes the traced thread to execute a copy of the instruction before returning to the original code.
The provider is quite low-level and as-is will be useful mostly only to kernel developers. However, it provides a great deal of visibility into kernel code execution and could be used as a building block for higher-level tooling which can in some sense translate between C sources and generated machine code. In particular, the "regs" variable recently added to D allows the CPU's register file to be accessed from kinst probes.
kinst is experimental and should not be used on production systems for now.
In collaboration with: markj Sponsored by: Google, Inc. (GSoC 2022) MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D36851
show more ...
|
#
bdd101c4 |
| 04-Oct-2022 |
Mark Johnston <markj@FreeBSD.org> |
dtrace: Add a "regs" variable
This allows invop-based providers (i.e., fbt and kinst) to expose the register file of the CPU at the point where the probe fired. It does not work for SDT providers b
dtrace: Add a "regs" variable
This allows invop-based providers (i.e., fbt and kinst) to expose the register file of the CPU at the point where the probe fired. It does not work for SDT providers because their probes are implemented as plain function calls and so don't save registers. It's not clear what semantics "regs" should have for them anyway.
This is akin to "uregs", which nominally provides access to the userspace registers. In fact, DIF already had a DIF_VAR_REGS variable defined, it was simply unimplemented.
Usage example: print the contents of %rdi upon each call to amd64_syscall():
fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}
Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d. Currently there are no similar definitions for non-x86 platforms.
Reviewed by: christos MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D36799
show more ...
|
Revision tags: release/13.1.0 |
|
#
326d5782 |
| 28-Dec-2021 |
John Baldwin <jhb@FreeBSD.org> |
dtrace: Use C99 fixed-width integer types.
No functional change.
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D33631
|
Revision tags: release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0 |
|
#
18b18078 |
| 25-Feb-2019 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r344527
|
#
a8fe8db4 |
| 25-Feb-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r344178 through r344512.
|
#
4f1b715c |
| 21-Feb-2019 |
Mark Johnston <markj@FreeBSD.org> |
Fix a tracepoint lookup race in fasttrap_pid_probe().
fasttrap hooks the userspace breakpoint handler; the hook looks up the breakpoint address in a hash table of tracepoints. It is possible for th
Fix a tracepoint lookup race in fasttrap_pid_probe().
fasttrap hooks the userspace breakpoint handler; the hook looks up the breakpoint address in a hash table of tracepoints. It is possible for the tracepoint to be removed by a different thread in between the breakpoint trap and the hash table lookup, in which case SIGTRAP gets delivered to the target process. Fix the problem by adding a per-process generation counter that gets incremented when a tracepoint belonging to that process is removed. Then, when a lookup fails, the trapping instruction is restarted if the thread's counter doesn't match that of the process.
Reviewed by: cem MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19273
show more ...
|
Revision tags: release/12.0.0, release/11.2.0 |
|
#
85931364 |
| 10-Apr-2018 |
Mark Johnston <markj@FreeBSD.org> |
Assert that dtrace_probe() doesn't re-enter itself.
This helps catch cases where an instrumented function is called while in probe context.
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> M
Assert that dtrace_probe() doesn't re-enter itself.
This helps catch cases where an instrumented function is called while in probe context.
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> MFC after: 2 weeks Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D14863
show more ...
|
Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0, release/10.3.0 |
|
#
b626f5a7 |
| 04-Jan-2016 |
Glen Barber <gjb@FreeBSD.org> |
MFH r289384-r293170
Sponsored by: The FreeBSD Foundation
|
#
9a7cd2e6 |
| 22-Dec-2015 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
MFH @r292599
This includes the pluggable TCP framework and other chnages to the netstack to track for VNET stability.
Security: The FreeBSD Foundation
|
#
8ff6d9dd |
| 17-Dec-2015 |
Mark Johnston <markj@FreeBSD.org> |
Support an arbitrary number of arguments to DTrace syscall probes.
Rather than pushing all eight possible arguments into dtrace_probe()'s stack frame, make the syscall_args struct for the current sy
Support an arbitrary number of arguments to DTrace syscall probes.
Rather than pushing all eight possible arguments into dtrace_probe()'s stack frame, make the syscall_args struct for the current syscall available via the current thread. Using a custom getargval method for the systrace provider, this allows any syscall argument to be fetched, even in kernels that have modified the maximum number of system call arguments.
Sponsored by: EMC / Isilon Storage Division
show more ...
|
Revision tags: release/10.2.0, release/10.1.0 |
|
#
246e7a2b |
| 02-Sep-2014 |
Neel Natu <neel@FreeBSD.org> |
IFC @r269962
Submitted by: Anish Gupta (akgupt3@gmail.com)
|
#
ee7b0571 |
| 19-Aug-2014 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Merge head from 7/28
|
#
1b833d53 |
| 13-Aug-2014 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
Sync to HEAD@r269943.
|
Revision tags: release/9.3.0 |
|
#
0c2b6019 |
| 26-Jun-2014 |
Rui Paulo <rpaulo@FreeBSD.org> |
MFV illumos r266986:
2915 DTrace in a zone should see "cpu", "curpsinfo", et al 2916 DTrace in a zone should be able to access fds[] 2917 DTrace in a zone should have limited provider access
MFC af
MFV illumos r266986:
2915 DTrace in a zone should see "cpu", "curpsinfo", et al 2916 DTrace in a zone should be able to access fds[] 2917 DTrace in a zone should have limited provider access
MFC after: 2 weeks
show more ...
|
#
6cec9cad |
| 03-Jun-2014 |
Peter Grehan <grehan@FreeBSD.org> |
MFC @ r266724
An SVM update will follow this.
|
#
3b8f0845 |
| 28-Apr-2014 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Merge head
|
#
84e51a1b |
| 23-Apr-2014 |
Alan Somers <asomers@FreeBSD.org> |
IFC @264767
|
#
0626f3e4 |
| 14-Apr-2014 |
Mark Johnston <markj@FreeBSD.org> |
DTrace's pid provider works by inserting breakpoint instructions at probe sites and installing a hook at the kernel's trap handler. The fasttrap code will emulate the overwritten instruction in some
DTrace's pid provider works by inserting breakpoint instructions at probe sites and installing a hook at the kernel's trap handler. The fasttrap code will emulate the overwritten instruction in some common cases, but otherwise copies it out into some scratch space in the traced process' address space and ensures that it's executed after returning from the trap.
In Solaris and illumos, this (per-thread) scratch space comes from some reserved space in TLS, accessible via the fs segment register. This approach is somewhat unappealing on FreeBSD since it would require some modifications to rtld and jemalloc (for static TLS) to ensure that TLS is executable, and would thus introduce dependencies on their implementation details. I think it would also be impossible to safely trace static binaries compiled without these modifications.
This change implements the functionality in a different way, by having fasttrap map pages into the target process' address space on demand. Each page is divided into 64-byte chunks for use by individual threads, and fasttrap's process descriptor struct has been extended to keep track of any scratch space allocated for the corresponding process.
With this change it's possible to trace all libc functions in a program, e.g. with
pid$target:libc.so.*::entry {@[probefunc] = count();}
Previously this would generally cause the victim process to crash, as tracing memcpy on amd64 requires the functionality described above.
Tested by: Prashanth Kumar <pra_udupi@yahoo.co.in> (earlier version) MFC after: 6 weeks
show more ...
|
Revision tags: release/10.0.0, release/9.2.0, release/8.4.0, release/9.1.0, release/8.3.0_cvs, release/8.3.0, release/9.0.0, release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0 |
|
#
6f3544cd |
| 26-Oct-2010 |
Marcel Moolenaar <marcel@FreeBSD.org> |
Merge svn+ssh://svn.freebsd.org/base/head@214309
|