Skip to content

Commit a818f96

Browse files
kkdwvdKernel Patches Daemon
authored andcommitted
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 <[email protected]> Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]> Signed-off-by: Puranjay Mohan <[email protected]>
1 parent 0af025f commit a818f96

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,6 +3073,11 @@ bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena)
30733073
if (!bpf_atomic_is_load_store(insn) &&
30743074
!cpus_have_cap(ARM64_HAS_LSE_ATOMICS))
30753075
return false;
3076+
break;
3077+
case BPF_LDX | BPF_MEMSX | BPF_B:
3078+
case BPF_LDX | BPF_MEMSX | BPF_H:
3079+
case BPF_LDX | BPF_MEMSX | BPF_W:
3080+
return false;
30763081
}
30773082
return true;
30783083
}

0 commit comments

Comments
 (0)