mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc JITs
@ 2026-07-17 19:05 Nicholas Dudar
  2026-07-17 19:05 ` [PATCH bpf-next 1/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc64 JIT Nicholas Dudar
  2026-07-17 19:05 ` [PATCH bpf-next 2/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc32 JIT Nicholas Dudar
  0 siblings, 2 replies; 6+ messages in thread
From: Nicholas Dudar @ 2026-07-17 19:05 UTC (permalink / raw)
  To: ast, daniel, andrii, eddyz87, memxor, deller, James.Bottomley
  Cc: bpf, linux-parisc, linux-kernel, visitorckw

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-17 22:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-17 19:05 [PATCH bpf-next 0/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc JITs Nicholas Dudar
2026-07-17 19:05 ` [PATCH bpf-next 1/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc64 JIT Nicholas Dudar
2026-07-17 19:52   ` bot+bpf-ci
2026-07-17 20:58     ` Nicholas Dudar
2026-07-17 22:27     ` Nicholas Dudar
2026-07-17 19:05 ` [PATCH bpf-next 2/2] bpf, parisc: Add support for BPF_SDIV and BPF_SMOD in the parisc32 JIT Nicholas Dudar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox