selftests/seccomp: Enhance per-arch ptrace syscall skip tests
authorKees Cook <keescook@chromium.org>
Fri, 25 Jan 2019 18:33:59 +0000 (10:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Feb 2019 16:30:11 +0000 (17:30 +0100)
commit0fb0acc0dd86b2e20734237f46f9afa7bf3b03d2
tree7db927d455c16ad74aa31b1ea8702beb8cbe354e
parent7e3251667a1f0cafd0c278b0159e48585e5b6c68
selftests/seccomp: Enhance per-arch ptrace syscall skip tests

commit ed5f13261cb65b02c611ae9971677f33581d4286 upstream.

Passing EPERM during syscall skipping was confusing since the test wasn't
actually exercising the errno evaluation -- it was just passing a literal
"1" (EPERM). Instead, expand the tests to check both direct value returns
(positive, 45000 in this case), and errno values (negative, -ESRCH in this
case) to check both fake success and fake failure during syscall skipping.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/seccomp/seccomp_bpf.c