From: Lukas Stockner <lukas@lukasstockner.de>
To: Hari Bathini <hbathini@linux.ibm.com>,
Christophe Leroy <chleroy@kernel.org>,
bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Cc: Naveen N Rao <naveen@kernel.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Lukas Stockner <lukas@lukasstockner.de>
Subject: [PATCH 0/4] powerpc32/bpf: fix BPF-to-BPF calls and instruction folding
Date: Sun, 22 Nov 2026 20:42:01 +0100 [thread overview]
Message-ID: <20261122194205.218543-1-lukas@lukasstockner.de> (raw)
This series fixes four bugs in the 32-bit PowerPC eBPF JIT.
The current function prologue/epilogue assumes the calling convention for
main programs, while generated calls follow helper calling convention.
Therefore, patch 1 makes it generate a helper-style prologue/epilogue for
subprograms instead.
Patch 2 and 3 are needed to fix the additional arguments in subprograms.
Currently, the fifth argument is not being loaded in the prologue, and
all of them may be overwritten by register reallocation logic when they're
only passed on to another call.
Patch 4 is for the 3-operand folding logic. When the second instruction
uses the same source and destination register, the current folding
doesn't work because it will end up using the previous value of
the register, even though it should have been written by the first
instruction. We encountered this for the case of verifier-inserted zero-
extension MOVs, but it also affects other ALU operations.
Testing:
We found these bugs in an eBPF-based CLAT program on various WiFi APs,
where it would trigger kernels panics on PPC32 hardware (e.g. Enterasys
WS-AP3715i with Freescale P1010 CPU).
While working on the fixes, I tested in QEMU on g3beige using small
reproducers (generated by GLM 5.3 Flash).
Afterwards, we backported this series to v6.6 and tested it on the
WS-AP3715i, and with the fixes applied the CLAT program now works fine.
A previous version of this series (before some cleanups) has also been
deployed on several APs in production without problems.
Lukas Stockner (4):
powerpc32/bpf: fix argument passing for subprograms
powerpc32/bpf: fetch fifth argument in BPF subprograms
powerpc32/bpf: mark all argument registers seen in function calls
powerpc32/bpf: don't fold MOV into instructions that use dst_reg
arch/powerpc/net/bpf_jit_comp32.c | 43 ++++++++++++++++++++++++++-----
1 file changed, 37 insertions(+), 6 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-22 22:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 19:42 Lukas Stockner [this message]
2026-11-22 19:42 ` [PATCH 1/4] powerpc32/bpf: fix argument passing for subprograms Lukas Stockner
2026-11-23 7:46 ` Christophe Leroy (CS GROUP)
2026-11-22 19:42 ` [PATCH 2/4] powerpc32/bpf: fetch fifth argument in BPF subprograms Lukas Stockner
2026-11-22 19:42 ` [PATCH 3/4] powerpc32/bpf: mark all argument registers seen in function calls Lukas Stockner
2026-11-22 19:42 ` [PATCH 4/4] powerpc32/bpf: don't fold MOV into instructions that use dst_reg Lukas Stockner
2026-11-22 20:14 ` bot+bpf-ci
2026-11-28 18:32 ` Christophe Leroy (CS GROUP)
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=20261122194205.218543-1-lukas@lukasstockner.de \
--to=lukas@lukasstockner.de \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chleroy@kernel.org \
--cc=daniel@iogearbox.net \
--cc=hbathini@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox