Commit 3d244c19 authored by Kees Cook's avatar Kees Cook Committed by Shuah Khan

selftests/seccomp: Abort without user notification support

In the face of missing user notification support, the self test needs
to stop executing a test (ASSERT_*) instead of just reporting and
continuing (EXPECT_*). This adjusts the user notification tests to do
that where needed.
Reported-by: default avatarShuah Khan <shuah@kernel.org>
Fixes: 6a21cc50 ("seccomp: add a return code to trap to userspace")
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarTycho Andersen <tycho@tycho.ws>
Tested-by: default avatarShuah Khan <shuah@kernel.org>
Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
parent 508cacd7
...@@ -3044,7 +3044,7 @@ TEST(user_notification_basic) ...@@ -3044,7 +3044,7 @@ TEST(user_notification_basic)
/* Check that the basic notification machinery works */ /* Check that the basic notification machinery works */
listener = user_trap_syscall(__NR_getpid, listener = user_trap_syscall(__NR_getpid,
SECCOMP_FILTER_FLAG_NEW_LISTENER); SECCOMP_FILTER_FLAG_NEW_LISTENER);
EXPECT_GE(listener, 0); ASSERT_GE(listener, 0);
/* Installing a second listener in the chain should EBUSY */ /* Installing a second listener in the chain should EBUSY */
EXPECT_EQ(user_trap_syscall(__NR_getpid, EXPECT_EQ(user_trap_syscall(__NR_getpid,
...@@ -3103,7 +3103,7 @@ TEST(user_notification_kill_in_middle) ...@@ -3103,7 +3103,7 @@ TEST(user_notification_kill_in_middle)
listener = user_trap_syscall(__NR_getpid, listener = user_trap_syscall(__NR_getpid,
SECCOMP_FILTER_FLAG_NEW_LISTENER); SECCOMP_FILTER_FLAG_NEW_LISTENER);
EXPECT_GE(listener, 0); ASSERT_GE(listener, 0);
/* /*
* Check that nothing bad happens when we kill the task in the middle * Check that nothing bad happens when we kill the task in the middle
...@@ -3152,7 +3152,7 @@ TEST(user_notification_signal) ...@@ -3152,7 +3152,7 @@ TEST(user_notification_signal)
listener = user_trap_syscall(__NR_gettid, listener = user_trap_syscall(__NR_gettid,
SECCOMP_FILTER_FLAG_NEW_LISTENER); SECCOMP_FILTER_FLAG_NEW_LISTENER);
EXPECT_GE(listener, 0); ASSERT_GE(listener, 0);
pid = fork(); pid = fork();
ASSERT_GE(pid, 0); ASSERT_GE(pid, 0);
...@@ -3215,7 +3215,7 @@ TEST(user_notification_closed_listener) ...@@ -3215,7 +3215,7 @@ TEST(user_notification_closed_listener)
listener = user_trap_syscall(__NR_getpid, listener = user_trap_syscall(__NR_getpid,
SECCOMP_FILTER_FLAG_NEW_LISTENER); SECCOMP_FILTER_FLAG_NEW_LISTENER);
EXPECT_GE(listener, 0); ASSERT_GE(listener, 0);
/* /*
* Check that we get an ENOSYS when the listener is closed. * Check that we get an ENOSYS when the listener is closed.
...@@ -3376,7 +3376,7 @@ TEST(seccomp_get_notif_sizes) ...@@ -3376,7 +3376,7 @@ TEST(seccomp_get_notif_sizes)
{ {
struct seccomp_notif_sizes sizes; struct seccomp_notif_sizes sizes;
EXPECT_EQ(seccomp(SECCOMP_GET_NOTIF_SIZES, 0, &sizes), 0); ASSERT_EQ(seccomp(SECCOMP_GET_NOTIF_SIZES, 0, &sizes), 0);
EXPECT_EQ(sizes.seccomp_notif, sizeof(struct seccomp_notif)); EXPECT_EQ(sizes.seccomp_notif, sizeof(struct seccomp_notif));
EXPECT_EQ(sizes.seccomp_notif_resp, sizeof(struct seccomp_notif_resp)); EXPECT_EQ(sizes.seccomp_notif_resp, sizeof(struct seccomp_notif_resp));
} }
......
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