Re: [PATCH bpf-next 1/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc64 JIT
Nicholas Dudar <[email protected]> Fri, 17 Jul 2026 16:58:27 -0400
| Newsgroups | org.kernel.vger.linux-parisc,org.kernel.vger.bpf,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAJZwKkjUR3FLKwY-WBSwFgK_nLrV20nGGtHZOt3Jf6SXpgyurg@mail.gmail.com> |
On Fri, Jul 17, 2026 at 19:16 UTC, [email protected] wrote: > [High] The patch implements BPF_SDIV and BPF_SMOD for the 64-bit > PA-RISC JIT but omits the 32-bit JIT, causing signed divisions to be > silently miscompiled as unsigned. This is a 2-patch series, and patch 2/2 ("bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc32 JIT") is the one that modifies bpf_jit_comp32.c. It threads is_signed = (insn->off == 1) through emit_alu_r32()/emit_alu_r64() and uses the $$divI/$$remI signed millicode (ALU32) and the hppa_sdiv64()/hppa_sdiv64_rem() helpers (ALU64) on the signed path instead of $$divU/$$remU/hppa_div64(). Patch 1/2 adds those shared helpers in bpf_jit_core.c, which is why it does not touch bpf_jit_comp32.c. With both patches applied the parisc32 JIT returns the signed result the verifier and interpreter compute; the ALU32/ALU64 SDIV/SMOD test_bpf cases pass. Nicholas