• Kees Cook's avatar
    selftests/seccomp: Make kcmp() less required · cf8918db
    Kees Cook authored
    The seccomp tests are a bit noisy without CONFIG_CHECKPOINT_RESTORE (due
    to missing the kcmp() syscall). The seccomp tests are more accurate with
    kcmp(), but it's not strictly required. Refactor the tests to use
    alternatives (comparing fd numbers), and provide a central test for
    kcmp() so there is a single SKIP instead of many. Continue to produce
    warnings for the other tests, though.
    
    Additionally adds some more bad flag EINVAL tests to the addfd selftest.
    
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Will Drewry <wad@chromium.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Martin KaFai Lau <kafai@fb.com>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: Yonghong Song <yhs@fb.com>
    Cc: Andrii Nakryiko <andriin@fb.com>
    Cc: John Fastabend <john.fastabend@gmail.com>
    Cc: KP Singh <kpsingh@chromium.org>
    Cc: linux-kselftest@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: bpf@vger.kernel.org
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    cf8918db
seccomp_bpf.c 98.2 KB