public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: dtrace@lists.linux.dev
Cc: dtrace-devel@oss.oracle.com, Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v5 0/9] stapsdt provider: simple system-wide probing
Date: Wed,  4 Mar 2026 08:01:16 +0000	[thread overview]
Message-ID: <20260304080125.649031-1-alan.maguire@oracle.com> (raw)

This series adds wildcard support to stapsdt probes to allow
tracing system-wide; this has caveats due to the way the kernel
implements probe addition.  In essence, probes are added on a
per-inode basis (actually in the VMA associated with the inode)
so it is necessary to identify the file where probes are found.
Probes will fire for existing and new processes (the RFC incorrectly
said they will not work for existing binaries; they in fact do).

Patch 2 describes the approach; to facilitate systemwide tracing
we need to tell DTrace the name of the binary/library via either
using module absolute path (patch 1 updates parsing to support use
of a '/' in a module descriptor to faciliate this support) or an
module name; to expand this we then use [LD_LIBRARY_]PATH
to resolve the full path.  ELF reading of the file and insertion
of probes then proceeds in a similar manner to per-pid tracing.

Patches 3-8 test various aspects of systemwide probes; basic
binary support, library support, listing support and is-enabled
probes support, and use of absolute paths.

Tests ensure wildcards work for

1. a process started prior to DTrace
2. a process started by DTrace (-c)
3. two processes started after DTrace is running
   (via system())

Patch 9 updates docs to describe stapsdt wildcard support.

Changes since v4:

- Restrict '/' to module names (Kris, patch 1)
- Name probes as provider0 rather than provider* (Kris, patch 2)
- Resync with devel branch

Changes since v3:

- Semaphores need to be more carefully declared to handle
  the is-enabled case where the process is not running when
  DTrace starts tracing; the kernel handles reference counts
  so the probes must be added to the ".probes" section; see
  patches 8/9 for how this is done.
- Modified tests to start an instance of the test program
 prior to DTrace execution and start two further during
  DTrace execution; ensure we see probe firings for all
  4 of these processes before declaring success (Kris,
  patches 3, 4, 5, 8)

Changes since v2:

- support absolute paths (patch 1, 2)
- add tests for absolute paths (patch 4, 7)
- document systemwide probe support for listing/using absolute
  paths (patch 9)

Changes since RFC:

- update documentation/commit messages to reflect that we also
  catch existing programs/libraries when probes are enabled
- fixup provider name for wildcard probes to be 'provider*'
  rather than using the confusing 'provider-1' since the
  latter is the concatenation of probename and pid (-1 is
  used to connote all pids)
- add test for is-enabled systemwide probes

Alan Maguire (9):
  dt_lex: support '/' in probe descriptors
  stapsdt provider: support systemwide probing
  test: add systemwide stapsdt note test
  test: add systemwide stapsdt note test using absolute path
  test: add systemwide stapsdt note test for library
  stapsdt: add test for listing systemwide probes in object
  stapsdt: add test for listing systemwide probes in absolute path
    object
  stapsdt: add systemwide test for is-enabled probes
  documentation: update stapsdt docs to describe wildcard support

 .../reference/dtrace_providers_stapsdt.md     |  91 +++++-
 libdtrace/dt_lex.l                            |   2 +-
 libdtrace/dt_pid.c                            | 174 +++++++++---
 libdtrace/dt_prov_uprobe.c                    |  15 +-
 libdtrace/dt_subr.c                           |   6 +
 .../tst.stapsdt-notes-systemwide-abspath.r    |   5 +
 .../tst.stapsdt-notes-systemwide-abspath.sh   |  89 ++++++
 .../tst.stapsdt-notes-systemwide-isenabled.r  |  13 +
 .../tst.stapsdt-notes-systemwide-isenabled.sh | 266 ++++++++++++++++++
 .../tst.stapsdt-notes-systemwide-l-abspath.sh |  48 ++++
 .../usdt/tst.stapsdt-notes-systemwide-l.sh    |  48 ++++
 .../usdt/tst.stapsdt-notes-systemwide-lib.r   |  14 +
 .../usdt/tst.stapsdt-notes-systemwide-lib.sh  | 215 ++++++++++++++
 ...tst.stapsdt-notes-systemwide-lv-abspath.sh |  48 ++++
 .../usdt/tst.stapsdt-notes-systemwide-lv.sh   |  48 ++++
 .../usdt/tst.stapsdt-notes-systemwide.r       |   5 +
 .../usdt/tst.stapsdt-notes-systemwide.sh      |  89 ++++++
 17 files changed, 1125 insertions(+), 51 deletions(-)
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes-systemwide-abspath.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-abspath.sh
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes-systemwide-isenabled.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-isenabled.sh
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-l-abspath.sh
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-l.sh
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes-systemwide-lib.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-lib.sh
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-lv-abspath.sh
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide-lv.sh
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes-systemwide.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-systemwide.sh

-- 
2.43.5


             reply	other threads:[~2026-03-04  8:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  8:01 Alan Maguire [this message]
2026-03-04  8:01 ` [PATCH v5 1/9] dt_lex: support '/' in probe descriptors Alan Maguire
2026-03-04  8:01 ` [PATCH v5 2/9] stapsdt provider: support systemwide probing Alan Maguire
2026-03-04  8:01 ` [PATCH v5 3/9] test: add systemwide stapsdt note test Alan Maguire
2026-03-04  8:01 ` [PATCH v5 4/9] test: add systemwide stapsdt note test using absolute path Alan Maguire
2026-03-04  8:01 ` [PATCH v5 5/9] test: add systemwide stapsdt note test for library Alan Maguire
2026-03-04  8:01 ` [PATCH v5 6/9] stapsdt: add test for listing systemwide probes in object Alan Maguire
2026-03-04  8:01 ` [PATCH v5 7/9] stapsdt: add test for listing systemwide probes in absolute path object Alan Maguire
2026-03-04  8:01 ` [PATCH v5 8/9] stapsdt: add systemwide test for is-enabled probes Alan Maguire
2026-03-04  8:01 ` [PATCH v5 9/9] documentation: update stapsdt docs to describe wildcard support Alan Maguire
2026-03-04  8:25 ` [PATCH v5 0/9] stapsdt provider: simple system-wide probing Alan Maguire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260304080125.649031-1-alan.maguire@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox