Skip to content

Commit 39c13c2

Browse files
shba24davem330
authored andcommitted
arm: eBPF JIT compiler
The JIT compiler emits ARM 32 bit instructions. Currently, It supports eBPF only. Classic BPF is supported because of the conversion by BPF core. This patch is essentially changing the current implementation of JIT compiler of Berkeley Packet Filter from classic to internal with almost all instructions from eBPF ISA supported except the following BPF_ALU64 | BPF_DIV | BPF_K BPF_ALU64 | BPF_DIV | BPF_X BPF_ALU64 | BPF_MOD | BPF_K BPF_ALU64 | BPF_MOD | BPF_X BPF_STX | BPF_XADD | BPF_W BPF_STX | BPF_XADD | BPF_DW Implementation is using scratch space to emulate 64 bit eBPF ISA on 32 bit ARM because of deficiency of general purpose registers on ARM. Currently, only LITTLE ENDIAN machines are supported in this eBPF JIT Compiler. Tested on ARMv7 with QEMU by me (Shubham Bansal). Testing results on ARMv7: 1) test_bpf: Summary: 341 PASSED, 0 FAILED, [312/333 JIT'ed] 2) test_tag: OK (40945 tests) 3) test_progs: Summary: 30 PASSED, 0 FAILED 4) test_lpm: OK 5) test_lru_map: OK Above tests are all done with following flags enabled discreatly. 1) bpf_jit_enable=1 a) CONFIG_FRAME_POINTER enabled b) CONFIG_FRAME_POINTER disabled 2) bpf_jit_enable=1 and bpf_jit_harden=2 a) CONFIG_FRAME_POINTER enabled b) CONFIG_FRAME_POINTER disabled See Documentation/networking/filter.txt for more information. Signed-off-by: Shubham Bansal <illusionist.neo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e2a7c34 commit 39c13c2

File tree

3 files changed

+1747
-811
lines changed

3 files changed

+1747
-811
lines changed

arch/arm/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ config ARM
5050
select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
5151
select HAVE_ARCH_TRACEHOOK
5252
select HAVE_ARM_SMCCC if CPU_V7
53-
select HAVE_CBPF_JIT
53+
select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
5454
select HAVE_CC_STACKPROTECTOR
5555
select HAVE_CONTEXT_TRACKING
5656
select HAVE_C_RECORDMCOUNT

0 commit comments

Comments
 (0)