Skip to contentSkip to conversation

linux-user/signal.c: Use s390 target space address instead of host space address for restorer

PATCH In review [email protected] 3 participants 3 messages Mar 29, 2016 – May 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/signal.c: Use s390 target space address instead of host space address for restorer

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/signal.c +2 -2
index c0a6f7e..6a73321 100644
@@ -4117,8 +4117,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
             env->regs[14] = (unsigned long)
                     ka->sa_restorer | PSW_ADDR_AMODE;
     } else {
-            env->regs[14] = (unsigned long)
-                    frame->retcode | PSW_ADDR_AMODE;
+            env->regs[14] = (frame_addr + offsetof(sigframe, retcode))
+                            | PSW_ADDR_AMODE;
             __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn,
                        (uint16_t *)(frame->retcode));
     }
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · On 29 March 2016 at 15:29, <[email protected]> wrote:

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/signal.c +0 -0
index c0a6f7e..6a73321 100644

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 4124

Quoted 10 lines
linux-user/signal.c +2 -2
@@ -4117,8 +4117,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
             env->regs[14] = (unsigned long)
                     ka->sa_restorer | PSW_ADDR_AMODE;
     } else {
-            env->regs[14] = (unsigned long)
-                    frame->retcode | PSW_ADDR_AMODE;
+            env->regs[14] = (frame_addr + offsetof(sigframe, retcode))
+                            | PSW_ADDR_AMODE;
             __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn,
                        (uint16_t *)(frame->retcode));
     }

thanks
-- PMM

Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 16 lines · Le 29/03/2016 à 16:29, [email protected] a écrit :

From: Chen Gang <[email protected]>

The return address is in target space, so the restorer address needs to be target space, too.

---
 linux-user/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/signal.c +0 -0
index c0a6f7e..6a73321 100644

linux-user/signal.c static void setup_frame(int sig, struct target_sigaction *ka, · line 4124

Quoted 10 lines
linux-user/signal.c +2 -2
@@ -4117,8 +4117,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
             env->regs[14] = (unsigned long)
                     ka->sa_restorer | PSW_ADDR_AMODE;
     } else {
-            env->regs[14] = (unsigned long)
-                    frame->retcode | PSW_ADDR_AMODE;
+            env->regs[14] = (frame_addr + offsetof(sigframe, retcode))
+                            | PSW_ADDR_AMODE;
             __put_user(S390_SYSCALL_OPCODE | TARGET_NR_sigreturn,
                        (uint16_t *)(frame->retcode));
     }