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:31:34 +0000 (17:31 +0100)
commit2b1ee7daf46dff7a7c86cda4b41c892ec2516365
tree0ad001f933cb581238c57dcd0869386c85178f1c
parentb48b0fe5be40d5ed3a6172208812bfa5aa44538f
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