[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/15] linux-user: Handle rt_sigaction correctly for
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 14/15] linux-user: Handle rt_sigaction correctly for SPARC |
Date: |
Mon, 20 Nov 2017 23:21:42 +0200 |
From: Peter Maydell <address@hidden>
SPARC is like Alpha in its handling of the rt_sigaction syscall:
it takes an extra parameter 'restorer' which needs to be copied
into the sa_restorer field of the sigaction struct. The order
of the arguments differs slightly between SPARC and Alpha but
the implementation is otherwise the same. (Compare the
rt_sigaction() functions in arch/sparc/kernel/sys_sparc_64.c
and arch/alpha/kernel/signal.c.)
Note that this change is somewhat moot until SPARC acquires
support for actually delivering RT signals.
Reviewed-by: Laurent Vivier <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f31b853bb7..11c9116c4a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8579,8 +8579,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
case TARGET_NR_rt_sigaction:
{
#if defined(TARGET_ALPHA)
- struct target_sigaction act, oact, *pact = 0;
+ /* For Alpha and SPARC this is a 5 argument syscall, with
+ * a 'restorer' parameter which must be copied into the
+ * sa_restorer field of the sigaction struct.
+ * For Alpha that 'restorer' is arg5; for SPARC it is arg4,
+ * and arg5 is the sigsetsize.
+ * Alpha also has a separate rt_sigaction struct that it uses
+ * here; SPARC uses the usual sigaction struct.
+ */
struct target_rt_sigaction *rt_act;
+ struct target_sigaction act, oact, *pact = 0;
if (arg4 != sizeof(target_sigset_t)) {
ret = -TARGET_EINVAL;
@@ -8606,18 +8614,29 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
unlock_user_struct(rt_act, arg3, 1);
}
#else
+#ifdef TARGET_SPARC
+ target_ulong restorer = arg4;
+ target_ulong sigsetsize = arg5;
+#else
+ target_ulong sigsetsize = arg4;
+#endif
struct target_sigaction *act;
struct target_sigaction *oact;
- if (arg4 != sizeof(target_sigset_t)) {
+ if (sigsetsize != sizeof(target_sigset_t)) {
ret = -TARGET_EINVAL;
break;
}
if (arg2) {
- if (!lock_user_struct(VERIFY_READ, act, arg2, 1))
+ if (!lock_user_struct(VERIFY_READ, act, arg2, 1)) {
goto efault;
- } else
+ }
+#ifdef TARGET_SPARC
+ act->sa_restorer = restorer;
+#endif
+ } else {
act = NULL;
+ }
if (arg3) {
if (!lock_user_struct(VERIFY_WRITE, oact, arg3, 0)) {
ret = -TARGET_EFAULT;
--
2.14.2
- [Qemu-devel] [PULL 02/15] linux-user/hppa: Fix TARGET_SA_* defines, (continued)
- [Qemu-devel] [PULL 02/15] linux-user/hppa: Fix TARGET_SA_* defines, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 05/15] linux-user/hppa: Fix TARGET_MAP_TYPE, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 06/15] linux-user/hppa: Fix TARGET_F_RDLCK, TARGET_F_WRLCK, TARGET_F_UNLCK, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 08/15] linux-user/syscall.c: Handle SH4's exceptional alignment for p{read, write}64, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 11/15] linux-user/s390x: Mask si_addr for SIGSEGV, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 07/15] linux-user: Handle TARGET_MAP_STACK and TARGET_MAP_HUGETLB, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 09/15] linux-user: fix 'finshed' typo in comment, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 10/15] linux-user: return EINVAL from prctl(PR_*_SECCOMP), riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 12/15] linux-user/ppc: Report correct fault address for data faults, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 13/15] linux-user/sparc: Put address for data faults where linux-user expects it, riku . voipio, 2017/11/20
- [Qemu-devel] [PULL 14/15] linux-user: Handle rt_sigaction correctly for SPARC,
riku . voipio <=
- [Qemu-devel] [PULL 15/15] linux-user: Fix calculation of auxv length, riku . voipio, 2017/11/20
- Re: [Qemu-devel] [PULL 00/15] late linux-user fixes for 2.11, no-reply, 2017/11/20
- Re: [Qemu-devel] [PULL 00/15] late linux-user fixes for 2.11, Peter Maydell, 2017/11/21
- Re: [Qemu-devel] [PULL 00/15] late linux-user fixes for 2.11, no-reply, 2017/11/21