Skip to content

Commit 23fff7a

Browse files
Andreas-Krebbelvivier
authored andcommitted
linux-user/s390x: Use the guest pointer for the sigreturn stub
When setting up the pointer for the sigreturn stub in the return address register (r14) we currently use the host frame address instead of the guest frame address. Note: This only caused problems if Qemu has been built with --disable-pie (as it is in distros nowadays). Otherwise guest_base defaults to 0 hiding the actual problem. Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210324185128.63971-1-krebbel@linux.ibm.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
1 parent 9e2e9fe commit 23fff7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

linux-user/s390x/signal.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
211211
/* Set up to return from userspace. If provided, use a stub
212212
already in userspace. */
213213
if (ka->sa_flags & TARGET_SA_RESTORER) {
214-
env->regs[14] = (unsigned long) ka->sa_restorer | PSW_ADDR_AMODE;
214+
env->regs[14] = ka->sa_restorer | PSW_ADDR_AMODE;
215215
} else {
216-
env->regs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE;
216+
env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode))
217+
| PSW_ADDR_AMODE;
217218
__put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn,
218219
(uint16_t *)(frame->retcode));
219220
}

0 commit comments

Comments
 (0)