From: Heiko Carstens <hca@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
linux-s390@vger.kernel.org, Vasily Gorbik <gor@linux.ibm.com>
Subject: Re: [PATCH] s390/signal: Fix incorrect return address in signal frame
Date: Mon, 12 Oct 2026 18:11:56 +0200 [thread overview]
Message-ID: <20261012161156.19350K88-hca@linux.ibm.com> (raw)
In-Reply-To: <sashiko-outbox-168354@kernel.org>
On Mon, Oct 12, 2026 at 03:50:03PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] s390/signal: patch breaks -EINTR for -ERESTART_RESTARTBLOCK
> --
>
> commit 158e48eb13e787b0b5c2f432c9056345d015870e
> Author: Heiko Carstens <hca@linux.ibm.com>
>
> s390/signal: Fix incorrect return address in signal frame
>
> This commit fixes an issue in arch_do_signal_or_restart() where a second call
> builds a signal frame with the wrong return address if the first call set up a
> vDSO system call restart. It addresses this by restoring psw.addr from
> arch_data before building the signal frame.
>
> > diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
> > index 4874de5edea0a..25781d4a0ad0c 100644
> > --- a/arch/s390/kernel/signal.c
> > +++ b/arch/s390/kernel/signal.c
> > @@ -475,7 +475,10 @@ void arch_do_signal_or_restart(struct pt_regs *regs)
> > }
> > /* No longer in a system call */
> > clear_pt_regs_flag(regs, PIF_SYSCALL);
> > -
> > + if (!(current->restart_block.arch_data & 1)) {
> > + regs->psw.addr = current->restart_block.arch_data;
> > + current->restart_block.arch_data = 1;
> > + }
...
> The newly added code restores regs->psw.addr to the original return address,
> bypassing the vDSO stub. Without the vDSO stub executing sys_restart_syscall
> (which would return -EINTR), the syscall instead returns orig_gpr2.
>
> Could this lead to system calls like nanosleep returning their first argument
> instead of -EINTR, breaking userspace error handling and POSIX compliance?
Correct. The whole point of this patch was to return -EINTR instead of
(incorrectly) restarting the system call, which is the most likely of the
unlikely scenarios. One could construct more obscure scenarios where user
space would end up with a SIGILL, but that's extremely unlikely.
Anyway, the -EINTR return code handling is broken with this patch.
next prev parent reply other threads:[~2026-10-12 16:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 15:33 [PATCH] s390/signal: Fix incorrect return address in signal frame Heiko Carstens
2026-10-12 15:50 ` sashiko-bot
2026-10-12 16:11 ` Heiko Carstens [this message]
2026-10-13 7:07 ` Sven Schnelle
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=20261012161156.19350K88-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox