selftests/seccomp: Check ENOSYS under tracing
There should be no difference between -1 and other negative syscalls while tracing. Cc: Andy Lutomirski <luto@amacapital.net> Cc: Will Drewry <wad@chromium.org> Cc: Will Deacon <will@kernel.org> Cc: Keno Fischer <keno@juliacomputing.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
0bf18a0cdc
commit
4c6614dc86
@ -1903,6 +1903,32 @@ FIXTURE_TEARDOWN(TRACE_syscall)
|
||||
teardown_trace_fixture(_metadata, self->tracer);
|
||||
}
|
||||
|
||||
TEST(negative_ENOSYS)
|
||||
{
|
||||
/* Untraced negative syscalls should return ENOSYS. */
|
||||
errno = 0;
|
||||
EXPECT_EQ(-1, syscall(-1));
|
||||
EXPECT_EQ(errno, ENOSYS);
|
||||
errno = 0;
|
||||
EXPECT_EQ(-1, syscall(-101));
|
||||
EXPECT_EQ(errno, ENOSYS);
|
||||
}
|
||||
|
||||
TEST_F(TRACE_syscall, 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, syscall_allowed)
|
||||
{
|
||||
/* getppid works as expected (no changes). */
|
||||
|
Loading…
Reference in New Issue
Block a user