Skip to content
  • Shubham Bansal's avatar
    arm: eBPF JIT compiler · 39c13c20
    Shubham Bansal authored
    
    
    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: default avatarShubham Bansal <illusionist.neo@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    39c13c20