Re: [DTrace-devel] [PATCH v2] dtprobed: use /proc/$pid/map_files, not the filename of the mapping
Eugene Loh <[email protected]> Tue, 20 Jan 2026 14:24:42 -0500
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
Reviewed-by: Eugene Loh <[email protected]> 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 <[email protected]> > --- > 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