All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: eugene.loh@oracle.com
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [DTrace-devel] [PATCH] Use DT_TRAMP_SP_SLOT() for BPF stack scratch space in trampoline
Date: Fri, 21 Feb 2025 15:20:27 -0500	[thread overview]
Message-ID: <Z7jgC2xdXjT3L8Y3@oracle.com> (raw)
In-Reply-To: <20250221200924.4445-1-eugene.loh@oracle.com>

On Fri, Feb 21, 2025 at 03:09:24PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh@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@oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees@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
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel

      reply	other threads:[~2025-02-21 20:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 20:09 [PATCH] Use DT_TRAMP_SP_SLOT() for BPF stack scratch space in trampoline eugene.loh
2025-02-21 20:20 ` Kris Van Hees [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7jgC2xdXjT3L8Y3@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=eugene.loh@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.