• Alexei Starovoitov's avatar
    selftests/bpf: add verifier tests for bpf_call · a7ff3eca
    Alexei Starovoitov authored
    Add extensive set of tests for bpf_call verification logic:
    
    calls: basic sanity
    calls: using r0 returned by callee
    calls: callee is using r1
    calls: callee using args1
    calls: callee using wrong args2
    calls: callee using two args
    calls: callee changing pkt pointers
    calls: two calls with args
    calls: two calls with bad jump
    calls: recursive call. test1
    calls: recursive call. test2
    calls: unreachable code
    calls: invalid call
    calls: jumping across function bodies. test1
    calls: jumping across function bodies. test2
    calls: call without exit
    calls: call into middle of ld_imm64
    calls: call into middle of other call
    calls: two calls with bad fallthrough
    calls: two calls with stack read
    calls: two calls with stack write
    calls: spill into caller stack frame
    calls: two calls with stack write and void return
    calls: ambiguous return value
    calls: two calls that return map_value
    calls: two calls that return map_value with bool condition
    calls: two calls that return map_value with incorrect bool check
    calls: two calls that receive map_value via arg=ptr_stack_of_caller. test1
    calls: two calls that receive map_value via arg=ptr_stack_of_caller. test2
    calls: two jumps that receive map_value via arg=ptr_stack_of_jumper. test3
    calls: two calls that receive map_value_ptr_or_null via arg. test1
    calls: two calls that receive map_value_ptr_or_null via arg. test2
    calls: pkt_ptr spill into caller stack
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    a7ff3eca
test_verifier.c 283 KB