From: "Dmitry V. Levin" <ldv@strace.io>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>, Shuah Khan <shuah@kernel.org>,
Alexey Gladkov <legion@kernel.org>,
Eugene Syromyatnikov <evgsyr@gmail.com>,
Mike Frysinger <vapier@gentoo.org>,
Renzo Davoli <renzo@cs.unibo.it>,
Davide Berardi <berardi.dav@gmail.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
strace-devel@lists.strace.io, linux-s390@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 0/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO API
Date: Tue, 4 Feb 2025 17:14:20 +0200 [thread overview]
Message-ID: <20250204151420.GA30282@strace.io> (raw)
In-Reply-To: <20250203103542.GA16165@strace.io>
On Mon, Feb 03, 2025 at 12:35:42PM +0200, Dmitry V. Levin wrote:
> On Mon, Feb 03, 2025 at 10:29:37AM +0100, Alexander Gordeev wrote:
> > On Mon, Feb 03, 2025 at 08:58:49AM +0200, Dmitry V. Levin wrote:
> >
> > Hi Dmitry,
> >
> > > PTRACE_SET_SYSCALL_INFO is a generic ptrace API that complements
> > > PTRACE_GET_SYSCALL_INFO by letting the ptracer modify details of
> > > system calls the tracee is blocked in.
> > ...
> >
> > FWIW, I am getting these on s390:
> >
> > # ./tools/testing/selftests/ptrace/set_syscall_info
> > TAP version 13
> > 1..1
> > # Starting 1 tests from 1 test cases.
> > # RUN global.set_syscall_info ...
> > # set_syscall_info.c:87:set_syscall_info:Expected exp_entry->nr (-1) == info->entry.nr (65535)
> > # set_syscall_info.c:88:set_syscall_info:wait #3: PTRACE_GET_SYSCALL_INFO #2: syscall nr mismatch
> > # set_syscall_info: Test terminated by assertion
> > # FAIL global.set_syscall_info
> > not ok 1 global.set_syscall_info
> > # FAILED: 0 / 1 tests passed.
> > # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
> >
> > I remember one of the earlier versions (v1 or v2) was working for me.
> >
> > Thanks!
>
> In v3, this test was extended to check whether PTRACE_GET_SYSCALL_INFO
> called immediately after PTRACE_SET_SYSCALL_INFO returns the same syscall
> number, and on s390 it apparently doesn't, thanks to its implementation
> of syscall_get_nr() that returns 0xffff in this case.
>
> To workaround this, we could either change syscall_get_nr() to return -1
> in this case, or add an #ifdef __s390x__ exception to the test.
>
> What would you prefer?
OK, I'm going to apply the following s390 workaround to the test:
diff --git a/tools/testing/selftests/ptrace/set_syscall_info.c b/tools/testing/selftests/ptrace/set_syscall_info.c
index 0ec69401c008..4198248ef874 100644
--- a/tools/testing/selftests/ptrace/set_syscall_info.c
+++ b/tools/testing/selftests/ptrace/set_syscall_info.c
@@ -71,6 +71,11 @@ check_psi_entry(struct __test_metadata *_metadata,
const char *text)
{
unsigned int i;
+ int exp_nr = exp_entry->nr;
+#if defined __s390__ || defined __s390x__
+ /* s390 is the only architecture that has 16-bit syscall numbers */
+ exp_nr &= 0xffff;
+#endif
ASSERT_EQ(PTRACE_SYSCALL_INFO_ENTRY, info->op) {
LOG_KILL_TRACEE("%s: entry stop mismatch", text);
@@ -84,7 +89,7 @@ check_psi_entry(struct __test_metadata *_metadata,
ASSERT_TRUE(info->stack_pointer) {
LOG_KILL_TRACEE("%s: entry stop mismatch", text);
}
- ASSERT_EQ(exp_entry->nr, info->entry.nr) {
+ ASSERT_EQ(exp_nr, info->entry.nr) {
LOG_KILL_TRACEE("%s: syscall nr mismatch", text);
}
for (i = 0; i < ARRAY_SIZE(exp_entry->args); ++i) {
--
ldv
next prev parent reply other threads:[~2025-02-04 15:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 6:58 [PATCH v4 0/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO API Dmitry V. Levin
2025-02-03 6:58 ` Dmitry V. Levin
2025-02-03 6:58 ` Dmitry V. Levin
2025-02-03 6:59 ` [PATCH v4 1/7] mips: fix mips_get_syscall_arg() for o32 Dmitry V. Levin
2025-02-03 7:00 ` [PATCH v4 2/7] hexagon: add syscall_set_return_value() Dmitry V. Levin
2025-02-03 7:00 ` [PATCH v4 3/7] syscall.h: add syscall_set_arguments() Dmitry V. Levin
2025-02-03 7:00 ` Dmitry V. Levin
2025-02-03 7:00 ` Dmitry V. Levin
2025-02-03 7:00 ` [PATCH v4 4/7] syscall.h: introduce syscall_set_nr() Dmitry V. Levin
2025-02-03 7:00 ` Dmitry V. Levin
2025-02-03 7:00 ` Dmitry V. Levin
2025-02-03 20:47 ` Helge Deller
2025-02-03 7:00 ` [PATCH v4 5/7] ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op Dmitry V. Levin
2025-02-03 7:00 ` [PATCH v4 6/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO request Dmitry V. Levin
2025-02-03 7:01 ` [PATCH v4 7/7] selftests/ptrace: add a test case for PTRACE_SET_SYSCALL_INFO Dmitry V. Levin
2025-02-03 9:29 ` [PATCH v4 0/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO API Alexander Gordeev
2025-02-03 9:29 ` Alexander Gordeev
2025-02-03 9:29 ` Alexander Gordeev
2025-02-03 10:35 ` Dmitry V. Levin
2025-02-03 10:35 ` Dmitry V. Levin
2025-02-03 10:35 ` Dmitry V. Levin
2025-02-04 15:14 ` Dmitry V. Levin [this message]
2025-02-05 9:06 ` Sven Schnelle
2025-02-11 13:02 ` Dmitry V. Levin
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=20250204151420.GA30282@strace.io \
--to=ldv@strace.io \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=berardi.dav@gmail.com \
--cc=borntraeger@linux.ibm.com \
--cc=evgsyr@gmail.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=legion@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=renzo@cs.unibo.it \
--cc=shuah@kernel.org \
--cc=strace-devel@lists.strace.io \
--cc=svens@linux.ibm.com \
--cc=vapier@gentoo.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.