[DTrace-devel] [PATCH v2] dtprobed: use /proc/$pid/map_files, not the filename of the mapping

Eugene Loh eugene.loh at oracle.com
Thu Feb 12 18:13:42 UTC 2026


I do not know what went wrong here.  I would have bet big money that I 
tested this, but here is what I find now with this patch:

test/unittest/usdt/tst.enabled.sh: Running timeout --signal=TERM 41 
test/unittest/usdt/tst.enabled.sh /home/.../build/dtrace
FAIL: expected results differ.
400000-401000:main:go

Diff against expected:
--- test/unittest/usdt/tst.enabled.r    2026-02-12 05:31:24.000000000 +0000
+++ /tmp/runtest.6196/test.out  2026-02-12 18:09:58.980466976 +0000
@@ -1,2 +1,2 @@
-test:main:go
+400000-401000:main:go

That is, on several systems I'm getting widespread failure on USDT tests.

On 1/20/26 14:24, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
>
> On 1/20/26 11:20, Nick Alcock via DTrace-devel wrote:
>> Instead of using prf->prf_mapname (which resolves to the mapped file's
>> target), use Pmap_mapfile_name() to get the actual
>> /proc/$pid/map_files/* path.  These magic symlinks can be opened even
>> when their corresponding files are deleted or in an inaccessible
>> filesystem namespace, ensuring we can read the mapping contents
>> reliably.  DTrace already does this to read mappings during USDT probe
>> lookup.
>>
>> Fixes issues with probes in paths like /home when dtprobed
>> is sandboxed by systemd.
>>
>> Tested on both systemd and non-systemd (non-jailed) systems, with USDT
>> programs running out of /tmp, /usr/local and /home.
>>
>> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
>> ---
>>   dtprobed/dtprobed.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/dtprobed/dtprobed.c b/dtprobed/dtprobed.c
>> index a808586559d96..9a6928055cd13 100644
>> --- a/dtprobed/dtprobed.c
>> +++ b/dtprobed/dtprobed.c
>> @@ -487,7 +487,7 @@ handle_usdt_notes(pid_t pid, uintptr_t addr)
>>           fuse_log(FUSE_LOG_ERR, "%i: dtprobed: cannot look up 
>> mapping (process dead?)\n",
>>                pid);
>>           goto out;
>> -    } else if ((fn = prf->prf_mapname) == NULL) {
>> +    } else if ((fn = Pmap_mapfile_name(P, mapp)) == NULL) {
>>           fuse_log(FUSE_LOG_ERR, "%i: dtprobed: cannot look up 
>> mapname (process dead?)\n",
>>                pid);
>>           goto out;
>>
>> base-commit: 6e94c7d0a253806f85c39ff5f4e32a800d4cb6b6



More information about the DTrace-devel mailing list