[DTrace-devel] [External] : [PATCH 6/7] dtrace provider: place uprobes by file offset
Eslam Almorshdy via B4 Relay
devnull+ealmorshdy.d-matrix.ai at kernel.org
Thu Oct 15 03:53:46 UTC 2026
From: Eslam Almorshdy <ealmorshdy at d-matrix.ai>
uprobe_spec() places the dtrace provider's BEGIN, END and ERROR uprobes
on the *_probe() functions in libdtrace.so at the symbol's distance from
the object's first segment, not at its file offset: the same mistake as
in the pid and USDT providers. With a libdtrace linked by lld,
dtrace:::BEGIN is placed 0x1000 bytes past BEGIN_probe(), never fires,
and every session hangs.
Convert through the mapping that contains the symbol instead.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Eslam Almorshdy <ealmorshdy at d-matrix.ai>
---
libdtrace/dt_prov_dtrace.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libdtrace/dt_prov_dtrace.c b/libdtrace/dt_prov_dtrace.c
index 4b788507..b8437c17 100644
--- a/libdtrace/dt_prov_dtrace.c
+++ b/libdtrace/dt_prov_dtrace.c
@@ -207,11 +207,13 @@ static char *uprobe_spec(pid_t pid, const char *prb)
if (mapp == NULL)
goto out;
- if (mapp->pr_file->first_segment != mapp)
- mapp = mapp->pr_file->first_segment;
-
+ /*
+ * The uprobe spec takes a file offset: convert through the
+ * mapping that contains the symbol, not the first segment
+ * (their p_vaddr - p_offset differ, e.g. with LLVM lld).
+ */
asprintf(&spec, "%s:0x%lx", mapp->pr_file->prf_mapname,
- sym.st_value - mapp->pr_vaddr);
+ sym.st_value - mapp->pr_vaddr + mapp->pr_offset);
}
out:
--
2.55.0
More information about the DTrace-devel
mailing list