[DTrace-devel] [PATCH v4 00/23] USDT improvements

Nick Alcock nick.alcock at oracle.com
Wed Feb 21 20:47:54 UTC 2024


This grab-bag of USDT improvements is dominated by two things:

 - adding a per-probe split-out representation to teh DOF stash,
   in service of...
 - ... moving probe creation from dtprobed into dtrace

But there are a lot of related bugfixes I found in the process, from
fixing buffer overruns in obscure cases in libproc and fixing USDT so
that it can handle forking and execing processes properly through to
letting multiple dtraces probe a single process at the same time
(something you can currently do only if you eschew -p and -c and don't
do any USDT or pid probing).  Many of these touch similar places or rely
on earlier commits, but at least they've been split up a bit now!

Unlike too many of my recent postings, all intermediate commits compile
(though I do not guarantee that USDT works well in all intermediate
commits, in fact in at least one intermediate commit it is guaranteed
to fail: noted in the commit log).

Toward the end of the series we revert a couple of commits: these assume
a binutils fix, but if we're not expecting that fix to land in distros
of interest yet, those commits should probably be dropped: they fix USDT
in PIE executables.


Lots of adjustments from v3 after review, mostly the splitting of the
DOF stash and probe movement commits into pieces, the adjustment of
/run/dtrace/stash/dof-pid/$dev-$ino/parsed/ entries to not include the
PID in the parsed probe names, the change of parsed probes to be
formatted as a version number followed by one provider and probe entry
followed by a stream of tracepoints, corresponding changes to dt_pid.c
to get the probespec for the new probe from the DOF rather than by
parsing paths, the dropping and merging of numerous smaller commits, the
addition of a fix for compiling with upstream binutils (early in the
series to make it easier to test the rest of the series for
compilability on systems needing it, the addition of copyright date
fixes, fixing of a pile of tabdamage, and probably other changes too :)

Tested on aarch64 and x86_64 OL8 and OL9 (to provide at least some
version and arch coverage: I'd like to do OL7 too but it's just too
broken right now due to toolchain problems).

Nick Alcock (23):
  dtprobed: logging improvements
  dt_pid: fix building with upstream binutils
  dtprobed: add the DOF stash
  dtrace provider: don't use functions from uprobes.h any more
  dtprobed: handle signals hitting dtprobed better
  dtprobed: migrate away from parser_in_pipe/parser_out_pipe globals
  dtprobed: make dof_read take a pid
  dtprobed: fill out the DOF stash
  dtprobed: reparse the DOF stash when needed
  dt_pid, dtprobed: move uprobe creation to dtrace
  dtprobed: a few test infrastructure improvements
  dof_parser: a bit of const-correctness
  proc: don't ptrace shortlived-grabbed processes if someone else is
    ptracing them
  usdt: test improvements
  Revert "test: Have manyprobes clean up uprobes"
  dtprobed: empty the DOF stash for exec()ed processes
  drti: re-register DOF after fork
  drti: async-signal-safeize
  libproc: fix buffer overread if no auxvs are read
  proc: do not access freed memory when discarding shortlived handles
  Revert "usdt: remove relocations rather than changing their type to
    R_*_NONE"
  Revert "test: Add xfail pending binutils fix"
  dtprobed: fix label indentation

 Makeconfig                                    |   15 +-
 dtprobed/Build                                |    4 +-
 dtprobed/dof_stash.c                          | 1767 +++++++++++++++++
 dtprobed/dof_stash.h                          |   42 +
 dtprobed/dtprobed.c                           |  336 +++-
 dtprobed/dtprobed.service                     |    2 +
 dtprobed/rpl_fuse_log.h                       |    6 +-
 dtrace.spec                                   |    4 +
 include/disasm.h                              |   26 +
 include/port.h                                |    6 +-
 include/sys/compiler.h                        |    4 +-
 libcommon/Build                               |    4 +-
 libcommon/dof_parser.h                        |   22 +-
 libcommon/dof_parser_host.c                   |    8 +-
 libcommon/uprobes.c                           |  343 ----
 libcommon/uprobes.h                           |   35 -
 libdtrace/drti.c                              |  112 +-
 libdtrace/dt_impl.h                           |    9 +-
 libdtrace/dt_link.c                           |  151 +-
 libdtrace/dt_open.c                           |    4 +-
 libdtrace/dt_options.c                        |   18 +
 libdtrace/dt_pid.c                            |  528 ++---
 libdtrace/dt_pid.h                            |    3 +-
 libdtrace/dt_proc.c                           |   21 +-
 libdtrace/dt_proc.h                           |    3 +-
 libdtrace/dt_prov_dtrace.c                    |   24 +-
 libdtrace/dt_prov_uprobe.c                    |  130 +-
 libport/daemonize.c                           |   62 +-
 libproc/Pcontrol.c                            |   20 +-
 libproc/elfish.c                              |    7 +-
 libproc/libproc.h                             |    3 +-
 runtest.sh                                    |   18 +-
 test/unittest/usdt/tst.dlclose2.sh            |    4 +-
 test/unittest/usdt/tst.exec-dof-replacement.r |    1 +
 .../usdt/tst.exec-dof-replacement.r.p         |    2 +
 .../unittest/usdt/tst.exec-dof-replacement.sh |   99 +
 test/unittest/usdt/tst.manyprobes.sh          |   20 +-
 test/unittest/usdt/tst.manyprocs.sh           |   37 +-
 test/unittest/usdt/tst.multitrace.sh          |   22 +-
 test/unittest/usdt/tst.static2.sh             |    2 -
 40 files changed, 2943 insertions(+), 981 deletions(-)
 create mode 100644 dtprobed/dof_stash.c
 create mode 100644 dtprobed/dof_stash.h
 create mode 100644 include/disasm.h
 delete mode 100644 libcommon/uprobes.c
 delete mode 100644 libcommon/uprobes.h
 create mode 100644 test/unittest/usdt/tst.exec-dof-replacement.r
 create mode 100755 test/unittest/usdt/tst.exec-dof-replacement.r.p
 create mode 100755 test/unittest/usdt/tst.exec-dof-replacement.sh

-- 
2.43.0.272.gce700b77fd




More information about the DTrace-devel mailing list