linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/seccomp: Abort without user notification support
@ 2019-01-17  0:35 Kees Cook
  2019-01-17  0:46 ` Tycho Andersen
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2019-01-17  0:35 UTC (permalink / raw)
  To: Shuah Khan; +Cc: linux-kernel, linux-kselftest, Tycho Andersen, James Morris

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: Shuah Khan <shuah@kernel.org>
Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 067cb4607d6c..496a9a8c773a 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -3044,7 +3044,7 @@ TEST(user_notification_basic)
 	/* Check that the basic notification machinery works */
 	listener = user_trap_syscall(__NR_getpid,
 				     SECCOMP_FILTER_FLAG_NEW_LISTENER);
-	EXPECT_GE(listener, 0);
+	ASSERT_GE(listener, 0);
 
 	/* Installing a second listener in the chain should EBUSY */
 	EXPECT_EQ(user_trap_syscall(__NR_getpid,
@@ -3103,7 +3103,7 @@ TEST(user_notification_kill_in_middle)
 
 	listener = user_trap_syscall(__NR_getpid,
 				     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
@@ -3152,7 +3152,7 @@ TEST(user_notification_signal)
 
 	listener = user_trap_syscall(__NR_gettid,
 				     SECCOMP_FILTER_FLAG_NEW_LISTENER);
-	EXPECT_GE(listener, 0);
+	ASSERT_GE(listener, 0);
 
 	pid = fork();
 	ASSERT_GE(pid, 0);
@@ -3215,7 +3215,7 @@ TEST(user_notification_closed_listener)
 
 	listener = user_trap_syscall(__NR_getpid,
 				     SECCOMP_FILTER_FLAG_NEW_LISTENER);
-	EXPECT_GE(listener, 0);
+	ASSERT_GE(listener, 0);
 
 	/*
 	 * Check that we get an ENOSYS when the listener is closed.
@@ -3376,7 +3376,7 @@ TEST(seccomp_get_notif_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_resp, sizeof(struct seccomp_notif_resp));
 }
-- 
2.17.1


-- 
Kees Cook

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/seccomp: Abort without user notification support
  2019-01-17  0:35 [PATCH] selftests/seccomp: Abort without user notification support Kees Cook
@ 2019-01-17  0:46 ` Tycho Andersen
  0 siblings, 0 replies; 2+ messages in thread
From: Tycho Andersen @ 2019-01-17  0:46 UTC (permalink / raw)
  To: Kees Cook; +Cc: Shuah Khan, linux-kernel, linux-kselftest, James Morris

On Wed, Jan 16, 2019 at 04:35:25PM -0800, Kees Cook wrote:
> 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: Shuah Khan <shuah@kernel.org>
> Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")

The gift that keeps on giving :)

Reviewed-by: Tycho Andersen <tycho@tycho.ws>

Thanks,

Tycho

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-17  0:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17  0:35 [PATCH] selftests/seccomp: Abort without user notification support Kees Cook
2019-01-17  0:46 ` Tycho Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).