* [PATCH] s390/signal: Fix incorrect return address in signal frame
@ 2026-10-12 15:33 Heiko Carstens
2026-10-13 7:07 ` Sven Schnelle
0 siblings, 1 reply; 2+ messages in thread
From: Heiko Carstens @ 2026-10-12 15:33 UTC (permalink / raw)
To: Alexander Gordeev, Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-kernel, linux-s390
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;
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] s390/signal: Fix incorrect return address in signal frame
2026-10-12 15:33 [PATCH] s390/signal: Fix incorrect return address in signal frame Heiko Carstens
@ 2026-10-13 7:07 ` Sven Schnelle
0 siblings, 0 replies; 2+ messages in thread
From: Sven Schnelle @ 2026-10-13 7:07 UTC (permalink / raw)
To: Heiko Carstens
Cc: Alexander Gordeev, Vasily Gorbik, Christian Borntraeger,
linux-kernel, linux-s390
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-13 7:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 15:33 [PATCH] s390/signal: Fix incorrect return address in signal frame Heiko Carstens
2026-10-13 7:07 ` Sven Schnelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®