[DTrace-devel] [PATCH 0/6] dtrace: support user-space symbol resolution via uresolve()

Alan Maguire alan.maguire at oracle.com
Fri Jun 5 22:12:11 UTC 2026


Resolution of userspace symbols is added via subfunction

uresolve("name"[,fallback])

which returns the runtime-resolved address of the symbol for use
in probe context like copyin()ing values.

At cg time DTrace records the relative symbol offset and at runtime
we compute the actual location by utilizing the probe context
userspace instruction pointer and the cg-recorded probe offset;

runtime_symbol_addr = symbol_offset + userspace_pc - probe_offset

Note that this series - since it adds support for systemwide
probes to uresolve() - depends on the patches in [1], so a
clean devel branch will need the systemwide probe patches
applied.

Patches 1 and 2 fix a few issues encountered when using uresolve()
to help construct python stacks.  Patch 3 adds the recording of
the probe offset used in the above computation in machine state.
Patch 4 adds uresolve() support, while patch 5 adds negative and
positive tests for symbol resolution.  Patch 6 documents uresolve().

One specific application of this is to walk python stacks; for
python3.6 we can uresolve("_PyThreadState_Current") and walk
stack frames from there.

[1] https://lore.kernel.org/dtrace/20260304080125.649031-1-alan.maguire@oracle.com/

Alan Maguire (6):
  libdtrace: Pack declared bitfields into C storage units
  libdtrace: do not taint scalar alloca member loads
  dtrace: add 'probeoff' variable to record relative offset of probes
  dtrace: Add uresolve(symbol_name[, optional_fallback]) for symbol
    lookup
  test,funcs: add uresolve() tests
  docs: document uresolve() in the user guide

 bpf/get_bvar.c                                |   7 +
 doc/userguide/index.md                        |   1 +
 doc/userguide/reference/dtrace_functions.md   |   4 +
 doc/userguide/reference/function_uresolve.md  |  61 +++
 include/dtrace/dif_defines.h                  |   4 +-
 libdtrace/dt_bpf.c                            |   1 +
 libdtrace/dt_cg.c                             | 503 +++++++++++++++++-
 libdtrace/dt_dctx.h                           |   2 +
 libdtrace/dt_decl.c                           | 198 +++++--
 libdtrace/dt_decl.h                           |   6 +
 libdtrace/dt_open.c                           |   4 +
 libdtrace/dt_parser.c                         |  15 +-
 libdtrace/dt_probe.h                          |   1 +
 libdtrace/dt_prov_uprobe.c                    |  66 ++-
 test/unittest/bitfields/tst.SizeofBitField.d  |   6 +-
 test/unittest/bitfields/tst.SizeofBitField.r  |  12 +-
 .../tst.alloca-struct-scalar-load-taint.d     |  35 ++
 test/unittest/funcs/uresolve/err.nofallback.d |  21 +
 test/unittest/funcs/uresolve/err.nofallback.r |   2 +
 test/unittest/funcs/uresolve/tst.fallback.d   |  25 +
 test/unittest/funcs/uresolve/tst.fallback.r   |   2 +
 test/unittest/funcs/uresolve/tst.positive.sh  | 144 +++++
 22 files changed, 1054 insertions(+), 66 deletions(-)
 create mode 100644 doc/userguide/reference/function_uresolve.md
 create mode 100644 test/unittest/funcs/alloca/tst.alloca-struct-scalar-load-taint.d
 create mode 100644 test/unittest/funcs/uresolve/err.nofallback.d
 create mode 100644 test/unittest/funcs/uresolve/err.nofallback.r
 create mode 100644 test/unittest/funcs/uresolve/tst.fallback.d
 create mode 100644 test/unittest/funcs/uresolve/tst.fallback.r
 create mode 100755 test/unittest/funcs/uresolve/tst.positive.sh

-- 
2.43.5




More information about the DTrace-devel mailing list