Use DT_TRAMP_SP_SLOT() for BPF stack scratch space in trampoline
PATCH 1/1 Use DT_TRAMP_SP_SLOT() for BPF stack scratch space in trampoline
From: Eugene Loh <[email protected]>
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 <[email protected]>
--- libdtrace/dt_cg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
libdtrace/dt_cg.c +3 -3
@@ -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));
Signature · 1 line
2.43.5
Quoted 11 lines · eugene.loh--- via DTrace-devel
From: Eugene Loh <[email protected]>
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 <[email protected]>
Reviewed-by Kris Van Hees <[email protected]>
Quoted 31 lines
--- libdtrace/dt_cg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)libdtrace/dt_cg.c +3
-3@@ -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));Signature · 7 lines
2.43.5 _______________________________________________ DTrace-devel mailing list [email protected] https://oss.oracle.com/mailman/listinfo/dtrace-devel