• Stanislav Fomichev's avatar
    selftests/bpf: add sockopt test · 9ec8a4c9
    Stanislav Fomichev authored
    Add sockopt selftests:
    * require proper expected_attach_type
    * enforce context field read/write access
    * test bpf_sockopt_handled handler
    * test EPERM
    * test limiting optlen from getsockopt
    * test out-of-bounds access
    
    v9:
    * add tests for setsockopt argument mangling
    
    v7:
    * remove return 2; test retval=0 and optlen=-1
    
    v3:
    * use DW for optval{,_end} loads
    
    v2:
    * use return code 2 for kernel bypass
    
    Cc: Andrii Nakryiko <andriin@fb.com>
    Cc: Martin Lau <kafai@fb.com>
    Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    9ec8a4c9
test_sockopt.c 23.6 KB