All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lukas Stockner" <lukas@lukasstockner.de>, bpf@vger.kernel.org
Subject: Re: [PATCH v2 6/7] powerpc32/bpf: use src2_reg for all ALU operations
Date: Tue, 01 Dec 2026 17:13:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-243799@kernel.org> (raw)
In-Reply-To: <20261201165313.413960-7-lukas@lukasstockner.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] powerpc32/bpf: missing high-word move for be64 in
  bpf_jit_build_body()
--

commit 01965c5e00d0935c024d80bbbd1744d93c885dbb
Author: Lukas Stockner <lukas@lukasstockner.de>

powerpc32/bpf: use src2_reg for all ALU operations

This commit updates ALU operations in the PPC32 eBPF JIT to use src2_reg
and src2_reg_h instead of dst_reg and dst_reg_h so that folded MOV
instructions work properly.

> diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
> index 2c3d94c94ed78..83457b21d0a8b 100644
> --- a/arch/powerpc/net/bpf_jit_comp32.c
> +++ b/arch/powerpc/net/bpf_jit_comp32.c

[ ... ]

> @@ -901,7 +921,9 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
>  				break;
>  			case 32:
>  			case 64:
> -				/* nop */
> +				/* nop, just move if needed */
> +				if (dst_reg != src2_reg)
> +					EMIT(PPC_RAW_MR(dst_reg, src2_reg));
>  				break;
>  			}
>  			break;

[Severity: High]
Does case 64 of BPF_ALU | BPF_END | BPF_FROM_BE also need to copy
src2_reg_h into dst_reg_h when dst_reg_h != src2_reg_h?

BPF_END | BPF_FROM_BE uses class BPF_ALU even for 64-bit operands
(imm == 64), and the 32-bit zero-extension at the end of
bpf_jit_build_body() explicitly skips (BPF_OP(code) == BPF_END && imm == 64).
When a preceding 64-bit MOV is folded into a be64 instruction, rewinding
ctx->idx discards both the low-word and high-word register moves from the
MOV, leaving dst_reg_h with its previous stale value.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201165313.413960-1-lukas@lukasstockner.de?part=6

  reply	other threads:[~2026-12-01 17:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 16:53 [PATCH v2 0/7] powerpc32/bpf: fix BPF-to-BPF calls and instruction folding Lukas Stockner
2026-12-01 16:53 ` [PATCH v2 1/7] powerpc32/bpf: fix argument passing for subprograms Lukas Stockner
2026-12-01 16:53 ` [PATCH v2 2/7] powerpc32/bpf: fetch fifth argument in BPF subprograms Lukas Stockner
2026-12-01 16:53 ` [PATCH v2 3/7] powerpc32/bpf: mark all argument registers seen in function calls Lukas Stockner
2026-12-01 17:46   ` bot+bpf-ci
2026-12-01 16:53 ` [PATCH v2 4/7] powerpc32/bpf: don't fold MOVSX into following instruction Lukas Stockner
2026-12-01 16:53 ` [PATCH v2 5/7] powerpc32/bpf: fix MOV folding with in-place operations Lukas Stockner
2026-12-01 17:18   ` sashiko-bot
2026-12-01 16:53 ` [PATCH v2 6/7] powerpc32/bpf: use src2_reg for all ALU operations Lukas Stockner
2026-12-01 17:13   ` sashiko-bot [this message]
2026-12-01 16:53 ` [PATCH v2 7/7] powerpc32/bpf: don't fold MOV into jump targets Lukas Stockner
2026-12-01 17:24   ` sashiko-bot
2026-12-01 17:46   ` bot+bpf-ci

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=sashiko-outbox-243799@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=lukas@lukasstockner.de \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.