All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Kees Cook <keescook@chromium.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Will Drewry <wad@chromium.org>, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/seccomp: fix test failure on s390x because of positive error return Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
Date: Fri, 25 Jan 2019 14:54:25 +0000	[thread overview]
Message-ID: <20190125145425.7039-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

The error return being placed in regs.SYSCALL_RET is currently positive and
this is causing test failures on s390x. The return value should be -EPERM
rather than EPERM otherwise a failure is not detected and errno is not set
accordingly on s390x.

Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 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..957344884360 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1706,7 +1706,7 @@ void change_syscall(struct __test_metadata *_metadata,
 #ifdef SYSCALL_NUM_RET_SHARE_REG
 		TH_LOG("Can't modify syscall return on this architecture");
 #else
-		regs.SYSCALL_RET = EPERM;
+		regs.SYSCALL_RET = -EPERM;
 #endif
 
 #ifdef HAVE_GETREGS
@@ -1850,7 +1850,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
 					   true);
 
 	/* Tracer should skip the open syscall, resulting in EPERM. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_openat));
 }
 
 TEST_F(TRACE_syscall, syscall_allowed)
@@ -1894,7 +1894,7 @@ TEST_F(TRACE_syscall, syscall_dropped)
 	ASSERT_EQ(0, ret);
 
 	/* gettid has been skipped and an altered return value stored. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_gettid));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_gettid));
 	EXPECT_NE(self->mytid, syscall(__NR_gettid));
 }
 
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: Colin King <colin.king@canonical.com>
To: kernel-janitors@vger.kernel.org
Subject: [PATCH] selftests/seccomp: fix test failure on s390x because of positive error return Content-Type:
Date: Fri, 25 Jan 2019 14:54:25 +0000	[thread overview]
Message-ID: <20190125145425.7039-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

The error return being placed in regs.SYSCALL_RET is currently positive and
this is causing test failures on s390x. The return value should be -EPERM
rather than EPERM otherwise a failure is not detected and errno is not set
accordingly on s390x.

Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 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..957344884360 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1706,7 +1706,7 @@ void change_syscall(struct __test_metadata *_metadata,
 #ifdef SYSCALL_NUM_RET_SHARE_REG
 		TH_LOG("Can't modify syscall return on this architecture");
 #else
-		regs.SYSCALL_RET = EPERM;
+		regs.SYSCALL_RET = -EPERM;
 #endif
 
 #ifdef HAVE_GETREGS
@@ -1850,7 +1850,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
 					   true);
 
 	/* Tracer should skip the open syscall, resulting in EPERM. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_openat));
 }
 
 TEST_F(TRACE_syscall, syscall_allowed)
@@ -1894,7 +1894,7 @@ TEST_F(TRACE_syscall, syscall_dropped)
 	ASSERT_EQ(0, ret);
 
 	/* gettid has been skipped and an altered return value stored. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_gettid));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_gettid));
 	EXPECT_NE(self->mytid, syscall(__NR_gettid));
 }
 
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: colin.king at canonical.com (Colin King)
Subject: [PATCH] selftests/seccomp: fix test failure on s390x because of positive error return Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
Date: Fri, 25 Jan 2019 14:54:25 +0000	[thread overview]
Message-ID: <20190125145425.7039-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king at canonical.com>

The error return being placed in regs.SYSCALL_RET is currently positive and
this is causing test failures on s390x. The return value should be -EPERM
rather than EPERM otherwise a failure is not detected and errno is not set
accordingly on s390x.

Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 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..957344884360 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1706,7 +1706,7 @@ void change_syscall(struct __test_metadata *_metadata,
 #ifdef SYSCALL_NUM_RET_SHARE_REG
 		TH_LOG("Can't modify syscall return on this architecture");
 #else
-		regs.SYSCALL_RET = EPERM;
+		regs.SYSCALL_RET = -EPERM;
 #endif
 
 #ifdef HAVE_GETREGS
@@ -1850,7 +1850,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
 					   true);
 
 	/* Tracer should skip the open syscall, resulting in EPERM. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_openat));
 }
 
 TEST_F(TRACE_syscall, syscall_allowed)
@@ -1894,7 +1894,7 @@ TEST_F(TRACE_syscall, syscall_dropped)
 	ASSERT_EQ(0, ret);
 
 	/* gettid has been skipped and an altered return value stored. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_gettid));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_gettid));
 	EXPECT_NE(self->mytid, syscall(__NR_gettid));
 }
 
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: colin.king@canonical.com (Colin King)
Subject: [PATCH] selftests/seccomp: fix test failure on s390x because of positive error return Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
Date: Fri, 25 Jan 2019 14:54:25 +0000	[thread overview]
Message-ID: <20190125145425.7039-1-colin.king@canonical.com> (raw)
Message-ID: <20190125145425.SoHLrbkMusTB_VyjhJ2bNT3JLW8Qxmfuh-y2DD2rLMo@z> (raw)

From: Colin Ian King <colin.king@canonical.com>

The error return being placed in regs.SYSCALL_RET is currently positive and
this is causing test failures on s390x. The return value should be -EPERM
rather than EPERM otherwise a failure is not detected and errno is not set
accordingly on s390x.

Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 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..957344884360 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1706,7 +1706,7 @@ void change_syscall(struct __test_metadata *_metadata,
 #ifdef SYSCALL_NUM_RET_SHARE_REG
 		TH_LOG("Can't modify syscall return on this architecture");
 #else
-		regs.SYSCALL_RET = EPERM;
+		regs.SYSCALL_RET = -EPERM;
 #endif
 
 #ifdef HAVE_GETREGS
@@ -1850,7 +1850,7 @@ TEST_F(TRACE_syscall, ptrace_syscall_dropped)
 					   true);
 
 	/* Tracer should skip the open syscall, resulting in EPERM. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_openat));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_openat));
 }
 
 TEST_F(TRACE_syscall, syscall_allowed)
@@ -1894,7 +1894,7 @@ TEST_F(TRACE_syscall, syscall_dropped)
 	ASSERT_EQ(0, ret);
 
 	/* gettid has been skipped and an altered return value stored. */
-	EXPECT_SYSCALL_RETURN(EPERM, syscall(__NR_gettid));
+	EXPECT_SYSCALL_RETURN(-EPERM, syscall(__NR_gettid));
 	EXPECT_NE(self->mytid, syscall(__NR_gettid));
 }
 
-- 
2.19.1

             reply	other threads:[~2019-01-25 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 14:54 Colin King [this message]
2019-01-25 14:54 ` [PATCH] selftests/seccomp: fix test failure on s390x because of positive error return Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Colin King
2019-01-25 14:54 ` colin.king
2019-01-25 14:54 ` [PATCH] selftests/seccomp: fix test failure on s390x because of positive error return Content-Type: Colin King

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=20190125145425.7039-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=keescook@chromium.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=shuah@kernel.org \
    --cc=wad@chromium.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.