[SRU][J:linux][PATCH v2 0/4] Fix BPF JIT atomic operations on ARM64 and PPC64
Andrei Gherzan
andrei.gherzan at canonical.com
Tue Jun 30 17:52:49 UTC 2026
BugLink: https://bugs.launchpad.net/bugs/1955011
SRU Justification:
[ Impact ]
The test_bpf kernel module selftest fails on ARM64 and PPC64 architectures.
74 out of 577 BPF tests fail with "FAIL to select_runtime err=-524" because
the BPF JIT compilers are missing support for extended atomic operations.
On ARM64, tests fail with:
bpf_jit: unknown atomic op code 01
On PPC64, tests fail with:
eBPF filter atomic op code XX (@YY) unsupported
The missing JIT support covers:
- BPF_ADD | BPF_FETCH (atomic fetch-add)
- BPF_AND | BPF_FETCH (atomic fetch-and)
- BPF_OR | BPF_FETCH (atomic fetch-or)
- BPF_XOR | BPF_FETCH (atomic fetch-xor)
- BPF_XCHG (atomic exchange)
- BPF_CMPXCHG (atomic compare-exchange)
[ Test Plan ]
1. Boot a Jammy ARM64 or PPC64 instance with the patched kernel
2. Run the test_bpf module test:
$ sudo modprobe test_bpf
$ sudo dmesg | grep "test_bpf: Summary"
$ sudo modprobe -r test_bpf
Before fix:
test_bpf: Summary: 503 PASSED, 74 FAILED, [491/491 JIT'ed]
After fix:
test_bpf: Summary: 577 PASSED, 0 FAILED, [565/565 JIT'ed]
Verified on:
- Jammy ARM64 (aarch64): 577 PASSED, 0 FAILED
- Jammy PPC64 (ppc64le): 577 PASSED, 0 FAILED
[ Where problems could occur ]
The changes add new JIT code generation paths for atomic operations in
arch/arm64/net/bpf_jit_comp.c and arch/powerpc/net/bpf_jit_comp64.c.
Incorrect implementations could cause wrong results in BPF programs using
these atomics. However, the code closely follows upstream (in mainline
since v5.18/v6.0) and architecture-specific atomic primitives, with only
minor context adjustments for Ubuntu Jammy.
Andrei Gherzan (4):
bpf, arm64: Support more atomic operations
powerpc/bpf/64: add support for BPF_ATOMIC bitwise operations
powerpc/bpf/64: add support for atomic fetch operations
powerpc/bpf/64: Add instructions for atomic_[cmp]xchg
arch/arm64/net/bpf_jit.h | 39 +++++-
arch/arm64/net/bpf_jit_comp.c | 223 ++++++++++++++++++++++++------
arch/powerpc/net/bpf_jit_comp64.c | 97 +++++++++----
3 files changed, 287 insertions(+), 72 deletions(-)
--
2.43.0
More information about the kernel-team
mailing list