All of lore.kernel.org
 help / color / mirror / Atom feed
* [oracle/dtrace] 2a10b8: libdtrace: resolve BTF type tags when importing BT...
@ 2026-08-28 19:51 Kris Van Hees
  0 siblings, 0 replies; only message in thread
From: Kris Van Hees @ 2026-08-28 19:51 UTC (permalink / raw)
  To: dtrace

  Branch: refs/heads/dev-queue
  Home:   https://github.com/oracle/dtrace
  Commit: 2a10b8325f5d0c088ed895855fcef54148d0fe38
      https://github.com/oracle/dtrace/commit/2a10b8325f5d0c088ed895855fcef54148d0fe38
  Author: Jacob Carlborg <doob@me.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M libdtrace/dt_btf.c

  Log Message:
  -----------
  libdtrace: resolve BTF type tags when importing BTF into CTF

Without this fix, running any DTrace commands results in:

```
dtrace: invalid probe specifier ::::
"/usr/lib64/dtrace/6.12.0/procfs.d", line 131: operator -> cannot be
applied to pointer to type "void"; must be applied to a struct or
union pointer
```

The issue occurs on kernels which have BTF with type tags. The fix is
to treat `BTF_KIND_TYPE_TAG` as a transparent modifier, resolving
straight to `type->type`.

Signed-off-by: Jacob Carlborg <doob@me.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


  Commit: a4130f975ba04156acbf94a41e7891665191011e
      https://github.com/oracle/dtrace/commit/a4130f975ba04156acbf94a41e7891665191011e
  Author: Jacob Carlborg <doob@me.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M libdtrace/io.d.in

  Log Message:
  -----------
  libdtrace: derive io provider dev_name from the device model

Without this fix, running any DTrace commands, like `dtrace -l`,
results in:

```
dtrace: invalid probe specifier :::: "/usr/lib64/dtrace/6.12.0/io.d",
line 134: failed to resolve vmlinux`major_names: Unknown symbol name
```

The issue is that on newer kernels the `major_names` symbols is not
available in `kallsyms` anymore. For example, running `grep -w
major_names /proc/kallsyms` on a newer kernel shows no results.
Running the same command on an older kernel gives the following
result:

```
$ grep -w major_names /proc/kallsyms
0000000000000000 b major_names
```

The fix is to stop depending on the `major_names` symbol and instead
derive `dev_name` from the device model (the driver name), mirroring
the `struct buffer_head` translator.

Signed-off-by: Jacob Carlborg <doob@me.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


  Commit: 4c4f4eec9b3a0e5147a3beab07556870e1036714
      https://github.com/oracle/dtrace/commit/4c4f4eec9b3a0e5147a3beab07556870e1036714
  Author: Kris Van Hees <kris.van.hees@oracle.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c

  Log Message:
  -----------
  libdtrace: determine (and store) non-initial PID namespace dev/ino

If dtrace is executing in a non-initial PID namespace, record the dev/ino
pair to identify it.  This can be used when performing pid/tgid lookups.

Suggested-by: Jacob Carlborg <doob@me.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


  Commit: 3ccaaa2b58ddc9c278e1e7869cc4b9f0b511410b
      https://github.com/oracle/dtrace/commit/3ccaaa2b58ddc9c278e1e7869cc4b9f0b511410b
  Author: Kris Van Hees <kris.van.hees@oracle.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_cg.h

  Log Message:
  -----------
  cg: provide function to retrieve pid and tgid in a PID ns agnostic way

The dt_cg_ns_pid_tgid() function automatically selects the correct BPF
helper to get the proper pid and tgid values relative to the current
PID namespace, and stores them in %r0 using the standard BPF convention:
(tgid << 32) | pid

Suggested-by: Jacob Carlborg <doob@me.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


  Commit: 9361e7f00bb6f2a253800379c519ce16f5545eb4
      https://github.com/oracle/dtrace/commit/9361e7f00bb6f2a253800379c519ce16f5545eb4
  Author: Jacob Carlborg <doob@me.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M libdtrace/dt_prov_dtrace.c

  Log Message:
  -----------
  libdtrace: match BEGIN/END PID in the tracer's own PID namespace

Without this fix, running any probe hangs with no output,
like `dtrace -n 'BEGIN { trace("hi"); exit(0); }'`.

The issues is that the `BEGIN/END` probes are implemented as uprobes
on DTrace's own `BEGIN_probe()/END_probe()` functions in `dt_work.c`.
`bpf_get_current_pid_tgid()` reports the TGID in the initial PID
namespace, which does not match `getpid()` when DTrace runs inside a
PID namespace. Using the `--pid=host` flag when running OrbStack does
not help, because it shares the daemon's namespace, not the kernel
init namespace. OrbStack's own supervisor runs in a nested PID
namespace. On bare metal `--pid=host` does reach the init namespaces
and the bug wouldn't appear.

This fix is when DTrace is in a non-initial PID namespace and the
kernel is at least 5.7, use `bpf_get_ns_current_pid_tgid` instead of
`bpf_get_current_pid_tgid`. `bpf_get_ns_current_pid_tgid` is
namespace aware.

Signed-off-by: Jacob Carlborg <doob@me.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


  Commit: 1f5618797948616c6f45a9c003b5d70d702d1c73
      https://github.com/oracle/dtrace/commit/1f5618797948616c6f45a9c003b5d70d702d1c73
  Author: Kris Van Hees <kris.van.hees@oracle.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    A test/unittest/pidns/common.bash
    A test/unittest/pidns/test.x
    A test/unittest/pidns/tst.begin.sh
    A test/unittest/pidns/tst.concurrent.sh
    A test/unittest/pidns/tst.disasm-helper.sh
    A test/unittest/pidns/tst.end.sh
    A test/unittest/pidns/tst.io-dev-name.sh
    A test/unittest/pidns/tst.io-dev-name.x
    A test/unittest/pidns/tst.proc-create.sh

  Log Message:
  -----------
  test: add PID namespace support tests

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


  Commit: 5a8f9f419d9e8cb89bc778b0ef68e4f5f8e54f4c
      https://github.com/oracle/dtrace/commit/5a8f9f419d9e8cb89bc778b0ef68e4f5f8e54f4c
  Author: Kris Van Hees <kris.van.hees@oracle.com>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M bpf/Build
    A bpf/bvar_ns.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_state.h
    A test/unittest/pidns/tst.builtinvar-tid-pid.sh

  Log Message:
  -----------
  bpf: make the PID ns dev/ino pair available to runtime BPF code

BPF code in generated probe programs needs to retrieve PID and TGID
values in a PID ns aware manner if drace is running in a non-initial
PID namespace.

Provide support for PID ns aware pid and tid built-in variable.

Suggested-by: Jacob Carlborg <doob@me.com>
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>


Compare: https://github.com/oracle/dtrace/compare/61fea621160e...5a8f9f419d9e

To unsubscribe from these emails, change your notification settings at https://github.com/oracle/dtrace/settings/notifications

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-28 19:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 19:51 [oracle/dtrace] 2a10b8: libdtrace: resolve BTF type tags when importing BT Kris Van Hees

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.