bpf, x86: Add support for signed arena loads
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 23 Sep 2025 11:01:49 +0000 (11:01 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 23 Sep 2025 19:00:22 +0000 (12:00 -0700)
commita91ae3c89311648cbaa9b46b860e4f76004a24b8
treeeb70a89b901b3de88d52d81bc9536db2a337c5fc
parent348f6117c16ae89a06f53ec6dc893bd7b7a724b4
bpf, x86: Add support for signed arena loads

Currently, signed load instructions into arena memory are unsupported.
The compiler is free to generate these, and on GCC-14 we see a
corresponding error when it happens. The hurdle in supporting them is
deciding which unused opcode to use to mark them for the JIT's own
consumption. After much thinking, it appears 0xc0 / BPF_NOSPEC can be
combined with load instructions to identify signed arena loads. Use
this to recognize and JIT them appropriately, and remove the verifier
side limitation on the program if the JIT supports them.

Co-developed-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Link: https://lore.kernel.org/r/20250923110157.18326-2-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/arm64/net/bpf_jit_comp.c
arch/riscv/net/bpf_jit_comp64.c
arch/s390/net/bpf_jit_comp.c
arch/x86/net/bpf_jit_comp.c
include/linux/filter.h
kernel/bpf/verifier.c