Commit 11eb004e authored by Kees Cook's avatar Kees Cook

selftests/seccomp: Check ENOSYS under tracing

There should be no difference between -1 and other negative syscalls
while tracing.

Cc: Keno Fischer <keno@juliacomputing.com>
Tested-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent adeeec84
...@@ -1942,6 +1942,26 @@ FIXTURE_TEARDOWN(TRACE_syscall) ...@@ -1942,6 +1942,26 @@ FIXTURE_TEARDOWN(TRACE_syscall)
teardown_trace_fixture(_metadata, self->tracer); teardown_trace_fixture(_metadata, self->tracer);
} }
TEST(negative_ENOSYS)
{
/*
* There should be no difference between an "internal" skip
* and userspace asking for syscall "-1".
*/
errno = 0;
EXPECT_EQ(-1, syscall(-1));
EXPECT_EQ(errno, ENOSYS);
/* And no difference for "still not valid but not -1". */
errno = 0;
EXPECT_EQ(-1, syscall(-101));
EXPECT_EQ(errno, ENOSYS);
}
TEST_F(TRACE_syscall, negative_ENOSYS)
{
negative_ENOSYS(_metadata);
}
TEST_F(TRACE_syscall, syscall_allowed) TEST_F(TRACE_syscall, syscall_allowed)
{ {
/* getppid works as expected (no changes). */ /* getppid works as expected (no changes). */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment