MIPS: Support sending SIG_SYS to 32bit userspace from 64bit kernel
authorMatt Redfearn <[email protected]>
Tue, 29 Mar 2016 08:35:30 +0000 (09:35 +0100)
committerRalf Baechle <[email protected]>
Fri, 13 May 2016 12:02:00 +0000 (14:02 +0200)
The seccomp_bpf self test revealed that a 64bit kernel delivered an
invalid SIG_SYS to a 32bit userspace, because it was falling into the
default of the switch statement. Add a case to handle delivering the
signal.

With this patch, the seccomp_bpf self test now passes the TRAP.handler
case with O32 and N32 userlands.

Signed-off-by: Matt Redfearn <[email protected]>
Acked-by: Kees Cook <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Amanieu d'Antras <[email protected]>
Cc: Alex Smith <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/12915/
Signed-off-by: Ralf Baechle <[email protected]>
arch/mips/kernel/signal32.c

index 4909639aa35ba7fcb3de868c4c28ca92e8f7a54e..78c8349d151c88c48b15cf6dc5d00657cf8a6c9e 100644 (file)
@@ -227,6 +227,12 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
                        err |= __put_user(from->si_uid, &to->si_uid);
                        err |= __put_user(from->si_int, &to->si_int);
                        break;
+               case __SI_SYS >> 16:
+                       err |= __copy_to_user(&to->si_call_addr, &from->si_call_addr,
+                                             sizeof(compat_uptr_t));
+                       err |= __put_user(from->si_syscall, &to->si_syscall);
+                       err |= __put_user(from->si_arch, &to->si_arch);
+                       break;
                }
        }
        return err;