[DTrace-devel] [PATCH] Use DT_TRAMP_SP_SLOT() for BPF stack scratch space in trampoline
eugene.loh at oracle.com
eugene.loh at oracle.com
Fri Feb 21 20:09:24 UTC 2025
From: Eugene Loh <eugene.loh at oracle.com>
We might as well get this code right, even if this "fix" is
arguably irrelevant for two reasons:
*) The offset just so happens to be -96 before and after the
change anyhow, just by coincidence.
*) The fix is on a code path that is not currently in use.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
libdtrace/dt_cg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index 846f0fe2e..cc64a3a13 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -594,11 +594,11 @@ dt_cg_tramp_copy_pc_from_regs(dt_pcb_t *pcb)
/* test just a single byte */
emit(dlp, BPF_MOV_IMM(BPF_REG_2, 1));
- /* safe to write to FP+DT_STK_SP_BASE, which becomes the clause stack */
+ /* write to scratch space */
emit(dlp, BPF_MOV_REG(BPF_REG_1, BPF_REG_FP));
- emit(dlp, BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, DT_STK_SP_BASE));
+ emit(dlp, BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, DT_TRAMP_SP_SLOT(0)));
- /* bpf_probe_read_kernel(%fp + DT_STK_SP, 1, PC) */
+ /* bpf_probe_read_kernel(%fp + DT_TRAMP_SP_SLOT(0), 1, PC) */
dt_regset_xalloc(drp, BPF_REG_0);
emit(dlp, BPF_CALL_HELPER(BPF_FUNC_probe_read_kernel));
--
2.43.5
More information about the DTrace-devel
mailing list