From: Jacob Carlborg <doob@me.com>
To: dtrace@lists.linux.dev
Cc: Jacob Carlborg <doob@me.com>
Subject: [PATCH 2/3] libdtrace: derive io provider dev_name from the device model
Date: Mon, 20 Jul 2026 15:30:59 +0200 [thread overview]
Message-ID: <20260720133100.77573-3-doob@me.com> (raw)
In-Reply-To: <20260720133100.77573-1-doob@me.com>
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>
---
libdtrace/io.d.in | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/libdtrace/io.d.in b/libdtrace/io.d.in
index 5ea356ee..e96a5b23 100644
--- a/libdtrace/io.d.in
+++ b/libdtrace/io.d.in
@@ -124,16 +124,27 @@ translator devinfo_t < struct buffer_head *B > {
);
};
+define_for_kernel([[__part0_dev]], [[(m4_kver(5,11,0), [[part0->bd_device]])]], [[part0.__dev]])
#pragma D binding "1.6.3" translator
translator devinfo_t < struct bio *B > {
dev_major = B->__disk_chk == NULL ? 0 : getmajor(B->__bio_part_dev);
dev_minor = B->__disk_chk == NULL ? 0 : getminor(B->__bio_part_dev);
dev_instance = 0;
+ /*
+ * Derive the driver name from the device model rather than the kernel's
+ * `major_names` array: that symbol became static and is no longer
+ * resolvable via kallsyms on newer kernels. This mirrors how the
+ * struct buffer_head devinfo translator above obtains dev_name.
+ */
dev_name = B->__disk_chk == NULL
? "nfs"
- : stringof(((struct blk_major_name **)vmlinux`major_names)[
- getmajor(B->__bio_part_dev) % 255
- ]->name);
+ : B->__disk->__part0_dev.parent
+ ? B->__disk->__part0_dev.parent->driver->name
+ ? stringof(B->__disk->__part0_dev.parent->driver->name)
+ : "<none>"
+ : B->__disk->__part0_dev.driver->name
+ ? stringof(B->__disk->__part0_dev.driver->name)
+ : "<none>";
dev_statname = B->__disk_chk == NULL ? "nfs" :
(B->__bio_partno) == 0 ? stringof(B->__disk->disk_name) :
strjoin(stringof(B->__disk->disk_name), lltostr(B->__bio_partno));
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-07-20 13:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 13:30 [PATCH 0/3] Fix DTrace on modern kernels and in containers Jacob Carlborg
2026-07-20 13:30 ` [PATCH 1/3] libdtrace: resolve BTF type tags when importing BTF into CTF Jacob Carlborg
2026-07-20 13:30 ` Jacob Carlborg [this message]
2026-07-20 13:31 ` [PATCH 3/3] libdtrace: match BEGIN/END PID in the tracer's own PID namespace Jacob Carlborg
2026-07-20 16:33 ` [PATCH 0/3] Fix DTrace on modern kernels and in containers Kris Van Hees
2026-07-21 6:27 ` Jacob Carlborg
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=20260720133100.77573-3-doob@me.com \
--to=doob@me.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 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.