Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/signal: Fix incorrect return address in signal frame
Date: Tue, 13 Oct 2026 09:07:29 +0200	[thread overview]
Message-ID: <yt9dmrsixemm.fsf@linux.ibm.com> (raw)
In-Reply-To: <20261012153355.1529314-1-hca@linux.ibm.com> (Heiko Carstens's message of "Mon, 12 Oct 2026 17:33:55 +0200")

Heiko Carstens <hca@linux.ibm.com> writes:

> exit_to_user_mode_loop() can call arch_do_signal_or_restart() multiple
> times when signals are pending.
>
> If the first call set up a vDSO system call restart by saving the real
> user return address and adjusting psw.addr so it points to the vDSO stub,
> a second call builds the signal frame with the wrong return address.
>
> Restore psw.addr from arch_data before building the signal frame.
>
> Fixes: df29a7440c4b ("s390/signal: switch to using vdso for sigreturn and syscall restart")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/kernel/signal.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
> index 4874de5edea0..25781d4a0ad0 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;
> +		}
>  		rseq_signal_deliver(&ksig, regs);
>  		handle_signal(&ksig, oldset, regs);
>  		return;

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>

      parent reply	other threads:[~2026-10-13  7:07 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
2026-10-13  7:07 ` Sven Schnelle [this message]

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=yt9dmrsixemm.fsf@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox