Linux DTrace development list
 help / color / mirror / Atom feed
* [PATCH 0/6] dtrace: support user-space symbol resolution via uresolve()
@ 2026-06-05 22:12 Alan Maguire
  2026-06-05 22:12 ` [PATCH 1/6] libdtrace: Pack declared bitfields into C storage units Alan Maguire
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Alan Maguire @ 2026-06-05 22:12 UTC (permalink / raw)
  To: dtrace; +Cc: dtrace-devel, Alan Maguire

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-06-06  1:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 22:12 [PATCH 0/6] dtrace: support user-space symbol resolution via uresolve() Alan Maguire
2026-06-05 22:12 ` [PATCH 1/6] libdtrace: Pack declared bitfields into C storage units Alan Maguire
2026-06-06  1:54   ` Kris Van Hees
2026-06-05 22:12 ` [PATCH 2/6] libdtrace: do not taint scalar alloca member loads Alan Maguire
2026-06-05 22:12 ` [PATCH 3/6] dtrace: add 'probeoff' variable to record relative offset of probes Alan Maguire
2026-06-06  1:38   ` [DTrace-devel] " Kris Van Hees
2026-06-05 22:12 ` [PATCH 4/6] dtrace: Add uresolve(symbol_name[, optional_fallback]) for symbol lookup Alan Maguire
2026-06-06  1:08   ` [DTrace-devel] " Kris Van Hees
2026-06-05 22:12 ` [PATCH 5/6] test,funcs: add uresolve() tests Alan Maguire
2026-06-05 22:12 ` [PATCH 6/6] docs: document uresolve() in the user guide Alan Maguire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox