[PATCH bpf-next 0/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc JITs
Nicholas Dudar <[email protected]> Fri, 17 Jul 2026 15:05:42 -0400
| Newsgroups | org.kernel.vger.linux-parisc,org.kernel.vger.bpf,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
The parisc BPF JITs emit unsigned divide and remainder for signed BPF_DIV and BPF_MOD (off == 1) on the 64-bit and 32-bit JITs, so neither implements signed BPF_SDIV and BPF_SMOD. Signed div/mod return an unsigned result for negative operands rather than the verifier's and the interpreter's signed result. Patch 1 adds signed support to the parisc64 JIT and the shared signed 64-bit helpers (hppa_sdiv64/hppa_sdiv64_rem) in bpf_jit_core.c. Patch 2 adds it to the parisc32 JIT, using those helpers for the 64-bit path and the $$divI/$$remI signed millicode for the 32-bit path. Both were tested with test_bpf on qemu-system-hppa; the signed div/mod cases fail before and pass after. Nicholas Dudar (2): bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc64 JIT bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc32 JIT arch/parisc/net/bpf_jit.h | 2 ++ arch/parisc/net/bpf_jit_comp32.c | 29 +++++++++++++++++--------- arch/parisc/net/bpf_jit_comp64.c | 35 ++++++++++++++++++++++++-------- arch/parisc/net/bpf_jit_core.c | 14 +++++++++++++ 4 files changed, 61 insertions(+), 19 deletions(-) base-commit: 1d91ea01185656ac3ee63c5f9f6f8bde3c746b3d -- 2.34.1