All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tycho Andersen <tycho@tycho.ws>
To: Shuah Khan <shuah@kernel.org>, Kees Cook <keescook@chromium.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tycho Andersen <tycho@tycho.ws>
Subject: [PATCH 1/6] selftests: don't kill child immediately in get_metadata() test
Date: Fri, 18 Jan 2019 17:12:12 -0700	[thread overview]
Message-ID: <20190119001217.12660-2-tycho@tycho.ws> (raw)
In-Reply-To: <20190119001217.12660-1-tycho@tycho.ws>

This this test forks a child, and then the parent waits for a write() to a
pipe signalling the child is ready to be attached to. If something in the
child ASSERTs before it does this write, the test will hang waiting for it.
Instead, let's EXPECT, so that execution continues until we do the write.
Any failure after that is fine and can ASSERT.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 496a9a8c773a..9aba1b904089 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -2943,11 +2943,11 @@ TEST(get_metadata)
 		};
 
 		/* one with log, one without */
-		ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
+		EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
 				     SECCOMP_FILTER_FLAG_LOG, &prog));
-		ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
+		EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
 
-		ASSERT_EQ(0, close(pipefd[0]));
+		EXPECT_EQ(0, close(pipefd[0]));
 		ASSERT_EQ(1, write(pipefd[1], "1", 1));
 		ASSERT_EQ(0, close(pipefd[1]));
 
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: tycho at tycho.ws (Tycho Andersen)
Subject: [PATCH 1/6] selftests: don't kill child immediately in get_metadata() test
Date: Fri, 18 Jan 2019 17:12:12 -0700	[thread overview]
Message-ID: <20190119001217.12660-2-tycho@tycho.ws> (raw)
In-Reply-To: <20190119001217.12660-1-tycho@tycho.ws>

This this test forks a child, and then the parent waits for a write() to a
pipe signalling the child is ready to be attached to. If something in the
child ASSERTs before it does this write, the test will hang waiting for it.
Instead, let's EXPECT, so that execution continues until we do the write.
Any failure after that is fine and can ASSERT.

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 496a9a8c773a..9aba1b904089 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -2943,11 +2943,11 @@ TEST(get_metadata)
 		};
 
 		/* one with log, one without */
-		ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
+		EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
 				     SECCOMP_FILTER_FLAG_LOG, &prog));
-		ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
+		EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
 
-		ASSERT_EQ(0, close(pipefd[0]));
+		EXPECT_EQ(0, close(pipefd[0]));
 		ASSERT_EQ(1, write(pipefd[1], "1", 1));
 		ASSERT_EQ(0, close(pipefd[1]));
 
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: tycho@tycho.ws (Tycho Andersen)
Subject: [PATCH 1/6] selftests: don't kill child immediately in get_metadata() test
Date: Fri, 18 Jan 2019 17:12:12 -0700	[thread overview]
Message-ID: <20190119001217.12660-2-tycho@tycho.ws> (raw)
Message-ID: <20190119001212.UFEJ9jFIbadgSf0cKaal343BnkpaHYWqo0pMhsL_uPA@z> (raw)
In-Reply-To: <20190119001217.12660-1-tycho@tycho.ws>

This this test forks a child, and then the parent waits for a write() to a
pipe signalling the child is ready to be attached to. If something in the
child ASSERTs before it does this write, the test will hang waiting for it.
Instead, let's EXPECT, so that execution continues until we do the write.
Any failure after that is fine and can ASSERT.

Signed-off-by: Tycho Andersen <tycho at tycho.ws>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 496a9a8c773a..9aba1b904089 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -2943,11 +2943,11 @@ TEST(get_metadata)
 		};
 
 		/* one with log, one without */
-		ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
+		EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER,
 				     SECCOMP_FILTER_FLAG_LOG, &prog));
-		ASSERT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
+		EXPECT_EQ(0, seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog));
 
-		ASSERT_EQ(0, close(pipefd[0]));
+		EXPECT_EQ(0, close(pipefd[0]));
 		ASSERT_EQ(1, write(pipefd[1], "1", 1));
 		ASSERT_EQ(0, close(pipefd[1]));
 
-- 
2.19.1

  reply	other threads:[~2019-01-19  0:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19  0:12 [PATCH v1 0/6] seccomp test fixes Tycho Andersen
2019-01-19  0:12 ` Tycho Andersen
2019-01-19  0:12 ` tycho
2019-01-19  0:12 ` Tycho Andersen [this message]
2019-01-19  0:12   ` [PATCH 1/6] selftests: don't kill child immediately in get_metadata() test Tycho Andersen
2019-01-19  0:12   ` tycho
2019-01-19  0:12 ` [PATCH 2/6] selftests: fix typo in seccomp_bpf.c Tycho Andersen
2019-01-19  0:12   ` Tycho Andersen
2019-01-19  0:12   ` tycho
2019-01-19  0:12 ` [PATCH 3/6] selftest: include stdio.h in kselftest.h Tycho Andersen
2019-01-19  0:12   ` Tycho Andersen
2019-01-19  0:12   ` tycho
2019-01-19  0:12 ` [PATCH 4/6] selftests: skip seccomp get_metadata test if not real root Tycho Andersen
2019-01-19  0:12   ` Tycho Andersen
2019-01-19  0:12   ` tycho
2019-01-19  0:12 ` [PATCH 5/6] selftests: set NO_NEW_PRIVS bit in seccomp user tests Tycho Andersen
2019-01-19  0:12   ` Tycho Andersen
2019-01-19  0:12   ` tycho
2019-01-19  0:12 ` [PATCH 6/6] selftests: unshare userns in seccomp pidns testcases Tycho Andersen
2019-01-19  0:12   ` Tycho Andersen
2019-01-19  0:12   ` tycho
2019-01-20  0:43 ` [PATCH v1 0/6] seccomp test fixes Kees Cook
2019-01-20  0:43   ` Kees Cook
2019-01-20  0:43   ` keescook
2019-01-20 19:28   ` shuah
2019-01-20 19:28     ` shuah
2019-01-20 19:28     ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190119001217.12660-2-tycho@tycho.ws \
    --to=tycho@tycho.ws \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.