qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2
@ 2018-04-03 10:35 Laurent Vivier
  2018-04-03 10:35 ` [Qemu-devel] [PULL 1/3] linux-user: fix alpha signal emulation Laurent Vivier
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Laurent Vivier @ 2018-04-03 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier

The following changes since commit f184de7553272223d6af731d7d623a7cebf710b5:

  Merge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-critical-fixes' into staging (2018-03-31 09:42:33 +0100)

are available in the Git repository at:

  git://github.com/vivier/qemu.git tags/linux-user-for-2.12-pull-request

for you to fetch changes up to 3ea7f4a226cd3a4d107772569976dbb13400a632:

  linux-user: fix TARGET___O_TMPFILE for sparc (2018-04-03 11:50:24 +0200)

----------------------------------------------------------------
Alpha and sparc32plus have broken signal frame handler.
With these fixes, we can now:
- with alpha target, successfully debootstrap debian sid
- with sparc32plus target, run "ls" in a bash in a chroot without error
----------------------------------------------------------------

Laurent Vivier (3):
  linux-user: fix alpha signal emulation
  linux-user: define TARGET_ARCH_HAS_KA_RESTORER
  linux-user: fix TARGET___O_TMPFILE for sparc

 linux-user/signal.c       | 8 ++++----
 linux-user/syscall.c      | 7 +++++--
 linux-user/syscall_defs.h | 5 +++++
 3 files changed, 14 insertions(+), 6 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 1/3] linux-user: fix alpha signal emulation
  2018-04-03 10:35 [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Laurent Vivier
@ 2018-04-03 10:35 ` Laurent Vivier
  2018-04-03 10:35 ` [Qemu-devel] [PULL 2/3] linux-user: define TARGET_ARCH_HAS_KA_RESTORER Laurent Vivier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2018-04-03 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier

setup_frame() doesn't set correctly the address of the trampoline code.
The offset of retcode array must be added to the stack frame address.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180401204653.14211-1-laurent@vivier.eu>
---
 linux-user/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 2ea3e0321f..9399f0ec47 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -6367,7 +6367,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
                    &frame->retcode[1]);
         __put_user(INSN_CALLSYS, &frame->retcode[2]);
         /* imb() */
-        r26 = frame_addr;
+        r26 = frame_addr + offsetof(struct target_sigframe, retcode);
     }
 
     unlock_user_struct(frame, frame_addr, 1);
@@ -6424,7 +6424,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
                    &frame->retcode[1]);
         __put_user(INSN_CALLSYS, &frame->retcode[2]);
         /* imb(); */
-        r26 = frame_addr;
+        r26 = frame_addr + offsetof(struct target_sigframe, retcode);
     }
 
     if (err) {
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 2/3] linux-user: define TARGET_ARCH_HAS_KA_RESTORER
  2018-04-03 10:35 [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Laurent Vivier
  2018-04-03 10:35 ` [Qemu-devel] [PULL 1/3] linux-user: fix alpha signal emulation Laurent Vivier
@ 2018-04-03 10:35 ` Laurent Vivier
  2018-04-03 10:35 ` [Qemu-devel] [PULL 3/3] linux-user: fix TARGET___O_TMPFILE for sparc Laurent Vivier
  2018-04-04 10:13 ` [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2018-04-03 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier

Sparc as an extended sigaction structure containing
the field ka_restorer used in place of sa_restorer.

Define TARGET_ARCH_HAS_KA_RESTORER and use it
with sparc.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180402102453.9883-2-laurent@vivier.eu>
---
 linux-user/signal.c       | 4 ++--
 linux-user/syscall.c      | 7 +++++--
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 9399f0ec47..5febe6aedf 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -2920,8 +2920,8 @@ static void setup_frame(int sig, struct target_sigaction *ka,
     env->pc = ka->_sa_handler;
     env->npc = (env->pc + 4);
     /* 5. return to kernel instructions */
-    if (ka->sa_restorer) {
-        env->regwptr[UREG_I7] = ka->sa_restorer;
+    if (ka->ka_restorer) {
+        env->regwptr[UREG_I7] = ka->ka_restorer;
     } else {
         uint32_t val32;
 
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 889abbda1e..b8353d8f13 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8699,6 +8699,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 target_siginitset(&act.sa_mask, old_act->sa_mask);
                 act.sa_flags = old_act->sa_flags;
                 act.sa_restorer = old_act->sa_restorer;
+#ifdef TARGET_ARCH_HAS_KA_RESTORER
+                act.ka_restorer = 0;
+#endif
                 unlock_user_struct(old_act, arg2, 0);
                 pact = &act;
             } else {
@@ -8773,8 +8776,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) {
                     goto efault;
                 }
-#ifdef TARGET_SPARC
-                act->sa_restorer = restorer;
+#ifdef TARGET_ARCH_HAS_KA_RESTORER
+                act->ka_restorer = restorer;
 #endif
             } else {
                 act = NULL;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 13fe840239..7473be518b 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -435,6 +435,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
 #define TARGET_SA_NODEFER      0x20u
 #define TARGET_SA_RESETHAND    4u
 #define TARGET_ARCH_HAS_SA_RESTORER 1
+#define TARGET_ARCH_HAS_KA_RESTORER 1
 #elif defined(TARGET_MIPS)
 #define TARGET_SA_NOCLDSTOP	0x00000001
 #define TARGET_SA_NOCLDWAIT	0x00010000
@@ -742,6 +743,9 @@ struct target_sigaction {
         abi_ulong sa_restorer;
 #endif
         target_sigset_t sa_mask;
+#ifdef TARGET_ARCH_HAS_KA_RESTORER
+        abi_ulong ka_restorer;
+#endif
 };
 #endif
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 3/3] linux-user: fix TARGET___O_TMPFILE for sparc
  2018-04-03 10:35 [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Laurent Vivier
  2018-04-03 10:35 ` [Qemu-devel] [PULL 1/3] linux-user: fix alpha signal emulation Laurent Vivier
  2018-04-03 10:35 ` [Qemu-devel] [PULL 2/3] linux-user: define TARGET_ARCH_HAS_KA_RESTORER Laurent Vivier
@ 2018-04-03 10:35 ` Laurent Vivier
  2018-04-04 10:13 ` [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2018-04-03 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180402102453.9883-3-laurent@vivier.eu>
---
 linux-user/syscall_defs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 7473be518b..23f5bccf0e 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2565,6 +2565,7 @@ struct target_statfs64 {
 #define TARGET_O_CLOEXEC      0x400000
 #define TARGET___O_SYNC       0x800000
 #define TARGET_O_PATH        0x1000000
+#define TARGET___O_TMPFILE   0x2000000
 #endif
 
 /* <asm-generic/fcntl.h> values follow.  */
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2
  2018-04-03 10:35 [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Laurent Vivier
                   ` (2 preceding siblings ...)
  2018-04-03 10:35 ` [Qemu-devel] [PULL 3/3] linux-user: fix TARGET___O_TMPFILE for sparc Laurent Vivier
@ 2018-04-04 10:13 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2018-04-04 10:13 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: QEMU Developers, Riku Voipio

On 3 April 2018 at 11:35, Laurent Vivier <laurent@vivier.eu> wrote:
> The following changes since commit f184de7553272223d6af731d7d623a7cebf710b5:
>
>   Merge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-critical-fixes' into staging (2018-03-31 09:42:33 +0100)
>
> are available in the Git repository at:
>
>   git://github.com/vivier/qemu.git tags/linux-user-for-2.12-pull-request
>
> for you to fetch changes up to 3ea7f4a226cd3a4d107772569976dbb13400a632:
>
>   linux-user: fix TARGET___O_TMPFILE for sparc (2018-04-03 11:50:24 +0200)
>
> ----------------------------------------------------------------
> Alpha and sparc32plus have broken signal frame handler.
> With these fixes, we can now:
> - with alpha target, successfully debootstrap debian sid
> - with sparc32plus target, run "ls" in a bash in a chroot without error
> ----------------------------------------------------------------
>
> Laurent Vivier (3):
>   linux-user: fix alpha signal emulation
>   linux-user: define TARGET_ARCH_HAS_KA_RESTORER
>   linux-user: fix TARGET___O_TMPFILE for sparc
>
>  linux-user/signal.c       | 8 ++++----
>  linux-user/syscall.c      | 7 +++++--
>  linux-user/syscall_defs.h | 5 +++++
>  3 files changed, 14 insertions(+), 6 deletions(-)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-04 10:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-03 10:35 [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Laurent Vivier
2018-04-03 10:35 ` [Qemu-devel] [PULL 1/3] linux-user: fix alpha signal emulation Laurent Vivier
2018-04-03 10:35 ` [Qemu-devel] [PULL 2/3] linux-user: define TARGET_ARCH_HAS_KA_RESTORER Laurent Vivier
2018-04-03 10:35 ` [Qemu-devel] [PULL 3/3] linux-user: fix TARGET___O_TMPFILE for sparc Laurent Vivier
2018-04-04 10:13 ` [Qemu-devel] [PULL 0/3] linux-user fixes for -rc2 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).