Re: [PATCH] s390/signal: Fix incorrect return address in signal frame

From: Sven Schnelle

Date: Tue Oct 13 2026 - 03:07:41 EST


Heiko Carstens <hca@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxx>