From: Dmitry V. Levin <ldv@altlinux.org>
To: lkp@lists.01.org
Subject: [PATCH] selftests/seccomp/seccomp_bpf: update for PTRACE_GET_SYSCALL_INFO
Date: Mon, 08 Jul 2019 21:29:04 +0300 [thread overview]
Message-ID: <20190708182904.GA12332@altlinux.org> (raw)
In-Reply-To: <20190708090627.GO17490@shao2-debian>
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
The syscall entry/exit is now exposed via PTRACE_GETEVENTMSG,
update the test accordingly.
Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index dc66fe852768..6ef7f16c4cf5 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1775,13 +1775,18 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee,
unsigned long msg;
static bool entry;
- /* Make sure we got an empty message. */
+ /*
+ * The traditional way to tell PTRACE_SYSCALL entry/exit
+ * is by counting.
+ */
+ entry = !entry;
+
+ /* Make sure we got an appropriate message. */
ret = ptrace(PTRACE_GETEVENTMSG, tracee, NULL, &msg);
EXPECT_EQ(0, ret);
- EXPECT_EQ(0, msg);
+ EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
+ : PTRACE_EVENTMSG_SYSCALL_EXIT, msg);
- /* The only way to tell PTRACE_SYSCALL entry/exit is by counting. */
- entry = !entry;
if (!entry)
return;
--
ldv
WARNING: multiple messages have this Message-ID (diff)
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Elvira Khabirova <lineprinter@altlinux.org>,
Oleg Nesterov <oleg@redhat.com>,
Kees Cook <keescook@chromium.org>,
Andy Lutomirski <luto@kernel.org>,
Eugene Syromyatnikov <esyr@redhat.com>,
Shuah Khan <shuah@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
kbuild test robot <lkp@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
lkp@01.org
Subject: [PATCH] selftests/seccomp/seccomp_bpf: update for PTRACE_GET_SYSCALL_INFO
Date: Mon, 8 Jul 2019 21:29:04 +0300 [thread overview]
Message-ID: <20190708182904.GA12332@altlinux.org> (raw)
In-Reply-To: <20190708090627.GO17490@shao2-debian>
The syscall entry/exit is now exposed via PTRACE_GETEVENTMSG,
update the test accordingly.
Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index dc66fe852768..6ef7f16c4cf5 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1775,13 +1775,18 @@ void tracer_ptrace(struct __test_metadata *_metadata, pid_t tracee,
unsigned long msg;
static bool entry;
- /* Make sure we got an empty message. */
+ /*
+ * The traditional way to tell PTRACE_SYSCALL entry/exit
+ * is by counting.
+ */
+ entry = !entry;
+
+ /* Make sure we got an appropriate message. */
ret = ptrace(PTRACE_GETEVENTMSG, tracee, NULL, &msg);
EXPECT_EQ(0, ret);
- EXPECT_EQ(0, msg);
+ EXPECT_EQ(entry ? PTRACE_EVENTMSG_SYSCALL_ENTRY
+ : PTRACE_EVENTMSG_SYSCALL_EXIT, msg);
- /* The only way to tell PTRACE_SYSCALL entry/exit is by counting. */
- entry = !entry;
if (!entry)
return;
--
ldv
next prev parent reply other threads:[~2019-07-08 18:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 9:06 [ptrace] cd5bbb3047: kernel_selftests.seccomp.seccomp_bpf.fail kernel test robot
2019-07-08 9:06 ` kernel test robot
2019-07-08 18:29 ` Dmitry V. Levin [this message]
2019-07-08 18:29 ` [PATCH] selftests/seccomp/seccomp_bpf: update for PTRACE_GET_SYSCALL_INFO Dmitry V. Levin
2019-07-08 18:41 ` Andy Lutomirski
2019-07-08 18:41 ` Andy Lutomirski
2019-07-09 4:24 ` Kees Cook
2019-07-09 4:24 ` Kees Cook
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=20190708182904.GA12332@altlinux.org \
--to=ldv@altlinux.org \
--cc=lkp@lists.01.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.