[DTrace-devel] [PATCH] Fix dt_bvar_probedesc() for late USDT processes
eugene.loh at oracle.com
eugene.loh at oracle.com
Wed Mar 19 06:32:27 UTC 2025
From: Eugene Loh <eugene.loh at oracle.com>
With commit 8bd26415b
("bpf: separate bvar implementation into separate functions"),
test/unittest/usdt/tst.nusdtprobes.sh started failing reproducibly
on all platforms.
In that patch, the get_bvar() function is factored into separate
functions. It includes a change that looks basically like this:
uint32_t key = mst->prid;
if (key < ((uint64_t)&NPROBES)) {
[...]
} else {
char *s = bpf_map_lookup_elem(&usdt_names, &key);
switch (idx) {
- case DIF_VAR_PROBENAME: s += DTRACE_FUNCNAMELEN;
+ case DIF_VAR_PROBEPROV: s += DTRACE_FUNCNAMELEN;
- case DIF_VAR_PROBEFUNC: s += DTRACE_MODNAMELEN;
+ case DIF_VAR_PROBEMOD : s += DTRACE_MODNAMELEN;
- case DIF_VAR_PROBEMOD : s += DTRACE_PROVNAMELEN;
+ case DIF_VAR_PROBEFUNC: s += DTRACE_PROVNAMELEN;
- case DIF_VAR_PROBEPROV:
+ case DIF_VAR_PROBENAME:
}
return (uint64_t)s;
}
That is, for the case of key>=NPROBES (that is, for USDT probes that
were added after the dtrace session was started), the meanings of
prov, mod, func, and name were exchanged.
Restore the correct meanings.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
bpf/get_bvar.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/bpf/get_bvar.c b/bpf/get_bvar.c
index c760126da..fadb06c00 100644
--- a/bpf/get_bvar.c
+++ b/bpf/get_bvar.c
@@ -185,13 +185,13 @@ noinline uint64_t dt_bvar_probedesc(const dt_dctx_t *dctx, uint32_t idx)
return (uint64_t)dctx->strtab;
switch (idx) {
- case DIF_VAR_PROBEPROV:
+ case DIF_VAR_PROBENAME:
s += DTRACE_FUNCNAMELEN;
- case DIF_VAR_PROBEMOD:
- s += DTRACE_MODNAMELEN;
case DIF_VAR_PROBEFUNC:
+ s += DTRACE_MODNAMELEN;
+ case DIF_VAR_PROBEMOD:
s += DTRACE_PROVNAMELEN;
- case DIF_VAR_PROBENAME:
+ case DIF_VAR_PROBEPROV:
}
return (uint64_t)s;
--
2.43.5
More information about the DTrace-devel
mailing list