OSDN Git Service

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)
committerShuah Khan <shuah@kernel.org>
Fri, 25 Jan 2019 22:13:35 +0000 (15:13 -0700)
commited5f13261cb65b02c611ae9971677f33581d4286
tree5865aa0d86940f670ad69d6cb87e1351787522a2
parent7e35a5940fab59eeccb9162eb2389342e0a87e53
selftests/seccomp: Enhance per-arch ptrace syscall skip tests

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>
tools/testing/selftests/seccomp/seccomp_bpf.c