public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: dtrace-devel@oss.oracle.com, dtrace@lists.linux.dev
Subject: [PATCH v2] dtprobed: use /proc/$pid/map_files, not the filename of the mapping
Date: Tue, 20 Jan 2026 16:20:09 +0000	[thread overview]
Message-ID: <20260120162051.183028-1-nick.alcock@oracle.com> (raw)
In-Reply-To: <20251202230453.124306-1-nick.alcock@oracle.com>

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@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
-- 
2.52.0.285.g44a719c714.dirty


  parent reply	other threads:[~2026-01-20 16:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 23:04 [PATCH] dtprobed: use /proc/$pid/map_files, not the filename of the mapping Nick Alcock
2025-12-04  6:18 ` Eugene Loh
2026-01-20 16:19   ` Nick Alcock
2026-01-20 16:20 ` Nick Alcock [this message]
2026-01-20 19:24   ` [DTrace-devel] [PATCH v2] " Eugene Loh
2026-02-12 18:13     ` Eugene Loh
2026-02-12 18:18       ` Nick Alcock
2026-02-12 18:28         ` Kris Van Hees
2026-02-12 18:37           ` Kris Van Hees
2026-02-12 18:43             ` Kris Van Hees
2026-02-12 18:49               ` Eugene Loh
2026-02-12 18:51                 ` Kris Van Hees
2026-02-12 18:56                   ` Nick Alcock

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=20260120162051.183028-1-nick.alcock@oracle.com \
    --to=nick.alcock@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