[DTrace-devel] [PATCH 4/4] Set fbt:::return arg0=-1 to indicate we do not know the real value
eugene.loh at oracle.com
eugene.loh at oracle.com
Wed May 4 05:01:44 UTC 2022
From: Eugene Loh <eugene.loh at oracle.com>
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
libdtrace/dt_prov_fbt.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/libdtrace/dt_prov_fbt.c b/libdtrace/dt_prov_fbt.c
index 88638bc6..32204201 100644
--- a/libdtrace/dt_prov_fbt.c
+++ b/libdtrace/dt_prov_fbt.c
@@ -173,6 +173,18 @@ static void trampoline(dt_pcb_t *pcb)
emit(dlp, BPF_LOAD(BPF_DW, BPF_REG_0, BPF_REG_8, PT_REGS_RET));
emit(dlp, BPF_STORE(BPF_DW, BPF_REG_7, DMST_ARG(1), BPF_REG_0));
+
+ /*
+ * fbt:::return arg0 should be the function offset for
+ * return instruction. Since we use kretprobes, however,
+ * which do not fire until the function has returned to
+ * its caller, information about the returning instruction
+ * in the callee has been lost.
+ *
+ * Set arg0=-1 to indicate that we do not know the value.
+ */
+ dt_cg_xsetx(dlp, NULL, DT_LBL_NONE, BPF_REG_0, -1);
+ emit(dlp, BPF_STORE(BPF_DW, BPF_REG_7, DMST_ARG(0), BPF_REG_0));
} else
dt_cg_tramp_copy_entry_args(pcb, BPF_REG_8);
dt_cg_tramp_epilogue(pcb);
--
2.18.4
More information about the DTrace-devel
mailing list