aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
commit9e2d59ad580d590134285f361a0e80f0e98c0207 (patch)
treef3232be75781484193413f32ec82c21f6d8eb76e
parent5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff)
parent235b80226b986dabcbba844968f7807866bd0bfe (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull signal handling cleanups from Al Viro: "This is the first pile; another one will come a bit later and will contain SYSCALL_DEFINE-related patches. - a bunch of signal-related syscalls (both native and compat) unified. - a bunch of compat syscalls switched to COMPAT_SYSCALL_DEFINE (fixing several potential problems with missing argument validation, while we are at it) - a lot of now-pointless wrappers killed - a couple of architectures (cris and hexagon) forgot to save altstack settings into sigframe, even though they used the (uninitialized) values in sigreturn; fixed. - microblaze fixes for delivery of multiple signals arriving at once - saner set of helpers for signal delivery introduced, several architectures switched to using those." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (143 commits) x86: convert to ksignal sparc: convert to ksignal arm: switch to struct ksignal * passing alpha: pass k_sigaction and siginfo_t using ksignal pointer burying unused conditionals make do_sigaltstack() static arm64: switch to generic old sigaction() (compat-only) arm64: switch to generic compat rt_sigaction() arm64: switch compat to generic old sigsuspend arm64: switch to generic compat rt_sigqueueinfo() arm64: switch to generic compat rt_sigpending() arm64: switch to generic compat rt_sigprocmask() arm64: switch to generic sigaltstack sparc: switch to generic old sigsuspend sparc: COMPAT_SYSCALL_DEFINE does all sign-extension as well as SYSCALL_DEFINE sparc: kill sign-extending wrappers for native syscalls kill sparc32_open() sparc: switch to use of generic old sigaction sparc: switch sys_compat_rt_sigaction() to COMPAT_SYSCALL_DEFINE mips: switch to generic sys_fork() and sys_clone() ...
-rw-r--r--arch/Kconfig29
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/include/asm/signal.h11
-rw-r--r--arch/alpha/include/asm/unistd.h1
-rw-r--r--arch/alpha/kernel/process.c1
-rw-r--r--arch/alpha/kernel/signal.c121
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/include/asm/signal.h18
-rw-r--r--arch/arm/include/asm/unistd.h2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/entry-common.S5
-rw-r--r--arch/arm/kernel/signal.c160
-rw-r--r--arch/arm64/Kconfig2
-rw-r--r--arch/arm64/include/asm/syscalls.h2
-rw-r--r--arch/arm64/include/asm/unistd.h2
-rw-r--r--arch/arm64/include/asm/unistd32.h4
-rw-r--r--arch/arm64/kernel/entry.S5
-rw-r--r--arch/arm64/kernel/signal.c17
-rw-r--r--arch/arm64/kernel/signal32.c220
-rw-r--r--arch/arm64/kernel/sys.c1
-rw-r--r--arch/arm64/kernel/sys32.S5
-rw-r--r--arch/avr32/include/asm/signal.h11
-rw-r--r--arch/avr32/include/asm/unistd.h2
-rw-r--r--arch/avr32/kernel/signal.c15
-rw-r--r--arch/avr32/kernel/syscall-stubs.S6
-rw-r--r--arch/avr32/kernel/syscall_table.S2
-rw-r--r--arch/blackfin/include/asm/unistd.h2
-rw-r--r--arch/blackfin/kernel/signal.c12
-rw-r--r--arch/c6x/kernel/entry.S12
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/cris/arch-v10/kernel/signal.c65
-rw-r--r--arch/cris/arch-v32/kernel/signal.c68
-rw-r--r--arch/cris/include/asm/signal.h19
-rw-r--r--arch/cris/include/asm/unistd.h2
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/frv/include/asm/signal.h7
-rw-r--r--arch/frv/include/asm/unistd.h2
-rw-r--r--arch/frv/kernel/signal.c55
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/h8300/include/asm/signal.h18
-rw-r--r--arch/h8300/include/asm/unistd.h2
-rw-r--r--arch/h8300/kernel/signal.c72
-rw-r--r--arch/h8300/kernel/syscalls.S15
-rw-r--r--arch/hexagon/kernel/signal.c16
-rw-r--r--arch/ia64/include/asm/signal.h10
-rw-r--r--arch/ia64/include/asm/unistd.h8
-rw-r--r--arch/ia64/kernel/signal.c19
-rw-r--r--arch/m32r/include/asm/signal.h11
-rw-r--r--arch/m32r/include/asm/unistd.h2
-rw-r--r--arch/m32r/kernel/signal.c16
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68k/include/asm/signal.h19
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/kernel/signal.c59
-rw-r--r--arch/microblaze/include/asm/unistd.h2
-rw-r--r--arch/microblaze/kernel/entry-nommu.S21
-rw-r--r--arch/microblaze/kernel/entry.S62
-rw-r--r--arch/microblaze/kernel/ptrace.c23
-rw-r--r--arch/microblaze/kernel/signal.c26
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/include/asm/compat.h8
-rw-r--r--arch/mips/include/asm/signal.h2
-rw-r--r--arch/mips/include/asm/sim.h24
-rw-r--r--arch/mips/include/asm/unistd.h3
-rw-r--r--arch/mips/include/uapi/asm/signal.h6
-rw-r--r--arch/mips/kernel/linux32.c44
-rw-r--r--arch/mips/kernel/process.c3
-rw-r--r--arch/mips/kernel/scall32-o32.S4
-rw-r--r--arch/mips/kernel/scall64-64.S4
-rw-r--r--arch/mips/kernel/scall64-n32.S20
-rw-r--r--arch/mips/kernel/scall64-o32.S22
-rw-r--r--arch/mips/kernel/signal.c48
-rw-r--r--arch/mips/kernel/signal32.c237
-rw-r--r--arch/mips/kernel/signal_n32.c59
-rw-r--r--arch/mips/kernel/syscall.c73
-rw-r--r--arch/mn10300/Kconfig2
-rw-r--r--arch/mn10300/include/asm/signal.h19
-rw-r--r--arch/mn10300/include/asm/unistd.h2
-rw-r--r--arch/mn10300/kernel/signal.c60
-rw-r--r--arch/openrisc/kernel/entry.S4
-rw-r--r--arch/openrisc/kernel/signal.c15
-rw-r--r--arch/parisc/include/asm/signal.h6
-rw-r--r--arch/parisc/include/asm/unistd.h3
-rw-r--r--arch/parisc/kernel/entry.S38
-rw-r--r--arch/parisc/kernel/signal.c19
-rw-r--r--arch/parisc/kernel/signal32.c149
-rw-r--r--arch/parisc/kernel/signal32.h23
-rw-r--r--arch/parisc/kernel/sys32.h12
-rw-r--r--arch/parisc/kernel/syscall_table.S8
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/include/asm/signal.h1
-rw-r--r--arch/powerpc/include/asm/syscalls.h15
-rw-r--r--arch/powerpc/include/asm/systbl.h63
-rw-r--r--arch/powerpc/include/asm/unistd.h4
-rw-r--r--arch/powerpc/include/uapi/asm/signal.h6
-rw-r--r--arch/powerpc/kernel/ppc32.h26
-rw-r--r--arch/powerpc/kernel/signal.c7
-rw-r--r--arch/powerpc/kernel/signal_32.c253
-rw-r--r--arch/powerpc/kernel/signal_64.c11
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c301
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/include/asm/signal.h19
-rw-r--r--arch/s390/include/asm/unistd.h3
-rw-r--r--arch/s390/kernel/compat_linux.c80
-rw-r--r--arch/s390/kernel/compat_linux.h34
-rw-r--r--arch/s390/kernel/compat_signal.c134
-rw-r--r--arch/s390/kernel/compat_wrapper.S144
-rw-r--r--arch/s390/kernel/entry.h4
-rw-r--r--arch/s390/kernel/signal.c56
-rw-r--r--arch/s390/kernel/syscalls.S46
-rw-r--r--arch/score/include/asm/syscalls.h1
-rw-r--r--arch/score/kernel/entry.S5
-rw-r--r--arch/score/kernel/signal.c21
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/include/asm/syscalls_32.h6
-rw-r--r--arch/sh/include/asm/unistd.h2
-rw-r--r--arch/sh/include/uapi/asm/signal.h2
-rw-r--r--arch/sh/kernel/signal_32.c63
-rw-r--r--arch/sh/kernel/signal_64.c62
-rw-r--r--arch/sparc/Kconfig4
-rw-r--r--arch/sparc/include/asm/compat_signal.h6
-rw-r--r--arch/sparc/include/asm/signal.h6
-rw-r--r--arch/sparc/include/asm/unistd.h3
-rw-r--r--arch/sparc/include/uapi/asm/signal.h2
-rw-r--r--arch/sparc/kernel/entry.S8
-rw-r--r--arch/sparc/kernel/signal32.c202
-rw-r--r--arch/sparc/kernel/signal_32.c175
-rw-r--r--arch/sparc/kernel/signal_64.c142
-rw-r--r--arch/sparc/kernel/sys32.S86
-rw-r--r--arch/sparc/kernel/sys_sparc32.c185
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c48
-rw-r--r--arch/sparc/kernel/syscalls.S6
-rw-r--r--arch/sparc/kernel/systbls.h4
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S84
-rw-r--r--arch/tile/include/asm/compat.h8
-rw-r--r--arch/tile/include/asm/syscalls.h2
-rw-r--r--arch/tile/include/asm/unistd.h1
-rw-r--r--arch/tile/kernel/compat_signal.c112
-rw-r--r--arch/tile/kernel/signal.c15
-rw-r--r--arch/um/kernel/signal.c10
-rw-r--r--arch/unicore32/kernel/entry.S5
-rw-r--r--arch/unicore32/kernel/signal.c12
-rw-r--r--arch/x86/Kconfig4
-rw-r--r--arch/x86/ia32/ia32_signal.c50
-rw-r--r--arch/x86/ia32/ia32entry.S12
-rw-r--r--arch/x86/ia32/sys_ia32.c171
-rw-r--r--arch/x86/include/asm/fpu-internal.h5
-rw-r--r--arch/x86/include/asm/ia32.h15
-rw-r--r--arch/x86/include/asm/signal.h22
-rw-r--r--arch/x86/include/asm/sys_ia32.h16
-rw-r--r--arch/x86/include/asm/syscalls.h13
-rw-r--r--arch/x86/include/asm/unistd.h2
-rw-r--r--arch/x86/include/uapi/asm/signal.h8
-rw-r--r--arch/x86/kernel/entry_32.S45
-rw-r--r--arch/x86/kernel/entry_64.S34
-rw-r--r--arch/x86/kernel/ioport.c3
-rw-r--r--arch/x86/kernel/signal.c184
-rw-r--r--arch/x86/kernel/vm86_32.c8
-rw-r--r--arch/x86/syscalls/syscall_32.tbl22
-rw-r--r--arch/x86/syscalls/syscall_64.tbl6
-rw-r--r--arch/x86/um/Kconfig3
-rw-r--r--arch/x86/um/Makefile4
-rw-r--r--arch/x86/um/shared/sysdep/syscalls_32.h5
-rw-r--r--arch/x86/um/signal.c15
-rw-r--r--arch/x86/um/sys_call_table_32.c4
-rw-r--r--arch/x86/um/syscalls_32.c38
-rw-r--r--arch/xtensa/include/asm/signal.h11
-rw-r--r--arch/xtensa/include/asm/syscall.h7
-rw-r--r--arch/xtensa/include/asm/unistd.h2
-rw-r--r--arch/xtensa/include/uapi/asm/unistd.h2
-rw-r--r--arch/xtensa/kernel/signal.c18
-rw-r--r--fs/compat.c52
-rw-r--r--fs/timerfd.c85
-rw-r--r--include/asm-generic/syscalls.h16
-rw-r--r--include/asm-generic/unistd.h3
-rw-r--r--include/linux/compat.h50
-rw-r--r--include/linux/sched.h12
-rw-r--r--include/linux/signal.h52
-rw-r--r--include/linux/syscalls.h25
-rw-r--r--include/uapi/asm-generic/signal.h10
-rw-r--r--include/uapi/asm-generic/unistd.h4
-rw-r--r--kernel/compat.c72
-rw-r--r--kernel/futex_compat.c19
-rw-r--r--kernel/signal.c332
185 files changed, 1363 insertions, 4825 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 97fb7d0365d1..40e2b12c7916 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -368,9 +368,6 @@ config MODULES_USE_ELF_REL
368 Modules only use ELF REL relocations. Modules with ELF RELA 368 Modules only use ELF REL relocations. Modules with ELF RELA
369 relocations will give an error. 369 relocations will give an error.
370 370
371config GENERIC_SIGALTSTACK
372 bool
373
374# 371#
375# ABI hall of shame 372# ABI hall of shame
376# 373#
@@ -385,4 +382,30 @@ config CLONE_BACKWARDS2
385 help 382 help
386 Architecture has the first two arguments of clone(2) swapped. 383 Architecture has the first two arguments of clone(2) swapped.
387 384
385config ODD_RT_SIGACTION
386 bool
387 help
388 Architecture has unusual rt_sigaction(2) arguments
389
390config OLD_SIGSUSPEND
391 bool
392 help
393 Architecture has old sigsuspend(2) syscall, of one-argument variety
394
395config OLD_SIGSUSPEND3
396 bool
397 help
398 Even weirder antique ABI - three-argument sigsuspend(2)
399
400config OLD_SIGACTION
401 bool
402 help
403 Architecture has old sigaction(2) syscall. Nope, not the same
404 as OLD_SIGSUSPEND | OLD_SIGSUSPEND3 - alpha has sigsuspend(2),
405 but fairly different variant of sigaction(2), thanks to OSF/1
406 compatibility...
407
408config COMPAT_OLD_SIGACTION
409 bool
410
388source "kernel/gcov/Kconfig" 411source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index dabc93649495..1ecbf7a1b677 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -21,7 +21,8 @@ config ALPHA
21 select GENERIC_STRNLEN_USER 21 select GENERIC_STRNLEN_USER
22 select HAVE_MOD_ARCH_SPECIFIC 22 select HAVE_MOD_ARCH_SPECIFIC
23 select MODULES_USE_ELF_RELA 23 select MODULES_USE_ELF_RELA
24 select GENERIC_SIGALTSTACK 24 select ODD_RT_SIGACTION
25 select OLD_SIGSUSPEND
25 help 26 help
26 The Alpha is a 64-bit general-purpose processor designed and 27 The Alpha is a 64-bit general-purpose processor designed and
27 marketed by the Digital Equipment Corporation of blessed memory, 28 marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/alpha/include/asm/signal.h b/arch/alpha/include/asm/signal.h
index 8a1ac28cd562..963f0494dca7 100644
--- a/arch/alpha/include/asm/signal.h
+++ b/arch/alpha/include/asm/signal.h
@@ -22,15 +22,6 @@ struct osf_sigaction {
22 int sa_flags; 22 int sa_flags;
23}; 23};
24 24
25struct sigaction { 25#define __ARCH_HAS_KA_RESTORER
26 __sighandler_t sa_handler;
27 unsigned long sa_flags;
28 sigset_t sa_mask; /* mask last for extensibility */
29};
30
31struct k_sigaction {
32 struct sigaction sa;
33 __sigrestore_t ka_restorer;
34};
35#include <asm/sigcontext.h> 26#include <asm/sigcontext.h>
36#endif 27#endif
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index b3396ee039b7..6d6fe7ab5473 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -14,7 +14,6 @@
14#define __ARCH_WANT_SYS_OLD_GETRLIMIT 14#define __ARCH_WANT_SYS_OLD_GETRLIMIT
15#define __ARCH_WANT_SYS_OLDUMOUNT 15#define __ARCH_WANT_SYS_OLDUMOUNT
16#define __ARCH_WANT_SYS_SIGPENDING 16#define __ARCH_WANT_SYS_SIGPENDING
17#define __ARCH_WANT_SYS_RT_SIGSUSPEND
18#define __ARCH_WANT_SYS_FORK 17#define __ARCH_WANT_SYS_FORK
19#define __ARCH_WANT_SYS_VFORK 18#define __ARCH_WANT_SYS_VFORK
20#define __ARCH_WANT_SYS_CLONE 19#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index b5d0d0923699..63d27fb9b023 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -250,7 +250,6 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
250 struct pt_regs *childregs = task_pt_regs(p); 250 struct pt_regs *childregs = task_pt_regs(p);
251 struct pt_regs *regs = current_pt_regs(); 251 struct pt_regs *regs = current_pt_regs();
252 struct switch_stack *childstack, *stack; 252 struct switch_stack *childstack, *stack;
253 unsigned long settls;
254 253
255 childstack = ((struct switch_stack *) childregs) - 1; 254 childstack = ((struct switch_stack *) childregs) - 1;
256 childti->pcb.ksp = (unsigned long) childstack; 255 childti->pcb.ksp = (unsigned long) childstack;
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index 02d02c047f17..6cec2881acbf 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -113,16 +113,6 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
113} 113}
114 114
115/* 115/*
116 * Atomically swap in the new signal mask, and wait for a signal.
117 */
118SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
119{
120 sigset_t blocked;
121 siginitset(&blocked, mask);
122 return sigsuspend(&blocked);
123}
124
125/*
126 * Do a signal return; undo the signal stack. 116 * Do a signal return; undo the signal stack.
127 */ 117 */
128 118
@@ -282,12 +272,9 @@ give_sigsegv:
282 */ 272 */
283 273
284static inline void __user * 274static inline void __user *
285get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) 275get_sigframe(struct ksignal *ksig, unsigned long sp, size_t frame_size)
286{ 276{
287 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp)) 277 return (void __user *)((sigsp(sp, ksig) - frame_size) & -32ul);
288 sp = current->sas_ss_sp + current->sas_ss_size;
289
290 return (void __user *)((sp - frame_size) & -32ul);
291} 278}
292 279
293static long 280static long
@@ -348,14 +335,13 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
348} 335}
349 336
350static int 337static int
351setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, 338setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
352 struct pt_regs *regs)
353{ 339{
354 unsigned long oldsp, r26, err = 0; 340 unsigned long oldsp, r26, err = 0;
355 struct sigframe __user *frame; 341 struct sigframe __user *frame;
356 342
357 oldsp = rdusp(); 343 oldsp = rdusp();
358 frame = get_sigframe(ka, oldsp, sizeof(*frame)); 344 frame = get_sigframe(ksig, oldsp, sizeof(*frame));
359 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 345 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
360 return -EFAULT; 346 return -EFAULT;
361 347
@@ -365,9 +351,8 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
365 351
366 /* Set up to return from userspace. If provided, use a stub 352 /* Set up to return from userspace. If provided, use a stub
367 already in userspace. */ 353 already in userspace. */
368 if (ka->ka_restorer) { 354 r26 = (unsigned long) ksig->ka.ka_restorer;
369 r26 = (unsigned long) ka->ka_restorer; 355 if (!r26) {
370 } else {
371 err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0); 356 err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0);
372 err |= __put_user(INSN_LDI_R0+__NR_sigreturn, frame->retcode+1); 357 err |= __put_user(INSN_LDI_R0+__NR_sigreturn, frame->retcode+1);
373 err |= __put_user(INSN_CALLSYS, frame->retcode+2); 358 err |= __put_user(INSN_CALLSYS, frame->retcode+2);
@@ -381,8 +366,8 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
381 366
382 /* "Return" to the handler */ 367 /* "Return" to the handler */
383 regs->r26 = r26; 368 regs->r26 = r26;
384 regs->r27 = regs->pc = (unsigned long) ka->sa.sa_handler; 369 regs->r27 = regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
385 regs->r16 = sig; /* a0: signal number */ 370 regs->r16 = ksig->sig; /* a0: signal number */
386 regs->r17 = 0; /* a1: exception code */ 371 regs->r17 = 0; /* a1: exception code */
387 regs->r18 = (unsigned long) &frame->sc; /* a2: sigcontext pointer */ 372 regs->r18 = (unsigned long) &frame->sc; /* a2: sigcontext pointer */
388 wrusp((unsigned long) frame); 373 wrusp((unsigned long) frame);
@@ -395,18 +380,17 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
395} 380}
396 381
397static int 382static int
398setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 383setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
399 sigset_t *set, struct pt_regs *regs)
400{ 384{
401 unsigned long oldsp, r26, err = 0; 385 unsigned long oldsp, r26, err = 0;
402 struct rt_sigframe __user *frame; 386 struct rt_sigframe __user *frame;
403 387
404 oldsp = rdusp(); 388 oldsp = rdusp();
405 frame = get_sigframe(ka, oldsp, sizeof(*frame)); 389 frame = get_sigframe(ksig, oldsp, sizeof(*frame));
406 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 390 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
407 return -EFAULT; 391 return -EFAULT;
408 392
409 err |= copy_siginfo_to_user(&frame->info, info); 393 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
410 394
411 /* Create the ucontext. */ 395 /* Create the ucontext. */
412 err |= __put_user(0, &frame->uc.uc_flags); 396 err |= __put_user(0, &frame->uc.uc_flags);
@@ -421,9 +405,8 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
421 405
422 /* Set up to return from userspace. If provided, use a stub 406 /* Set up to return from userspace. If provided, use a stub
423 already in userspace. */ 407 already in userspace. */
424 if (ka->ka_restorer) { 408 r26 = (unsigned long) ksig->ka.ka_restorer;
425 r26 = (unsigned long) ka->ka_restorer; 409 if (!r26) {
426 } else {
427 err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0); 410 err |= __put_user(INSN_MOV_R30_R16, frame->retcode+0);
428 err |= __put_user(INSN_LDI_R0+__NR_rt_sigreturn, 411 err |= __put_user(INSN_LDI_R0+__NR_rt_sigreturn,
429 frame->retcode+1); 412 frame->retcode+1);
@@ -437,8 +420,8 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
437 420
438 /* "Return" to the handler */ 421 /* "Return" to the handler */
439 regs->r26 = r26; 422 regs->r26 = r26;
440 regs->r27 = regs->pc = (unsigned long) ka->sa.sa_handler; 423 regs->r27 = regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
441 regs->r16 = sig; /* a0: signal number */ 424 regs->r16 = ksig->sig; /* a0: signal number */
442 regs->r17 = (unsigned long) &frame->info; /* a1: siginfo pointer */ 425 regs->r17 = (unsigned long) &frame->info; /* a1: siginfo pointer */
443 regs->r18 = (unsigned long) &frame->uc; /* a2: ucontext pointer */ 426 regs->r18 = (unsigned long) &frame->uc; /* a2: ucontext pointer */
444 wrusp((unsigned long) frame); 427 wrusp((unsigned long) frame);
@@ -456,22 +439,17 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
456 * OK, we're invoking a handler. 439 * OK, we're invoking a handler.
457 */ 440 */
458static inline void 441static inline void
459handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, 442handle_signal(struct ksignal *ksig, struct pt_regs *regs)
460 struct pt_regs * regs)
461{ 443{
462 sigset_t *oldset = sigmask_to_save(); 444 sigset_t *oldset = sigmask_to_save();
463 int ret; 445 int ret;
464 446
465 if (ka->sa.sa_flags & SA_SIGINFO) 447 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
466 ret = setup_rt_frame(sig, ka, info, oldset, regs); 448 ret = setup_rt_frame(ksig, oldset, regs);
467 else 449 else
468 ret = setup_frame(sig, ka, oldset, regs); 450 ret = setup_frame(ksig, oldset, regs);
469 451
470 if (ret) { 452 signal_setup_done(ret, ksig, 0);
471 force_sigsegv(sig, current);
472 return;
473 }
474 signal_delivered(sig, info, ka, regs, 0);
475} 453}
476 454
477static inline void 455static inline void
@@ -514,47 +492,38 @@ syscall_restart(unsigned long r0, unsigned long r19,
514static void 492static void
515do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19) 493do_signal(struct pt_regs *regs, unsigned long r0, unsigned long r19)
516{ 494{
517 siginfo_t info;
518 int signr;
519 unsigned long single_stepping = ptrace_cancel_bpt(current); 495 unsigned long single_stepping = ptrace_cancel_bpt(current);
520 struct k_sigaction ka; 496 struct ksignal ksig;
521 497
522 /* This lets the debugger run, ... */ 498 /* This lets the debugger run, ... */
523 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 499 if (get_signal(&ksig)) {
524 500 /* ... so re-check the single stepping. */
525 /* ... so re-check the single stepping. */ 501 single_stepping |= ptrace_cancel_bpt(current);
526 single_stepping |= ptrace_cancel_bpt(current);
527
528 if (signr > 0) {
529 /* Whee! Actually deliver the signal. */ 502 /* Whee! Actually deliver the signal. */
530 if (r0) 503 if (r0)
531 syscall_restart(r0, r19, regs, &ka); 504 syscall_restart(r0, r19, regs, &ksig.ka);
532 handle_signal(signr, &ka, &info, regs); 505 handle_signal(&ksig, regs);
533 if (single_stepping) 506 } else {
534 ptrace_set_bpt(current); /* re-set bpt */ 507 single_stepping |= ptrace_cancel_bpt(current);
535 return; 508 if (r0) {
536 } 509 switch (regs->r0) {
537 510 case ERESTARTNOHAND:
538 if (r0) { 511 case ERESTARTSYS:
539 switch (regs->r0) { 512 case ERESTARTNOINTR:
540 case ERESTARTNOHAND: 513 /* Reset v0 and a3 and replay syscall. */
541 case ERESTARTSYS: 514 regs->r0 = r0;
542 case ERESTARTNOINTR: 515 regs->r19 = r19;
543 /* Reset v0 and a3 and replay syscall. */ 516 regs->pc -= 4;
544 regs->r0 = r0; 517 break;
545 regs->r19 = r19; 518 case ERESTART_RESTARTBLOCK:
546 regs->pc -= 4; 519 /* Set v0 to the restart_syscall and replay */
547 break; 520 regs->r0 = __NR_restart_syscall;
548 case ERESTART_RESTARTBLOCK: 521 regs->pc -= 4;
549 /* Force v0 to the restart syscall and reply. */ 522 break;
550 regs->r0 = __NR_restart_syscall; 523 }
551 regs->pc -= 4;
552 break;
553 } 524 }
525 restore_saved_sigmask();
554 } 526 }
555
556 /* If there's no signal to deliver, we just restore the saved mask. */
557 restore_saved_sigmask();
558 if (single_stepping) 527 if (single_stepping)
559 ptrace_set_bpt(current); /* re-set breakpoint */ 528 ptrace_set_bpt(current); /* re-set breakpoint */
560} 529}
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 38ec1f8df5a8..a955d89ed836 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -56,6 +56,8 @@ config ARM
56 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND 56 select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND
57 select MODULES_USE_ELF_REL 57 select MODULES_USE_ELF_REL
58 select CLONE_BACKWARDS 58 select CLONE_BACKWARDS
59 select OLD_SIGSUSPEND3
60 select OLD_SIGACTION
59 help 61 help
60 The ARM series is a line of low-power-consumption RISC chip designs 62 The ARM series is a line of low-power-consumption RISC chip designs
61 licensed by ARM Ltd and targeted at embedded applications and 63 licensed by ARM Ltd and targeted at embedded applications and
diff --git a/arch/arm/include/asm/signal.h b/arch/arm/include/asm/signal.h
index 9a0ea6ab988f..c0eb412aff04 100644
--- a/arch/arm/include/asm/signal.h
+++ b/arch/arm/include/asm/signal.h
@@ -16,23 +16,7 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct old_sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 __sigrestore_t sa_restorer;
24};
25
26struct sigaction {
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 __sigrestore_t sa_restorer;
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36 20
37#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
38#endif 22#endif
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 21a2700d2957..e4ddfb39ca34 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -26,8 +26,6 @@
26#define __ARCH_WANT_SYS_NICE 26#define __ARCH_WANT_SYS_NICE
27#define __ARCH_WANT_SYS_SIGPENDING 27#define __ARCH_WANT_SYS_SIGPENDING
28#define __ARCH_WANT_SYS_SIGPROCMASK 28#define __ARCH_WANT_SYS_SIGPROCMASK
29#define __ARCH_WANT_SYS_RT_SIGACTION
30#define __ARCH_WANT_SYS_RT_SIGSUSPEND
31#define __ARCH_WANT_SYS_OLD_MMAP 29#define __ARCH_WANT_SYS_OLD_MMAP
32#define __ARCH_WANT_SYS_OLD_SELECT 30#define __ARCH_WANT_SYS_OLD_SELECT
33 31
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index a4fda4e7a372..0cc57611fc4f 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -195,7 +195,7 @@
195 CALL(sys_getcwd) 195 CALL(sys_getcwd)
196 CALL(sys_capget) 196 CALL(sys_capget)
197/* 185 */ CALL(sys_capset) 197/* 185 */ CALL(sys_capset)
198 CALL(sys_sigaltstack_wrapper) 198 CALL(sys_sigaltstack)
199 CALL(sys_sendfile) 199 CALL(sys_sendfile)
200 CALL(sys_ni_syscall) /* getpmsg */ 200 CALL(sys_ni_syscall) /* getpmsg */
201 CALL(sys_ni_syscall) /* putpmsg */ 201 CALL(sys_ni_syscall) /* putpmsg */
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index a6c301e90a3b..3248cde504ed 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -514,11 +514,6 @@ sys_rt_sigreturn_wrapper:
514 b sys_rt_sigreturn 514 b sys_rt_sigreturn
515ENDPROC(sys_rt_sigreturn_wrapper) 515ENDPROC(sys_rt_sigreturn_wrapper)
516 516
517sys_sigaltstack_wrapper:
518 ldr r2, [sp, #S_OFF + S_SP]
519 b do_sigaltstack
520ENDPROC(sys_sigaltstack_wrapper)
521
522sys_statfs64_wrapper: 517sys_statfs64_wrapper:
523 teq r1, #88 518 teq r1, #88
524 moveq r1, #84 519 moveq r1, #84
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 56f72d257ebd..296786bdbb73 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -45,48 +45,6 @@ const unsigned long sigreturn_codes[7] = {
45 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, 45 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
46}; 46};
47 47
48/*
49 * atomically swap in the new signal mask, and wait for a signal.
50 */
51asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask)
52{
53 sigset_t blocked;
54 siginitset(&blocked, mask);
55 return sigsuspend(&blocked);
56}
57
58asmlinkage int
59sys_sigaction(int sig, const struct old_sigaction __user *act,
60 struct old_sigaction __user *oact)
61{
62 struct k_sigaction new_ka, old_ka;
63 int ret;
64
65 if (act) {
66 old_sigset_t mask;
67 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
68 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
69 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
70 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
71 __get_user(mask, &act->sa_mask))
72 return -EFAULT;
73 siginitset(&new_ka.sa.sa_mask, mask);
74 }
75
76 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
77
78 if (!ret && oact) {
79 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
80 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
81 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
82 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
83 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
84 return -EFAULT;
85 }
86
87 return ret;
88}
89
90#ifdef CONFIG_CRUNCH 48#ifdef CONFIG_CRUNCH
91static int preserve_crunch_context(struct crunch_sigframe __user *frame) 49static int preserve_crunch_context(struct crunch_sigframe __user *frame)
92{ 50{
@@ -300,7 +258,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
300 if (restore_sigframe(regs, &frame->sig)) 258 if (restore_sigframe(regs, &frame->sig))
301 goto badframe; 259 goto badframe;
302 260
303 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT) 261 if (restore_altstack(&frame->sig.uc.uc_stack))
304 goto badframe; 262 goto badframe;
305 263
306 return regs->ARM_r0; 264 return regs->ARM_r0;
@@ -360,18 +318,12 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
360} 318}
361 319
362static inline void __user * 320static inline void __user *
363get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize) 321get_sigframe(struct ksignal *ksig, struct pt_regs *regs, int framesize)
364{ 322{
365 unsigned long sp = regs->ARM_sp; 323 unsigned long sp = sigsp(regs->ARM_sp, ksig);
366 void __user *frame; 324 void __user *frame;
367 325
368 /* 326 /*
369 * This is the X/Open sanctioned signal stack switching.
370 */
371 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
372 sp = current->sas_ss_sp + current->sas_ss_size;
373
374 /*
375 * ATPCS B01 mandates 8-byte alignment 327 * ATPCS B01 mandates 8-byte alignment
376 */ 328 */
377 frame = (void __user *)((sp - framesize) & ~7); 329 frame = (void __user *)((sp - framesize) & ~7);
@@ -385,11 +337,22 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
385 return frame; 337 return frame;
386} 338}
387 339
340/*
341 * translate the signal
342 */
343static inline int map_sig(int sig)
344{
345 struct thread_info *thread = current_thread_info();
346 if (sig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
347 sig = thread->exec_domain->signal_invmap[sig];
348 return sig;
349}
350
388static int 351static int
389setup_return(struct pt_regs *regs, struct k_sigaction *ka, 352setup_return(struct pt_regs *regs, struct ksignal *ksig,
390 unsigned long __user *rc, void __user *frame, int usig) 353 unsigned long __user *rc, void __user *frame)
391{ 354{
392 unsigned long handler = (unsigned long)ka->sa.sa_handler; 355 unsigned long handler = (unsigned long)ksig->ka.sa.sa_handler;
393 unsigned long retcode; 356 unsigned long retcode;
394 int thumb = 0; 357 int thumb = 0;
395 unsigned long cpsr = regs->ARM_cpsr & ~(PSR_f | PSR_E_BIT); 358 unsigned long cpsr = regs->ARM_cpsr & ~(PSR_f | PSR_E_BIT);
@@ -399,7 +362,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
399 /* 362 /*
400 * Maybe we need to deliver a 32-bit signal to a 26-bit task. 363 * Maybe we need to deliver a 32-bit signal to a 26-bit task.
401 */ 364 */
402 if (ka->sa.sa_flags & SA_THIRTYTWO) 365 if (ksig->ka.sa.sa_flags & SA_THIRTYTWO)
403 cpsr = (cpsr & ~MODE_MASK) | USR_MODE; 366 cpsr = (cpsr & ~MODE_MASK) | USR_MODE;
404 367
405#ifdef CONFIG_ARM_THUMB 368#ifdef CONFIG_ARM_THUMB
@@ -421,12 +384,12 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
421 } 384 }
422#endif 385#endif
423 386
424 if (ka->sa.sa_flags & SA_RESTORER) { 387 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
425 retcode = (unsigned long)ka->sa.sa_restorer; 388 retcode = (unsigned long)ksig->ka.sa.sa_restorer;
426 } else { 389 } else {
427 unsigned int idx = thumb << 1; 390 unsigned int idx = thumb << 1;
428 391
429 if (ka->sa.sa_flags & SA_SIGINFO) 392 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
430 idx += 3; 393 idx += 3;
431 394
432 if (__put_user(sigreturn_codes[idx], rc) || 395 if (__put_user(sigreturn_codes[idx], rc) ||
@@ -451,7 +414,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
451 } 414 }
452 } 415 }
453 416
454 regs->ARM_r0 = usig; 417 regs->ARM_r0 = map_sig(ksig->sig);
455 regs->ARM_sp = (unsigned long)frame; 418 regs->ARM_sp = (unsigned long)frame;
456 regs->ARM_lr = retcode; 419 regs->ARM_lr = retcode;
457 regs->ARM_pc = handler; 420 regs->ARM_pc = handler;
@@ -461,9 +424,9 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
461} 424}
462 425
463static int 426static int
464setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *regs) 427setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
465{ 428{
466 struct sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); 429 struct sigframe __user *frame = get_sigframe(ksig, regs, sizeof(*frame));
467 int err = 0; 430 int err = 0;
468 431
469 if (!frame) 432 if (!frame)
@@ -476,36 +439,29 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg
476 439
477 err |= setup_sigframe(frame, regs, set); 440 err |= setup_sigframe(frame, regs, set);
478 if (err == 0) 441 if (err == 0)
479 err = setup_return(regs, ka, frame->retcode, frame, usig); 442 err = setup_return(regs, ksig, frame->retcode, frame);
480 443
481 return err; 444 return err;
482} 445}
483 446
484static int 447static int
485setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, 448setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
486 sigset_t *set, struct pt_regs *regs)
487{ 449{
488 struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); 450 struct rt_sigframe __user *frame = get_sigframe(ksig, regs, sizeof(*frame));
489 stack_t stack;
490 int err = 0; 451 int err = 0;
491 452
492 if (!frame) 453 if (!frame)
493 return 1; 454 return 1;
494 455
495 err |= copy_siginfo_to_user(&frame->info, info); 456 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
496 457
497 __put_user_error(0, &frame->sig.uc.uc_flags, err); 458 __put_user_error(0, &frame->sig.uc.uc_flags, err);
498 __put_user_error(NULL, &frame->sig.uc.uc_link, err); 459 __put_user_error(NULL, &frame->sig.uc.uc_link, err);
499 460
500 memset(&stack, 0, sizeof(stack)); 461 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->ARM_sp);
501 stack.ss_sp = (void __user *)current->sas_ss_sp;
502 stack.ss_flags = sas_ss_flags(regs->ARM_sp);
503 stack.ss_size = current->sas_ss_size;
504 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack));
505
506 err |= setup_sigframe(&frame->sig, regs, set); 462 err |= setup_sigframe(&frame->sig, regs, set);
507 if (err == 0) 463 if (err == 0)
508 err = setup_return(regs, ka, frame->sig.retcode, frame, usig); 464 err = setup_return(regs, ksig, frame->sig.retcode, frame);
509 465
510 if (err == 0) { 466 if (err == 0) {
511 /* 467 /*
@@ -523,40 +479,25 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
523/* 479/*
524 * OK, we're invoking a handler 480 * OK, we're invoking a handler
525 */ 481 */
526static void 482static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
527handle_signal(unsigned long sig, struct k_sigaction *ka,
528 siginfo_t *info, struct pt_regs *regs)
529{ 483{
530 struct thread_info *thread = current_thread_info();
531 struct task_struct *tsk = current;
532 sigset_t *oldset = sigmask_to_save(); 484 sigset_t *oldset = sigmask_to_save();
533 int usig = sig;
534 int ret; 485 int ret;
535 486
536 /* 487 /*
537 * translate the signal
538 */
539 if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
540 usig = thread->exec_domain->signal_invmap[usig];
541
542 /*
543 * Set up the stack frame 488 * Set up the stack frame
544 */ 489 */
545 if (ka->sa.sa_flags & SA_SIGINFO) 490 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
546 ret = setup_rt_frame(usig, ka, info, oldset, regs); 491 ret = setup_rt_frame(ksig, oldset, regs);
547 else 492 else
548 ret = setup_frame(usig, ka, oldset, regs); 493 ret = setup_frame(ksig, oldset, regs);
549 494
550 /* 495 /*
551 * Check that the resulting registers are actually sane. 496 * Check that the resulting registers are actually sane.
552 */ 497 */
553 ret |= !valid_user_regs(regs); 498 ret |= !valid_user_regs(regs);
554 499
555 if (ret != 0) { 500 signal_setup_done(ret, ksig, 0);
556 force_sigsegv(sig, tsk);
557 return;
558 }
559 signal_delivered(sig, info, ka, regs, 0);
560} 501}
561 502
562/* 503/*
@@ -571,9 +512,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
571static int do_signal(struct pt_regs *regs, int syscall) 512static int do_signal(struct pt_regs *regs, int syscall)
572{ 513{
573 unsigned int retval = 0, continue_addr = 0, restart_addr = 0; 514 unsigned int retval = 0, continue_addr = 0, restart_addr = 0;
574 struct k_sigaction ka; 515 struct ksignal ksig;
575 siginfo_t info;
576 int signr;
577 int restart = 0; 516 int restart = 0;
578 517
579 /* 518 /*
@@ -605,33 +544,32 @@ static int do_signal(struct pt_regs *regs, int syscall)
605 * Get the signal to deliver. When running under ptrace, at this 544 * Get the signal to deliver. When running under ptrace, at this
606 * point the debugger may change all our registers ... 545 * point the debugger may change all our registers ...
607 */ 546 */
608 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
609 /* 547 /*
610 * Depending on the signal settings we may need to revert the 548 * Depending on the signal settings we may need to revert the
611 * decision to restart the system call. But skip this if a 549 * decision to restart the system call. But skip this if a
612 * debugger has chosen to restart at a different PC. 550 * debugger has chosen to restart at a different PC.
613 */ 551 */
614 if (regs->ARM_pc != restart_addr) 552 if (get_signal(&ksig)) {
615 restart = 0; 553 /* handler */
616 if (signr > 0) { 554 if (unlikely(restart) && regs->ARM_pc == restart_addr) {
617 if (unlikely(restart)) {
618 if (retval == -ERESTARTNOHAND || 555 if (retval == -ERESTARTNOHAND ||
619 retval == -ERESTART_RESTARTBLOCK 556 retval == -ERESTART_RESTARTBLOCK
620 || (retval == -ERESTARTSYS 557 || (retval == -ERESTARTSYS
621 && !(ka.sa.sa_flags & SA_RESTART))) { 558 && !(ksig.ka.sa.sa_flags & SA_RESTART))) {
622 regs->ARM_r0 = -EINTR; 559 regs->ARM_r0 = -EINTR;
623 regs->ARM_pc = continue_addr; 560 regs->ARM_pc = continue_addr;
624 } 561 }
625 } 562 }
626 563 handle_signal(&ksig, regs);
627 handle_signal(signr, &ka, &info, regs); 564 } else {
628 return 0; 565 /* no handler */
566 restore_saved_sigmask();
567 if (unlikely(restart) && regs->ARM_pc == restart_addr) {
568 regs->ARM_pc = continue_addr;
569 return restart;
570 }
629 } 571 }
630 572 return 0;
631 restore_saved_sigmask();
632 if (unlikely(restart))
633 regs->ARM_pc = continue_addr;
634 return restart;
635} 573}
636 574
637asmlinkage int 575asmlinkage int
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ab4aa54b36ef..f532ce5f3c5b 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -205,6 +205,8 @@ config COMPAT
205 depends on !ARM64_64K_PAGES 205 depends on !ARM64_64K_PAGES
206 select COMPAT_BINFMT_ELF 206 select COMPAT_BINFMT_ELF
207 select HAVE_UID16 207 select HAVE_UID16
208 select OLD_SIGSUSPEND3
209 select COMPAT_OLD_SIGACTION
208 help 210 help
209 This option enables support for a 32-bit EL0 running under a 64-bit 211 This option enables support for a 32-bit EL0 running under a 64-bit
210 kernel at EL1. AArch32-specific components such as system calls, 212 kernel at EL1. AArch32-specific components such as system calls,
diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h
index 20d63b290665..48fe7c600e98 100644
--- a/arch/arm64/include/asm/syscalls.h
+++ b/arch/arm64/include/asm/syscalls.h
@@ -24,8 +24,6 @@
24 * System call wrappers implemented in kernel/entry.S. 24 * System call wrappers implemented in kernel/entry.S.
25 */ 25 */
26asmlinkage long sys_rt_sigreturn_wrapper(void); 26asmlinkage long sys_rt_sigreturn_wrapper(void);
27asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss,
28 stack_t __user *uoss);
29 27
30#include <asm-generic/syscalls.h> 28#include <asm-generic/syscalls.h>
31 29
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 744087fb521c..82ce217e94cf 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -20,10 +20,8 @@
20#define __ARCH_WANT_SYS_GETPGRP 20#define __ARCH_WANT_SYS_GETPGRP
21#define __ARCH_WANT_SYS_LLSEEK 21#define __ARCH_WANT_SYS_LLSEEK
22#define __ARCH_WANT_SYS_NICE 22#define __ARCH_WANT_SYS_NICE
23#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
24#define __ARCH_WANT_SYS_SIGPENDING 23#define __ARCH_WANT_SYS_SIGPENDING
25#define __ARCH_WANT_SYS_SIGPROCMASK 24#define __ARCH_WANT_SYS_SIGPROCMASK
26#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
27#define __ARCH_WANT_COMPAT_SYS_SENDFILE 25#define __ARCH_WANT_COMPAT_SYS_SENDFILE
28#define __ARCH_WANT_SYS_FORK 26#define __ARCH_WANT_SYS_FORK
29#define __ARCH_WANT_SYS_VFORK 27#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 5ef47ba3ed45..e60e386178d1 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -93,7 +93,7 @@ __SYSCALL(68, sys_ni_syscall) /* 68 was sys_sgetmask */
93__SYSCALL(69, sys_ni_syscall) /* 69 was sys_ssetmask */ 93__SYSCALL(69, sys_ni_syscall) /* 69 was sys_ssetmask */
94__SYSCALL(70, sys_setreuid16) 94__SYSCALL(70, sys_setreuid16)
95__SYSCALL(71, sys_setregid16) 95__SYSCALL(71, sys_setregid16)
96__SYSCALL(72, compat_sys_sigsuspend) 96__SYSCALL(72, sys_sigsuspend)
97__SYSCALL(73, compat_sys_sigpending) 97__SYSCALL(73, compat_sys_sigpending)
98__SYSCALL(74, sys_sethostname) 98__SYSCALL(74, sys_sethostname)
99__SYSCALL(75, compat_sys_setrlimit) 99__SYSCALL(75, compat_sys_setrlimit)
@@ -207,7 +207,7 @@ __SYSCALL(182, sys_chown16)
207__SYSCALL(183, sys_getcwd) 207__SYSCALL(183, sys_getcwd)
208__SYSCALL(184, sys_capget) 208__SYSCALL(184, sys_capget)
209__SYSCALL(185, sys_capset) 209__SYSCALL(185, sys_capset)
210__SYSCALL(186, compat_sys_sigaltstack_wrapper) 210__SYSCALL(186, compat_sys_sigaltstack)
211__SYSCALL(187, compat_sys_sendfile) 211__SYSCALL(187, compat_sys_sendfile)
212__SYSCALL(188, sys_ni_syscall) /* 188 reserved */ 212__SYSCALL(188, sys_ni_syscall) /* 188 reserved */
213__SYSCALL(189, sys_ni_syscall) /* 189 reserved */ 213__SYSCALL(189, sys_ni_syscall) /* 189 reserved */
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 9c94f404ded6..514d6098dbee 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -677,10 +677,5 @@ ENTRY(sys_rt_sigreturn_wrapper)
677 b sys_rt_sigreturn 677 b sys_rt_sigreturn
678ENDPROC(sys_rt_sigreturn_wrapper) 678ENDPROC(sys_rt_sigreturn_wrapper)
679 679
680ENTRY(sys_sigaltstack_wrapper)
681 ldr x2, [sp, #S_SP]
682 b sys_sigaltstack
683ENDPROC(sys_sigaltstack_wrapper)
684
685ENTRY(handle_arch_irq) 680ENTRY(handle_arch_irq)
686 .quad 0 681 .quad 0
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index abd756315cb5..890a591f75dd 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -149,8 +149,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
149 if (restore_sigframe(regs, frame)) 149 if (restore_sigframe(regs, frame))
150 goto badframe; 150 goto badframe;
151 151
152 if (do_sigaltstack(&frame->uc.uc_stack, 152 if (restore_altstack(&frame->uc.uc_stack))
153 NULL, regs->sp) == -EFAULT)
154 goto badframe; 153 goto badframe;
155 154
156 return regs->regs[0]; 155 return regs->regs[0];
@@ -164,12 +163,6 @@ badframe:
164 return 0; 163 return 0;
165} 164}
166 165
167asmlinkage long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
168 unsigned long sp)
169{
170 return do_sigaltstack(uss, uoss, sp);
171}
172
173static int setup_sigframe(struct rt_sigframe __user *sf, 166static int setup_sigframe(struct rt_sigframe __user *sf,
174 struct pt_regs *regs, sigset_t *set) 167 struct pt_regs *regs, sigset_t *set)
175{ 168{
@@ -250,7 +243,6 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
250 sigset_t *set, struct pt_regs *regs) 243 sigset_t *set, struct pt_regs *regs)
251{ 244{
252 struct rt_sigframe __user *frame; 245 struct rt_sigframe __user *frame;
253 stack_t stack;
254 int err = 0; 246 int err = 0;
255 247
256 frame = get_sigframe(ka, regs); 248 frame = get_sigframe(ka, regs);
@@ -260,12 +252,7 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
260 __put_user_error(0, &frame->uc.uc_flags, err); 252 __put_user_error(0, &frame->uc.uc_flags, err);
261 __put_user_error(NULL, &frame->uc.uc_link, err); 253 __put_user_error(NULL, &frame->uc.uc_link, err);
262 254
263 memset(&stack, 0, sizeof(stack)); 255 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
264 stack.ss_sp = (void __user *)current->sas_ss_sp;
265 stack.ss_flags = sas_ss_flags(regs->sp);
266 stack.ss_size = current->sas_ss_size;
267 err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack));
268
269 err |= setup_sigframe(frame, regs, set); 256 err |= setup_sigframe(frame, regs, set);
270 if (err == 0) { 257 if (err == 0) {
271 setup_return(regs, ka, frame, usig); 258 setup_return(regs, ka, frame, usig);
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index 41db148a7eb9..7f4f3673f2bc 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -28,26 +28,6 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/unistd32.h> 29#include <asm/unistd32.h>
30 30
31struct compat_sigaction {
32 compat_uptr_t sa_handler;
33 compat_ulong_t sa_flags;
34 compat_uptr_t sa_restorer;
35 compat_sigset_t sa_mask;
36};
37
38struct compat_old_sigaction {
39 compat_uptr_t sa_handler;
40 compat_old_sigset_t sa_mask;
41 compat_ulong_t sa_flags;
42 compat_uptr_t sa_restorer;
43};
44
45typedef struct compat_sigaltstack {
46 compat_uptr_t ss_sp;
47 int ss_flags;
48 compat_size_t ss_size;
49} compat_stack_t;
50
51struct compat_sigcontext { 31struct compat_sigcontext {
52 /* We always set these two fields to 0 */ 32 /* We always set these two fields to 0 */
53 compat_ulong_t trap_no; 33 compat_ulong_t trap_no;
@@ -339,127 +319,6 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame)
339 return err ? -EFAULT : 0; 319 return err ? -EFAULT : 0;
340} 320}
341 321
342/*
343 * atomically swap in the new signal mask, and wait for a signal.
344 */
345asmlinkage int compat_sys_sigsuspend(int restart, compat_ulong_t oldmask,
346 compat_old_sigset_t mask)
347{
348 sigset_t blocked;
349
350 siginitset(&current->blocked, mask);
351 return sigsuspend(&blocked);
352}
353
354asmlinkage int compat_sys_sigaction(int sig,
355 const struct compat_old_sigaction __user *act,
356 struct compat_old_sigaction __user *oact)
357{
358 struct k_sigaction new_ka, old_ka;
359 int ret;
360 compat_old_sigset_t mask;
361 compat_uptr_t handler, restorer;
362
363 if (act) {
364 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
365 __get_user(handler, &act->sa_handler) ||
366 __get_user(restorer, &act->sa_restorer) ||
367 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
368 __get_user(mask, &act->sa_mask))
369 return -EFAULT;
370
371 new_ka.sa.sa_handler = compat_ptr(handler);
372 new_ka.sa.sa_restorer = compat_ptr(restorer);
373 siginitset(&new_ka.sa.sa_mask, mask);
374 }
375
376 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
377
378 if (!ret && oact) {
379 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
380 __put_user(ptr_to_compat(old_ka.sa.sa_handler),
381 &oact->sa_handler) ||
382 __put_user(ptr_to_compat(old_ka.sa.sa_restorer),
383 &oact->sa_restorer) ||
384 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
385 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
386 return -EFAULT;
387 }
388
389 return ret;
390}
391
392asmlinkage int compat_sys_rt_sigaction(int sig,
393 const struct compat_sigaction __user *act,
394 struct compat_sigaction __user *oact,
395 compat_size_t sigsetsize)
396{
397 struct k_sigaction new_ka, old_ka;
398 int ret;
399
400 /* XXX: Don't preclude handling different sized sigset_t's. */
401 if (sigsetsize != sizeof(compat_sigset_t))
402 return -EINVAL;
403
404 if (act) {
405 compat_uptr_t handler, restorer;
406
407 ret = get_user(handler, &act->sa_handler);
408 new_ka.sa.sa_handler = compat_ptr(handler);
409 ret |= get_user(restorer, &act->sa_restorer);
410 new_ka.sa.sa_restorer = compat_ptr(restorer);
411 ret |= get_sigset_t(&new_ka.sa.sa_mask, &act->sa_mask);
412 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
413 if (ret)
414 return -EFAULT;
415 }
416
417 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
418 if (!ret && oact) {
419 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), &oact->sa_handler);
420 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
421 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
422 }
423 return ret;
424}
425
426int compat_do_sigaltstack(compat_uptr_t compat_uss, compat_uptr_t compat_uoss,
427 compat_ulong_t sp)
428{
429 compat_stack_t __user *newstack = compat_ptr(compat_uss);
430 compat_stack_t __user *oldstack = compat_ptr(compat_uoss);
431 compat_uptr_t ss_sp;
432 int ret;
433 mm_segment_t old_fs;
434 stack_t uss, uoss;
435
436 /* Marshall the compat new stack into a stack_t */
437 if (newstack) {
438 if (get_user(ss_sp, &newstack->ss_sp) ||
439 __get_user(uss.ss_flags, &newstack->ss_flags) ||
440 __get_user(uss.ss_size, &newstack->ss_size))
441 return -EFAULT;
442 uss.ss_sp = compat_ptr(ss_sp);
443 }
444
445 old_fs = get_fs();
446 set_fs(KERNEL_DS);
447 /* The __user pointer casts are valid because of the set_fs() */
448 ret = do_sigaltstack(
449 newstack ? (stack_t __user *) &uss : NULL,
450 oldstack ? (stack_t __user *) &uoss : NULL,
451 (unsigned long)sp);
452 set_fs(old_fs);
453
454 /* Convert the old stack_t into a compat stack. */
455 if (!ret && oldstack &&
456 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
457 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
458 __put_user(uoss.ss_size, &oldstack->ss_size)))
459 return -EFAULT;
460 return ret;
461}
462
463static int compat_restore_sigframe(struct pt_regs *regs, 322static int compat_restore_sigframe(struct pt_regs *regs,
464 struct compat_sigframe __user *sf) 323 struct compat_sigframe __user *sf)
465{ 324{
@@ -562,9 +421,7 @@ asmlinkage int compat_sys_rt_sigreturn(struct pt_regs *regs)
562 if (compat_restore_sigframe(regs, &frame->sig)) 421 if (compat_restore_sigframe(regs, &frame->sig))
563 goto badframe; 422 goto badframe;
564 423
565 if (compat_do_sigaltstack(ptr_to_compat(&frame->sig.uc.uc_stack), 424 if (compat_restore_altstack(&frame->sig.uc.uc_stack))
566 ptr_to_compat((void __user *)NULL),
567 regs->compat_sp) == -EFAULT)
568 goto badframe; 425 goto badframe;
569 426
570 return regs->regs[0]; 427 return regs->regs[0];
@@ -705,11 +562,7 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
705 __put_user_error(0, &frame->sig.uc.uc_flags, err); 562 __put_user_error(0, &frame->sig.uc.uc_flags, err);
706 __put_user_error(0, &frame->sig.uc.uc_link, err); 563 __put_user_error(0, &frame->sig.uc.uc_link, err);
707 564
708 memset(&stack, 0, sizeof(stack)); 565 err |= __compat_save_altstack(&frame->sig.uc.uc_stack, regs->compat_sp);
709 stack.ss_sp = (compat_uptr_t)current->sas_ss_sp;
710 stack.ss_flags = sas_ss_flags(regs->compat_sp);
711 stack.ss_size = current->sas_ss_size;
712 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack));
713 566
714 err |= compat_setup_sigframe(&frame->sig, regs, set); 567 err |= compat_setup_sigframe(&frame->sig, regs, set);
715 568
@@ -742,75 +595,6 @@ int compat_setup_frame(int usig, struct k_sigaction *ka, sigset_t *set,
742 return err; 595 return err;
743} 596}
744 597
745/*
746 * RT signals don't have generic compat wrappers.
747 * See arch/powerpc/kernel/signal_32.c
748 */
749asmlinkage int compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
750 compat_sigset_t __user *oset,
751 compat_size_t sigsetsize)
752{
753 sigset_t s;
754 sigset_t __user *up;
755 int ret;
756 mm_segment_t old_fs = get_fs();
757
758 if (set) {
759 if (get_sigset_t(&s, set))
760 return -EFAULT;
761 }
762
763 set_fs(KERNEL_DS);
764 /* This is valid because of the set_fs() */
765 up = (sigset_t __user *) &s;
766 ret = sys_rt_sigprocmask(how, set ? up : NULL, oset ? up : NULL,
767 sigsetsize);
768 set_fs(old_fs);
769 if (ret)
770 return ret;
771 if (oset) {
772 if (put_sigset_t(oset, &s))
773 return -EFAULT;
774 }
775 return 0;
776}
777
778asmlinkage int compat_sys_rt_sigpending(compat_sigset_t __user *set,
779 compat_size_t sigsetsize)
780{
781 sigset_t s;
782 int ret;
783 mm_segment_t old_fs = get_fs();
784
785 set_fs(KERNEL_DS);
786 /* The __user pointer cast is valid because of the set_fs() */
787 ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
788 set_fs(old_fs);
789 if (!ret) {
790 if (put_sigset_t(set, &s))
791 return -EFAULT;
792 }
793 return ret;
794}
795
796asmlinkage int compat_sys_rt_sigqueueinfo(int pid, int sig,
797 compat_siginfo_t __user *uinfo)
798{
799 siginfo_t info;
800 int ret;
801 mm_segment_t old_fs = get_fs();
802
803 ret = copy_siginfo_from_user32(&info, uinfo);
804 if (unlikely(ret))
805 return ret;
806
807 set_fs (KERNEL_DS);
808 /* The __user pointer cast is valid because of the set_fs() */
809 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
810 set_fs (old_fs);
811 return ret;
812}
813
814void compat_setup_restart_syscall(struct pt_regs *regs) 598void compat_setup_restart_syscall(struct pt_regs *regs)
815{ 599{
816 regs->regs[7] = __NR_compat_restart_syscall; 600 regs->regs[7] = __NR_compat_restart_syscall;
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 8292a9b090f8..3fa98ff14f0e 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -40,7 +40,6 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
40 * Wrappers to pass the pt_regs argument. 40 * Wrappers to pass the pt_regs argument.
41 */ 41 */
42#define sys_rt_sigreturn sys_rt_sigreturn_wrapper 42#define sys_rt_sigreturn sys_rt_sigreturn_wrapper
43#define sys_sigaltstack sys_sigaltstack_wrapper
44 43
45#include <asm/syscalls.h> 44#include <asm/syscalls.h>
46 45
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S
index 7ef59e9245ef..6abb05721614 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/sys32.S
@@ -39,11 +39,6 @@ compat_sys_rt_sigreturn_wrapper:
39 b compat_sys_rt_sigreturn 39 b compat_sys_rt_sigreturn
40ENDPROC(compat_sys_rt_sigreturn_wrapper) 40ENDPROC(compat_sys_rt_sigreturn_wrapper)
41 41
42compat_sys_sigaltstack_wrapper:
43 ldr x2, [sp, #S_COMPAT_SP]
44 b compat_do_sigaltstack
45ENDPROC(compat_sys_sigaltstack_wrapper)
46
47compat_sys_statfs64_wrapper: 42compat_sys_statfs64_wrapper:
48 mov w3, #84 43 mov w3, #84
49 cmp w1, #88 44 cmp w1, #88
diff --git a/arch/avr32/include/asm/signal.h b/arch/avr32/include/asm/signal.h
index 9326d182e9e5..d875eb6a3f3c 100644
--- a/arch/avr32/include/asm/signal.h
+++ b/arch/avr32/include/asm/signal.h
@@ -23,16 +23,7 @@ typedef struct {
23 unsigned long sig[_NSIG_WORDS]; 23 unsigned long sig[_NSIG_WORDS];
24} sigset_t; 24} sigset_t;
25 25
26struct sigaction { 26#define __ARCH_HAS_SA_RESTORER
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 __sigrestore_t sa_restorer;
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36 27
37#include <asm/sigcontext.h> 28#include <asm/sigcontext.h>
38#undef __HAVE_ARCH_SIG_BITOPS 29#undef __HAVE_ARCH_SIG_BITOPS
diff --git a/arch/avr32/include/asm/unistd.h b/arch/avr32/include/asm/unistd.h
index 0bdf6371574e..dc4d5a931112 100644
--- a/arch/avr32/include/asm/unistd.h
+++ b/arch/avr32/include/asm/unistd.h
@@ -37,8 +37,6 @@
37#define __ARCH_WANT_SYS_GETPGRP 37#define __ARCH_WANT_SYS_GETPGRP
38#define __ARCH_WANT_SYS_LLSEEK 38#define __ARCH_WANT_SYS_LLSEEK
39#define __ARCH_WANT_SYS_GETPGRP 39#define __ARCH_WANT_SYS_GETPGRP
40#define __ARCH_WANT_SYS_RT_SIGACTION
41#define __ARCH_WANT_SYS_RT_SIGSUSPEND
42#define __ARCH_WANT_SYS_FORK 40#define __ARCH_WANT_SYS_FORK
43#define __ARCH_WANT_SYS_VFORK 41#define __ARCH_WANT_SYS_VFORK
44#define __ARCH_WANT_SYS_CLONE 42#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c
index 5e01c3a40ced..b80c0b3d2bab 100644
--- a/arch/avr32/kernel/signal.c
+++ b/arch/avr32/kernel/signal.c
@@ -21,12 +21,6 @@
21#include <asm/ucontext.h> 21#include <asm/ucontext.h>
22#include <asm/syscalls.h> 22#include <asm/syscalls.h>
23 23
24asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
25 struct pt_regs *regs)
26{
27 return do_sigaltstack(uss, uoss, regs->sp);
28}
29
30struct rt_sigframe 24struct rt_sigframe
31{ 25{
32 struct siginfo info; 26 struct siginfo info;
@@ -91,7 +85,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
91 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 85 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
92 goto badframe; 86 goto badframe;
93 87
94 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT) 88 if (restore_altstack(&frame->uc.uc_stack))
95 goto badframe; 89 goto badframe;
96 90
97 pr_debug("Context restored: pc = %08lx, lr = %08lx, sp = %08lx\n", 91 pr_debug("Context restored: pc = %08lx, lr = %08lx, sp = %08lx\n",
@@ -175,12 +169,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
175 /* Set up the ucontext */ 169 /* Set up the ucontext */
176 err |= __put_user(0, &frame->uc.uc_flags); 170 err |= __put_user(0, &frame->uc.uc_flags);
177 err |= __put_user(NULL, &frame->uc.uc_link); 171 err |= __put_user(NULL, &frame->uc.uc_link);
178 err |= __put_user((void __user *)current->sas_ss_sp, 172 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
179 &frame->uc.uc_stack.ss_sp);
180 err |= __put_user(sas_ss_flags(regs->sp),
181 &frame->uc.uc_stack.ss_flags);
182 err |= __put_user(current->sas_ss_size,
183 &frame->uc.uc_stack.ss_size);
184 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); 173 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs);
185 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 174 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
186 175
diff --git a/arch/avr32/kernel/syscall-stubs.S b/arch/avr32/kernel/syscall-stubs.S
index 275aab9731fd..b5fc927cd398 100644
--- a/arch/avr32/kernel/syscall-stubs.S
+++ b/arch/avr32/kernel/syscall-stubs.S
@@ -20,12 +20,6 @@ __sys_rt_sigsuspend:
20 mov r10, sp 20 mov r10, sp
21 rjmp sys_rt_sigsuspend 21 rjmp sys_rt_sigsuspend
22 22
23 .global __sys_sigaltstack
24 .type __sys_sigaltstack,@function
25__sys_sigaltstack:
26 mov r10, sp
27 rjmp sys_sigaltstack
28
29 .global __sys_rt_sigreturn 23 .global __sys_rt_sigreturn
30 .type __sys_rt_sigreturn,@function 24 .type __sys_rt_sigreturn,@function
31__sys_rt_sigreturn: 25__sys_rt_sigreturn:
diff --git a/arch/avr32/kernel/syscall_table.S b/arch/avr32/kernel/syscall_table.S
index f27bb878da6b..017a904180c8 100644
--- a/arch/avr32/kernel/syscall_table.S
+++ b/arch/avr32/kernel/syscall_table.S
@@ -115,7 +115,7 @@ sys_call_table:
115 .long sys_statfs 115 .long sys_statfs
116 .long sys_fstatfs /* 100 */ 116 .long sys_fstatfs /* 100 */
117 .long sys_vhangup 117 .long sys_vhangup
118 .long __sys_sigaltstack 118 .long sys_sigaltstack
119 .long sys_syslog 119 .long sys_syslog
120 .long sys_setitimer 120 .long sys_setitimer
121 .long sys_getitimer /* 105 */ 121 .long sys_getitimer /* 105 */
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index e943cb130048..04e83ea8d5cc 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -18,8 +18,6 @@
18#define __ARCH_WANT_SYS_GETPGRP 18#define __ARCH_WANT_SYS_GETPGRP
19#define __ARCH_WANT_SYS_LLSEEK 19#define __ARCH_WANT_SYS_LLSEEK
20#define __ARCH_WANT_SYS_NICE 20#define __ARCH_WANT_SYS_NICE
21#define __ARCH_WANT_SYS_RT_SIGACTION
22#define __ARCH_WANT_SYS_RT_SIGSUSPEND
23#define __ARCH_WANT_SYS_VFORK 21#define __ARCH_WANT_SYS_VFORK
24 22
25/* 23/*
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index 84b4be05840c..b022af6c48f8 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -37,11 +37,6 @@ struct rt_sigframe {
37 struct ucontext uc; 37 struct ucontext uc;
38}; 38};
39 39
40asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
41{
42 return do_sigaltstack(uss, uoss, rdusp());
43}
44
45static inline int 40static inline int
46rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *pr0) 41rt_restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *pr0)
47{ 42{
@@ -100,7 +95,7 @@ asmlinkage int sys_rt_sigreturn(void)
100 if (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) 95 if (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
101 goto badframe; 96 goto badframe;
102 97
103 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->usp) == -EFAULT) 98 if (restore_altstack(&frame->uc.uc_stack))
104 goto badframe; 99 goto badframe;
105 100
106 return r0; 101 return r0;
@@ -178,10 +173,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info,
178 /* Create the ucontext. */ 173 /* Create the ucontext. */
179 err |= __put_user(0, &frame->uc.uc_flags); 174 err |= __put_user(0, &frame->uc.uc_flags);
180 err |= __put_user(0, &frame->uc.uc_link); 175 err |= __put_user(0, &frame->uc.uc_link);
181 err |= 176 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
182 __put_user((void *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
183 err |= __put_user(sas_ss_flags(rdusp()), &frame->uc.uc_stack.ss_flags);
184 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
185 err |= rt_setup_sigcontext(&frame->uc.uc_mcontext, regs); 177 err |= rt_setup_sigcontext(&frame->uc.uc_mcontext, regs);
186 err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 178 err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
187 179
diff --git a/arch/c6x/kernel/entry.S b/arch/c6x/kernel/entry.S
index 5239057de4c4..2721c90b0121 100644
--- a/arch/c6x/kernel/entry.S
+++ b/arch/c6x/kernel/entry.S
@@ -598,18 +598,6 @@ ENTRY(enable_exception)
598 NOP 5 598 NOP 5
599ENDPROC(enable_exception) 599ENDPROC(enable_exception)
600 600
601ENTRY(sys_sigaltstack)
602#ifdef CONFIG_C6X_BIG_KERNEL
603 MVKL .S1 do_sigaltstack,A0 ; branch to do_sigaltstack
604 MVKH .S1 do_sigaltstack,A0
605 B .S2X A0
606#else
607 B .S2 do_sigaltstack
608#endif
609 LDW .D2T1 *+SP(REGS_SP+8),A6
610 NOP 4
611ENDPROC(sys_sigaltstack)
612
613 ;; 601 ;;
614 ;; Special system calls 602 ;; Special system calls
615 ;; return address is in B3 603 ;; return address is in B3
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index c59a01dd9c0c..0e5c187ac7d2 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -50,6 +50,8 @@ config CRIS
50 select GENERIC_CMOS_UPDATE 50 select GENERIC_CMOS_UPDATE
51 select MODULES_USE_ELF_RELA 51 select MODULES_USE_ELF_RELA
52 select CLONE_BACKWARDS2 52 select CLONE_BACKWARDS2
53 select OLD_SIGSUSPEND
54 select OLD_SIGACTION
53 55
54config HZ 56config HZ
55 int 57 int
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 0bb477c13a4e..61ce6273a895 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -42,55 +42,6 @@
42void do_signal(int canrestart, struct pt_regs *regs); 42void do_signal(int canrestart, struct pt_regs *regs);
43 43
44/* 44/*
45 * Atomically swap in the new signal mask, and wait for a signal. Define
46 * dummy arguments to be able to reach the regs argument. (Note that this
47 * arrangement relies on old_sigset_t occupying one register.)
48 */
49int sys_sigsuspend(old_sigset_t mask)
50{
51 sigset_t blocked;
52 siginitset(&blocked, mask);
53 return sigsuspend(&blocked);
54}
55
56int sys_sigaction(int sig, const struct old_sigaction __user *act,
57 struct old_sigaction *oact)
58{
59 struct k_sigaction new_ka, old_ka;
60 int ret;
61
62 if (act) {
63 old_sigset_t mask;
64 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
65 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
66 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
67 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
68 __get_user(mask, &act->sa_mask))
69 return -EFAULT;
70 siginitset(&new_ka.sa.sa_mask, mask);
71 }
72
73 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
74
75 if (!ret && oact) {
76 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
77 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
78 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
79 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
80 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
81 return -EFAULT;
82 }
83
84 return ret;
85}
86
87int sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
88{
89 return do_sigaltstack(uss, uoss, rdusp());
90}
91
92
93/*
94 * Do a signal return; undo the signal stack. 45 * Do a signal return; undo the signal stack.
95 */ 46 */
96 47
@@ -150,11 +101,9 @@ badframe:
150 return 1; 101 return 1;
151} 102}
152 103
153/* Define dummy arguments to be able to reach the regs argument. */ 104asmlinkage int sys_sigreturn(void)
154
155asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
156 long srp, struct pt_regs *regs)
157{ 105{
106 struct pt_regs *regs = current_pt_regs();
158 struct sigframe __user *frame = (struct sigframe *)rdusp(); 107 struct sigframe __user *frame = (struct sigframe *)rdusp();
159 sigset_t set; 108 sigset_t set;
160 109
@@ -188,11 +137,9 @@ badframe:
188 return 0; 137 return 0;
189} 138}
190 139
191/* Define dummy arguments to be able to reach the regs argument. */ 140asmlinkage int sys_rt_sigreturn(void)
192
193asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
194 long mof, long srp, struct pt_regs *regs)
195{ 141{
142 struct pt_regs *regs = current_pt_regs();
196 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp(); 143 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp();
197 sigset_t set; 144 sigset_t set;
198 145
@@ -214,7 +161,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
214 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 161 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
215 goto badframe; 162 goto badframe;
216 163
217 if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT) 164 if (restore_altstack(&frame->uc.uc_stack))
218 goto badframe; 165 goto badframe;
219 166
220 return regs->r10; 167 return regs->r10;
@@ -362,6 +309,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
362 309
363 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 310 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
364 311
312 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
313
365 if (err) 314 if (err)
366 goto give_sigsegv; 315 goto give_sigsegv;
367 316
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index b60d1b65a426..01d1375c9004 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -51,59 +51,6 @@ struct rt_signal_frame {
51void do_signal(int restart, struct pt_regs *regs); 51void do_signal(int restart, struct pt_regs *regs);
52void keep_debug_flags(unsigned long oldccs, unsigned long oldspc, 52void keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
53 struct pt_regs *regs); 53 struct pt_regs *regs);
54/*
55 * Swap in the new signal mask, and wait for a signal. Define some
56 * dummy arguments to be able to reach the regs argument.
57 */
58int
59sys_sigsuspend(old_sigset_t mask)
60{
61 sigset_t blocked;
62 siginitset(&blocked, mask);
63 return sigsuspend(&blocked);
64}
65
66int
67sys_sigaction(int signal, const struct old_sigaction *act,
68 struct old_sigaction *oact)
69{
70 int retval;
71 struct k_sigaction newk;
72 struct k_sigaction oldk;
73
74 if (act) {
75 old_sigset_t mask;
76
77 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
78 __get_user(newk.sa.sa_handler, &act->sa_handler) ||
79 __get_user(newk.sa.sa_restorer, &act->sa_restorer) ||
80 __get_user(newk.sa.sa_flags, &act->sa_flags) ||
81 __get_user(mask, &act->sa_mask))
82 return -EFAULT;
83
84 siginitset(&newk.sa.sa_mask, mask);
85 }
86
87 retval = do_sigaction(signal, act ? &newk : NULL, oact ? &oldk : NULL);
88
89 if (!retval && oact) {
90 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
91 __put_user(oldk.sa.sa_handler, &oact->sa_handler) ||
92 __put_user(oldk.sa.sa_restorer, &oact->sa_restorer) ||
93 __put_user(oldk.sa.sa_flags, &oact->sa_flags) ||
94 __put_user(oldk.sa.sa_mask.sig[0], &oact->sa_mask))
95 return -EFAULT;
96
97 }
98
99 return retval;
100}
101
102int
103sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
104{
105 return do_sigaltstack(uss, uoss, rdusp());
106}
107 54
108static int 55static int
109restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 56restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
@@ -135,11 +82,9 @@ badframe:
135 return 1; 82 return 1;
136} 83}
137 84
138/* Define some dummy arguments to be able to reach the regs argument. */ 85asmlinkage int sys_sigreturn(void)
139asmlinkage int
140sys_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
141 struct pt_regs *regs)
142{ 86{
87 struct pt_regs *regs = current_pt_regs();
143 sigset_t set; 88 sigset_t set;
144 struct signal_frame __user *frame; 89 struct signal_frame __user *frame;
145 unsigned long oldspc = regs->spc; 90 unsigned long oldspc = regs->spc;
@@ -178,11 +123,9 @@ badframe:
178 return 0; 123 return 0;
179} 124}
180 125
181/* Define some dummy variables to be able to reach the regs argument. */ 126asmlinkage int sys_rt_sigreturn(void)
182asmlinkage int
183sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
184 struct pt_regs *regs)
185{ 127{
128 struct pt_regs *regs = current_pt_regs();
186 sigset_t set; 129 sigset_t set;
187 struct rt_signal_frame __user *frame; 130 struct rt_signal_frame __user *frame;
188 unsigned long oldspc = regs->spc; 131 unsigned long oldspc = regs->spc;
@@ -209,7 +152,7 @@ sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
209 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 152 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
210 goto badframe; 153 goto badframe;
211 154
212 if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT) 155 if (restore_altstack(&frame->uc.uc_stack))
213 goto badframe; 156 goto badframe;
214 157
215 keep_debug_flags(oldccs, oldspc, regs); 158 keep_debug_flags(oldccs, oldspc, regs);
@@ -371,6 +314,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
371 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 314 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
372 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 315 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
373 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 316 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
317 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
374 318
375 if (err) 319 if (err)
376 goto give_sigsegv; 320 goto give_sigsegv;
diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h
index c0cb1fd4644c..c11b8745cece 100644
--- a/arch/cris/include/asm/signal.h
+++ b/arch/cris/include/asm/signal.h
@@ -16,23 +16,8 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct old_sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler; 20
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 void (*sa_restorer)(void);
24};
25
26struct sigaction {
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 void (*sa_restorer)(void);
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
37 22
38#endif 23#endif
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 6d062bdf92d4..be57a988bfb9 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -30,8 +30,6 @@
30#define __ARCH_WANT_SYS_OLDUMOUNT 30#define __ARCH_WANT_SYS_OLDUMOUNT
31#define __ARCH_WANT_SYS_SIGPENDING 31#define __ARCH_WANT_SYS_SIGPENDING
32#define __ARCH_WANT_SYS_SIGPROCMASK 32#define __ARCH_WANT_SYS_SIGPROCMASK
33#define __ARCH_WANT_SYS_RT_SIGACTION
34#define __ARCH_WANT_SYS_RT_SIGSUSPEND
35#define __ARCH_WANT_SYS_FORK 33#define __ARCH_WANT_SYS_FORK
36#define __ARCH_WANT_SYS_VFORK 34#define __ARCH_WANT_SYS_VFORK
37#define __ARCH_WANT_SYS_CLONE 35#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 17df48fc8f44..2d0509d4cfee 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -11,6 +11,8 @@ config FRV
11 select ARCH_HAVE_NMI_SAFE_CMPXCHG 11 select ARCH_HAVE_NMI_SAFE_CMPXCHG
12 select GENERIC_CPU_DEVICES 12 select GENERIC_CPU_DEVICES
13 select ARCH_WANT_IPC_PARSE_VERSION 13 select ARCH_WANT_IPC_PARSE_VERSION
14 select OLD_SIGSUSPEND3
15 select OLD_SIGACTION
14 16
15config ZONE_DMA 17config ZONE_DMA
16 bool 18 bool
diff --git a/arch/frv/include/asm/signal.h b/arch/frv/include/asm/signal.h
index 599500a31025..eca0abcb79d6 100644
--- a/arch/frv/include/asm/signal.h
+++ b/arch/frv/include/asm/signal.h
@@ -3,11 +3,4 @@
3 3
4#include <uapi/asm/signal.h> 4#include <uapi/asm/signal.h>
5 5
6struct old_sigaction {
7 __sighandler_t sa_handler;
8 old_sigset_t sa_mask;
9 unsigned long sa_flags;
10 __sigrestore_t sa_restorer;
11};
12
13#endif /* _ASM_SIGNAL_H */ 6#endif /* _ASM_SIGNAL_H */
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index d685da17f5fb..4cfcc7bba25a 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -27,8 +27,6 @@
27#define __ARCH_WANT_SYS_OLDUMOUNT 27#define __ARCH_WANT_SYS_OLDUMOUNT
28/* #define __ARCH_WANT_SYS_SIGPENDING */ 28/* #define __ARCH_WANT_SYS_SIGPENDING */
29#define __ARCH_WANT_SYS_SIGPROCMASK 29#define __ARCH_WANT_SYS_SIGPROCMASK
30#define __ARCH_WANT_SYS_RT_SIGACTION
31#define __ARCH_WANT_SYS_RT_SIGSUSPEND
32#define __ARCH_WANT_SYS_FORK 30#define __ARCH_WANT_SYS_FORK
33#define __ARCH_WANT_SYS_VFORK 31#define __ARCH_WANT_SYS_VFORK
34#define __ARCH_WANT_SYS_CLONE 32#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index 535810a3217a..d822700d4f15 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -33,55 +33,6 @@ struct fdpic_func_descriptor {
33}; 33};
34 34
35/* 35/*
36 * Atomically swap in the new signal mask, and wait for a signal.
37 */
38asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask)
39{
40 sigset_t blocked;
41 siginitset(&blocked, mask);
42 return sigsuspend(&blocked);
43}
44
45asmlinkage int sys_sigaction(int sig,
46 const struct old_sigaction __user *act,
47 struct old_sigaction __user *oact)
48{
49 struct k_sigaction new_ka, old_ka;
50 int ret;
51
52 if (act) {
53 old_sigset_t mask;
54 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
55 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
56 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
57 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
58 __get_user(mask, &act->sa_mask))
59 return -EFAULT;
60 siginitset(&new_ka.sa.sa_mask, mask);
61 }
62
63 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
64
65 if (!ret && oact) {
66 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
67 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
68 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
69 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
70 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
71 return -EFAULT;
72 }
73
74 return ret;
75}
76
77asmlinkage
78int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
79{
80 return do_sigaltstack(uss, uoss, __frame->sp);
81}
82
83
84/*
85 * Do a signal return; undo the signal stack. 36 * Do a signal return; undo the signal stack.
86 */ 37 */
87 38
@@ -173,7 +124,7 @@ asmlinkage int sys_rt_sigreturn(void)
173 if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) 124 if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8))
174 goto badframe; 125 goto badframe;
175 126
176 if (do_sigaltstack(&frame->uc.uc_stack, NULL, __frame->sp) == -EFAULT) 127 if (restore_altstack(&frame->uc.uc_stack))
177 goto badframe; 128 goto badframe;
178 129
179 return gr8; 130 return gr8;
@@ -345,9 +296,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
345 /* Create the ucontext. */ 296 /* Create the ucontext. */
346 if (__put_user(0, &frame->uc.uc_flags) || 297 if (__put_user(0, &frame->uc.uc_flags) ||
347 __put_user(NULL, &frame->uc.uc_link) || 298 __put_user(NULL, &frame->uc.uc_link) ||
348 __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) || 299 __save_altstack(&frame->uc.uc_stack, __frame->sp))
349 __put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) ||
350 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size))
351 goto give_sigsegv; 300 goto give_sigsegv;
352 301
353 if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0])) 302 if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0]))
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 2d2efb653ee0..05b613af223a 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -9,6 +9,8 @@ config H8300
9 select GENERIC_IRQ_SHOW 9 select GENERIC_IRQ_SHOW
10 select GENERIC_CPU_DEVICES 10 select GENERIC_CPU_DEVICES
11 select MODULES_USE_ELF_RELA 11 select MODULES_USE_ELF_RELA
12 select OLD_SIGSUSPEND3
13 select OLD_SIGACTION
12 14
13config SYMBOL_PREFIX 15config SYMBOL_PREFIX
14 string 16 string
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h
index 66c81c67e55d..6341e36386f8 100644
--- a/arch/h8300/include/asm/signal.h
+++ b/arch/h8300/include/asm/signal.h
@@ -16,23 +16,7 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct old_sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 void (*sa_restorer)(void);
24};
25
26struct sigaction {
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 void (*sa_restorer)(void);
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36 20
37#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
38#undef __HAVE_ARCH_SIG_BITOPS 22#undef __HAVE_ARCH_SIG_BITOPS
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index aa38105959fb..6721856d841b 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -29,8 +29,6 @@
29#define __ARCH_WANT_SYS_OLDUMOUNT 29#define __ARCH_WANT_SYS_OLDUMOUNT
30#define __ARCH_WANT_SYS_SIGPENDING 30#define __ARCH_WANT_SYS_SIGPENDING
31#define __ARCH_WANT_SYS_SIGPROCMASK 31#define __ARCH_WANT_SYS_SIGPROCMASK
32#define __ARCH_WANT_SYS_RT_SIGACTION
33#define __ARCH_WANT_SYS_RT_SIGSUSPEND
34#define __ARCH_WANT_SYS_FORK 32#define __ARCH_WANT_SYS_FORK
35#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
36#define __ARCH_WANT_SYS_CLONE 34#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index 0e81b96c642f..a65ff3b76326 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -47,56 +47,6 @@
47#include <asm/ucontext.h> 47#include <asm/ucontext.h>
48 48
49/* 49/*
50 * Atomically swap in the new signal mask, and wait for a signal.
51 */
52asmlinkage int
53sys_sigsuspend(int unused1, int unused2, old_sigset_t mask)
54{
55 sigset_t blocked;
56 siginitset(&blocked, mask);
57 return sigsuspend(&blocked);
58}
59
60asmlinkage int
61sys_sigaction(int sig, const struct old_sigaction *act,
62 struct old_sigaction *oact)
63{
64 struct k_sigaction new_ka, old_ka;
65 int ret;
66
67 if (act) {
68 old_sigset_t mask;
69 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
70 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
71 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
72 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
73 __get_user(mask, &act->sa_mask))
74 return -EFAULT;
75 siginitset(&new_ka.sa.sa_mask, mask);
76 }
77
78 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
79
80 if (!ret && oact) {
81 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
82 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
83 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
84 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
85 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
86 return -EFAULT;
87 }
88
89 return ret;
90}
91
92asmlinkage int
93sys_sigaltstack(const stack_t *uss, stack_t *uoss)
94{
95 return do_sigaltstack(uss, uoss, rdusp());
96}
97
98
99/*
100 * Do a signal return; undo the signal stack. 50 * Do a signal return; undo the signal stack.
101 * 51 *
102 * Keep the return code on the stack quadword aligned! 52 * Keep the return code on the stack quadword aligned!
@@ -136,9 +86,9 @@ struct rt_sigframe
136} __attribute__((aligned(2),packed)); 86} __attribute__((aligned(2),packed));
137 87
138static inline int 88static inline int
139restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, 89restore_sigcontext(struct sigcontext *usc, int *pd0)
140 int *pd0)
141{ 90{
91 struct pt_regs *regs = current_pt_regs();
142 int err = 0; 92 int err = 0;
143 unsigned int ccr; 93 unsigned int ccr;
144 unsigned int usp; 94 unsigned int usp;
@@ -167,9 +117,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc,
167 return err; 117 return err;
168} 118}
169 119
170asmlinkage int do_sigreturn(unsigned long __unused,...) 120asmlinkage int sys_sigreturn(void)
171{ 121{
172 struct pt_regs *regs = (struct pt_regs *) (&__unused - 1);
173 unsigned long usp = rdusp(); 122 unsigned long usp = rdusp();
174 struct sigframe *frame = (struct sigframe *)(usp - 4); 123 struct sigframe *frame = (struct sigframe *)(usp - 4);
175 sigset_t set; 124 sigset_t set;
@@ -185,7 +134,7 @@ asmlinkage int do_sigreturn(unsigned long __unused,...)
185 134
186 set_current_blocked(&set); 135 set_current_blocked(&set);
187 136
188 if (restore_sigcontext(regs, &frame->sc, &er0)) 137 if (restore_sigcontext(&frame->sc, &er0))
189 goto badframe; 138 goto badframe;
190 return er0; 139 return er0;
191 140
@@ -194,9 +143,8 @@ badframe:
194 return 0; 143 return 0;
195} 144}
196 145
197asmlinkage int do_rt_sigreturn(unsigned long __unused,...) 146asmlinkage int sys_rt_sigreturn(void)
198{ 147{
199 struct pt_regs *regs = (struct pt_regs *) &__unused;
200 unsigned long usp = rdusp(); 148 unsigned long usp = rdusp();
201 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 149 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
202 sigset_t set; 150 sigset_t set;
@@ -209,10 +157,10 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...)
209 157
210 set_current_blocked(&set); 158 set_current_blocked(&set);
211 159
212 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0)) 160 if (restore_sigcontext(&frame->uc.uc_mcontext, &er0))
213 goto badframe; 161 goto badframe;
214 162
215 if (do_sigaltstack(&frame->uc.uc_stack, NULL, usp) == -EFAULT) 163 if (restore_altstack(&frame->uc.uc_stack))
216 goto badframe; 164 goto badframe;
217 165
218 return er0; 166 return er0;
@@ -358,11 +306,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
358 /* Create the ucontext. */ 306 /* Create the ucontext. */
359 err |= __put_user(0, &frame->uc.uc_flags); 307 err |= __put_user(0, &frame->uc.uc_flags);
360 err |= __put_user(0, &frame->uc.uc_link); 308 err |= __put_user(0, &frame->uc.uc_link);
361 err |= __put_user((void *)current->sas_ss_sp, 309 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
362 &frame->uc.uc_stack.ss_sp);
363 err |= __put_user(sas_ss_flags(rdusp()),
364 &frame->uc.uc_stack.ss_flags);
365 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
366 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 310 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
367 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); 311 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
368 if (err) 312 if (err)
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index b74dd0ade58d..5c2168fb9b9e 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -334,18 +334,3 @@ SYMBOL_NAME_LABEL(sys_call_table)
334 .long SYMBOL_NAME(sys_getcpu) 334 .long SYMBOL_NAME(sys_getcpu)
335 .long SYMBOL_NAME(sys_ni_syscall) /* sys_epoll_pwait */ 335 .long SYMBOL_NAME(sys_ni_syscall) /* sys_epoll_pwait */
336 .long SYMBOL_NAME(sys_setns) /* 320 */ 336 .long SYMBOL_NAME(sys_setns) /* 320 */
337
338 .macro call_sp addr
339 mov.l #SYMBOL_NAME(\addr),er6
340 bra SYMBOL_NAME(syscall_trampoline):8
341 .endm
342
343SYMBOL_NAME_LABEL(sys_sigreturn)
344 call_sp do_sigreturn
345
346SYMBOL_NAME_LABEL(sys_rt_sigreturn)
347 call_sp do_rt_sigreturn
348
349SYMBOL_NAME_LABEL(syscall_trampoline)
350 mov.l sp,er0
351 jmp @er6
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index fe0d1373165d..60fa2ca3202b 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -125,6 +125,7 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
125 err |= __put_user(0x5400c004, &frame->tramp[1]); 125 err |= __put_user(0x5400c004, &frame->tramp[1]);
126 err |= setup_sigcontext(regs, &frame->uc.uc_mcontext); 126 err |= setup_sigcontext(regs, &frame->uc.uc_mcontext);
127 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 127 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
128 err |= __save_altstack(&frame->uc.uc_stack, user_stack_pointer(regs));
128 if (err) 129 if (err)
129 goto sigsegv; 130 goto sigsegv;
130 131
@@ -247,12 +248,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
247/* 248/*
248 * Architecture-specific wrappers for signal-related system calls 249 * Architecture-specific wrappers for signal-related system calls
249 */ 250 */
250asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
251{
252 struct pt_regs *regs = current_pt_regs();
253
254 return do_sigaltstack(uss, uoss, regs->r29);
255}
256 251
257asmlinkage int sys_rt_sigreturn(void) 252asmlinkage int sys_rt_sigreturn(void)
258{ 253{
@@ -288,14 +283,7 @@ asmlinkage int sys_rt_sigreturn(void)
288 */ 283 */
289 regs->syscall_nr = __NR_rt_sigreturn; 284 regs->syscall_nr = __NR_rt_sigreturn;
290 285
291 /* 286 if (restore_altstack(&frame->uc.uc_stack))
292 * If we were meticulous, we'd only call this if we knew that
293 * we were actually going to use an alternate stack, and we'd
294 * consider any error to be fatal. What we do here, in common
295 * with many other architectures, is call it blindly and only
296 * consider the -EFAULT return case to be proof of a problem.
297 */
298 if (do_sigaltstack(&frame->uc.uc_stack, NULL, pt_psp(regs)) == -EFAULT)
299 goto badframe; 287 goto badframe;
300 288
301 return 0; 289 return 0;
diff --git a/arch/ia64/include/asm/signal.h b/arch/ia64/include/asm/signal.h
index 3a1b20e74c5c..c62afa4a0dc2 100644
--- a/arch/ia64/include/asm/signal.h
+++ b/arch/ia64/include/asm/signal.h
@@ -26,16 +26,6 @@ typedef struct {
26 unsigned long sig[_NSIG_WORDS]; 26 unsigned long sig[_NSIG_WORDS];
27} sigset_t; 27} sigset_t;
28 28
29struct sigaction {
30 __sighandler_t sa_handler;
31 unsigned long sa_flags;
32 sigset_t sa_mask; /* mask last for extensibility */
33};
34
35struct k_sigaction {
36 struct sigaction sa;
37};
38
39# include <asm/sigcontext.h> 29# include <asm/sigcontext.h>
40 30
41# endif /* !__ASSEMBLY__ */ 31# endif /* !__ASSEMBLY__ */
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index c3cc42a15af1..096373800f73 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -27,9 +27,6 @@
27#define __IGNORE_vfork /* clone() */ 27#define __IGNORE_vfork /* clone() */
28#define __IGNORE_umount2 /* umount() */ 28#define __IGNORE_umount2 /* umount() */
29 29
30#define __ARCH_WANT_SYS_RT_SIGACTION
31#define __ARCH_WANT_SYS_RT_SIGSUSPEND
32
33#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) 30#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
34 31
35#include <linux/types.h> 32#include <linux/types.h>
@@ -47,12 +44,7 @@ asmlinkage unsigned long sys_mmap2(
47 int prot, int flags, 44 int prot, int flags,
48 int fd, long pgoff); 45 int fd, long pgoff);
49struct pt_regs; 46struct pt_regs;
50struct sigaction;
51asmlinkage long sys_ia64_pipe(void); 47asmlinkage long sys_ia64_pipe(void);
52asmlinkage long sys_rt_sigaction(int sig,
53 const struct sigaction __user *act,
54 struct sigaction __user *oact,
55 size_t sigsetsize);
56 48
57/* 49/*
58 * "Conditional" syscalls 50 * "Conditional" syscalls
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 680b73786be8..3637e03d2282 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -39,14 +39,6 @@
39# define GET_SIGSET(k,u) __get_user((k)->sig[0], &(u)->sig[0]) 39# define GET_SIGSET(k,u) __get_user((k)->sig[0], &(u)->sig[0])
40#endif 40#endif
41 41
42asmlinkage long
43sys_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, long arg2,
44 long arg3, long arg4, long arg5, long arg6, long arg7,
45 struct pt_regs regs)
46{
47 return do_sigaltstack(uss, uoss, regs.r12);
48}
49
50static long 42static long
51restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr) 43restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
52{ 44{
@@ -208,11 +200,8 @@ ia64_rt_sigreturn (struct sigscratch *scr)
208 printk("SIG return (%s:%d): sp=%lx ip=%lx\n", 200 printk("SIG return (%s:%d): sp=%lx ip=%lx\n",
209 current->comm, current->pid, scr->pt.r12, scr->pt.cr_iip); 201 current->comm, current->pid, scr->pt.r12, scr->pt.cr_iip);
210#endif 202#endif
211 /* 203 if (restore_altstack(&sc->sc_stack))
212 * It is more difficult to avoid calling this function than to 204 goto give_sigsegv;
213 * call it and ignore errors.
214 */
215 do_sigaltstack(&sc->sc_stack, NULL, scr->pt.r12);
216 return retval; 205 return retval;
217 206
218 give_sigsegv: 207 give_sigsegv:
@@ -376,9 +365,7 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
376 365
377 err |= copy_siginfo_to_user(&frame->info, info); 366 err |= copy_siginfo_to_user(&frame->info, info);
378 367
379 err |= __put_user(current->sas_ss_sp, &frame->sc.sc_stack.ss_sp); 368 err |= __save_altstack(&frame->sc.sc_stack, scr->pt.r12);
380 err |= __put_user(current->sas_ss_size, &frame->sc.sc_stack.ss_size);
381 err |= __put_user(sas_ss_flags(scr->pt.r12), &frame->sc.sc_stack.ss_flags);
382 err |= setup_sigcontext(&frame->sc, set, scr); 369 err |= setup_sigcontext(&frame->sc, set, scr);
383 370
384 if (unlikely(err)) 371 if (unlikely(err))
diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h
index a5ba4a217fb9..ed3ded6601e8 100644
--- a/arch/m32r/include/asm/signal.h
+++ b/arch/m32r/include/asm/signal.h
@@ -16,16 +16,7 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler;
21 unsigned long sa_flags;
22 __sigrestore_t sa_restorer;
23 sigset_t sa_mask; /* mask last for extensibility */
24};
25
26struct k_sigaction {
27 struct sigaction sa;
28};
29#include <asm/sigcontext.h> 20#include <asm/sigcontext.h>
30 21
31#undef __HAVE_ARCH_SIG_BITOPS 22#undef __HAVE_ARCH_SIG_BITOPS
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index 79b063caec85..555629b05267 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -20,8 +20,6 @@
20#define __ARCH_WANT_SYS_LLSEEK 20#define __ARCH_WANT_SYS_LLSEEK
21#define __ARCH_WANT_SYS_OLD_GETRLIMIT /*will be unused*/ 21#define __ARCH_WANT_SYS_OLD_GETRLIMIT /*will be unused*/
22#define __ARCH_WANT_SYS_OLDUMOUNT 22#define __ARCH_WANT_SYS_OLDUMOUNT
23#define __ARCH_WANT_SYS_RT_SIGACTION
24#define __ARCH_WANT_SYS_RT_SIGSUSPEND
25#define __ARCH_WANT_SYS_CLONE 23#define __ARCH_WANT_SYS_CLONE
26#define __ARCH_WANT_SYS_FORK 24#define __ARCH_WANT_SYS_FORK
27#define __ARCH_WANT_SYS_VFORK 25#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 6e3c26a1607c..d503568cb753 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -27,15 +27,6 @@
27 27
28#define DEBUG_SIG 0 28#define DEBUG_SIG 0
29 29
30asmlinkage int
31sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
32 unsigned long r2, unsigned long r3, unsigned long r4,
33 unsigned long r5, unsigned long r6, struct pt_regs *regs)
34{
35 return do_sigaltstack(uss, uoss, regs->spu);
36}
37
38
39/* 30/*
40 * Do a signal return; undo the signal stack. 31 * Do a signal return; undo the signal stack.
41 */ 32 */
@@ -113,7 +104,7 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
113 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result)) 104 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result))
114 goto badframe; 105 goto badframe;
115 106
116 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->spu) == -EFAULT) 107 if (restore_altstack(&frame->uc.uc_stack))
117 goto badframe; 108 goto badframe;
118 109
119 return result; 110 return result;
@@ -213,10 +204,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
213 /* Create the ucontext. */ 204 /* Create the ucontext. */
214 err |= __put_user(0, &frame->uc.uc_flags); 205 err |= __put_user(0, &frame->uc.uc_flags);
215 err |= __put_user(0, &frame->uc.uc_link); 206 err |= __put_user(0, &frame->uc.uc_link);
216 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 207 err |= __save_altstack(&frame->uc.uc_stack, regs->spu);
217 err |= __put_user(sas_ss_flags(regs->spu),
218 &frame->uc.uc_stack.ss_flags);
219 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
220 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 208 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
221 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 209 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
222 if (err) 210 if (err)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6710084e072a..efb1ce1f14a3 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -18,6 +18,8 @@ config M68K
18 select HAVE_MOD_ARCH_SPECIFIC 18 select HAVE_MOD_ARCH_SPECIFIC
19 select MODULES_USE_ELF_REL 19 select MODULES_USE_ELF_REL
20 select MODULES_USE_ELF_RELA 20 select MODULES_USE_ELF_RELA
21 select OLD_SIGSUSPEND3
22 select OLD_SIGACTION
21 23
22config RWSEM_GENERIC_SPINLOCK 24config RWSEM_GENERIC_SPINLOCK
23 bool 25 bool
diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h
index 9c8c46b06b0c..214320b50384 100644
--- a/arch/m68k/include/asm/signal.h
+++ b/arch/m68k/include/asm/signal.h
@@ -16,23 +16,8 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct old_sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler; 20
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 __sigrestore_t sa_restorer;
24};
25
26struct sigaction {
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 __sigrestore_t sa_restorer;
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
37 22
38#ifndef CONFIG_CPU_HAS_NO_BITFIELDS 23#ifndef CONFIG_CPU_HAS_NO_BITFIELDS
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index f9337f614660..6cd92671ca5e 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -29,8 +29,6 @@
29#define __ARCH_WANT_SYS_OLDUMOUNT 29#define __ARCH_WANT_SYS_OLDUMOUNT
30#define __ARCH_WANT_SYS_SIGPENDING 30#define __ARCH_WANT_SYS_SIGPENDING
31#define __ARCH_WANT_SYS_SIGPROCMASK 31#define __ARCH_WANT_SYS_SIGPROCMASK
32#define __ARCH_WANT_SYS_RT_SIGACTION
33#define __ARCH_WANT_SYS_RT_SIGSUSPEND
34#define __ARCH_WANT_SYS_FORK 32#define __ARCH_WANT_SYS_FORK
35#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
36 34
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 9a396cda3147..2a16df3d9312 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -225,56 +225,6 @@ static inline void push_cache(unsigned long vaddr)
225#endif /* CONFIG_MMU */ 225#endif /* CONFIG_MMU */
226 226
227/* 227/*
228 * Atomically swap in the new signal mask, and wait for a signal.
229 */
230asmlinkage int
231sys_sigsuspend(int unused0, int unused1, old_sigset_t mask)
232{
233 sigset_t blocked;
234 siginitset(&blocked, mask);
235 return sigsuspend(&blocked);
236}
237
238asmlinkage int
239sys_sigaction(int sig, const struct old_sigaction __user *act,
240 struct old_sigaction __user *oact)
241{
242 struct k_sigaction new_ka, old_ka;
243 int ret;
244
245 if (act) {
246 old_sigset_t mask;
247 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
248 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
249 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
250 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
251 __get_user(mask, &act->sa_mask))
252 return -EFAULT;
253 siginitset(&new_ka.sa.sa_mask, mask);
254 }
255
256 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
257
258 if (!ret && oact) {
259 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
260 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
261 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
262 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
263 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
264 return -EFAULT;
265 }
266
267 return ret;
268}
269
270asmlinkage int
271sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
272{
273 return do_sigaltstack(uss, uoss, rdusp());
274}
275
276
277/*
278 * Do a signal return; undo the signal stack. 228 * Do a signal return; undo the signal stack.
279 * 229 *
280 * Keep the return code on the stack quadword aligned! 230 * Keep the return code on the stack quadword aligned!
@@ -765,8 +715,9 @@ rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
765 err |= __get_user(temp, &uc->uc_formatvec); 715 err |= __get_user(temp, &uc->uc_formatvec);
766 716
767 err |= rt_restore_fpu_state(uc); 717 err |= rt_restore_fpu_state(uc);
718 err |= restore_altstack(&uc->uc_stack);
768 719
769 if (err || do_sigaltstack(&uc->uc_stack, NULL, usp) == -EFAULT) 720 if (err)
770 goto badframe; 721 goto badframe;
771 722
772 if (mangle_kernel_stack(regs, temp, &uc->uc_extra)) 723 if (mangle_kernel_stack(regs, temp, &uc->uc_extra))
@@ -1014,11 +965,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
1014 /* Create the ucontext. */ 965 /* Create the ucontext. */
1015 err |= __put_user(0, &frame->uc.uc_flags); 966 err |= __put_user(0, &frame->uc.uc_flags);
1016 err |= __put_user(NULL, &frame->uc.uc_link); 967 err |= __put_user(NULL, &frame->uc.uc_link);
1017 err |= __put_user((void __user *)current->sas_ss_sp, 968 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
1018 &frame->uc.uc_stack.ss_sp);
1019 err |= __put_user(sas_ss_flags(rdusp()),
1020 &frame->uc.uc_stack.ss_flags);
1021 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
1022 err |= rt_setup_ucontext(&frame->uc, regs); 969 err |= rt_setup_ucontext(&frame->uc, regs);
1023 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); 970 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
1024 971
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index 10f8ac186855..b3778391d9cc 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -33,8 +33,6 @@
33#define __ARCH_WANT_SYS_OLDUMOUNT 33#define __ARCH_WANT_SYS_OLDUMOUNT
34#define __ARCH_WANT_SYS_SIGPENDING 34#define __ARCH_WANT_SYS_SIGPENDING
35#define __ARCH_WANT_SYS_SIGPROCMASK 35#define __ARCH_WANT_SYS_SIGPROCMASK
36#define __ARCH_WANT_SYS_RT_SIGACTION
37#define __ARCH_WANT_SYS_RT_SIGSUSPEND
38#define __ARCH_WANT_SYS_CLONE 36#define __ARCH_WANT_SYS_CLONE
39#define __ARCH_WANT_SYS_VFORK 37#define __ARCH_WANT_SYS_VFORK
40#define __ARCH_WANT_SYS_FORK 38#define __ARCH_WANT_SYS_FORK
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
index 70da83a49670..7e394fc2c439 100644
--- a/arch/microblaze/kernel/entry-nommu.S
+++ b/arch/microblaze/kernel/entry-nommu.S
@@ -124,6 +124,7 @@ ret_from_intr:
124 lwi r11, r1, PT_MODE 124 lwi r11, r1, PT_MODE
125 bneid r11, no_intr_resched 125 bneid r11, no_intr_resched
126 126
1273:
127 lwi r6, r31, TS_THREAD_INFO /* get thread info */ 128 lwi r6, r31, TS_THREAD_INFO /* get thread info */
128 lwi r19, r6, TI_FLAGS /* get flags in thread info */ 129 lwi r19, r6, TI_FLAGS /* get flags in thread info */
129 /* do an extra work if any bits are set */ 130 /* do an extra work if any bits are set */
@@ -132,11 +133,13 @@ ret_from_intr:
132 beqi r11, 1f 133 beqi r11, 1f
133 bralid r15, schedule 134 bralid r15, schedule
134 nop 135 nop
136 bri 3b
1351: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME 1371: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME
136 beqid r11, no_intr_resched 138 beqid r11, no_intr_resched
137 addk r5, r1, r0 139 addk r5, r1, r0
138 bralid r15, do_notify_resume 140 bralid r15, do_notify_resume
139 addk r6, r0, r0 141 addk r6, r0, r0
142 bri 3b
140 143
141no_intr_resched: 144no_intr_resched:
142 /* Disable interrupts, we are now committed to the state restore */ 145 /* Disable interrupts, we are now committed to the state restore */
@@ -280,6 +283,7 @@ ENTRY(_user_exception)
280 /* Figure out which function to use for this system call. */ 283 /* Figure out which function to use for this system call. */
281 /* Note Microblaze barrel shift is optional, so don't rely on it */ 284 /* Note Microblaze barrel shift is optional, so don't rely on it */
282 add r12, r12, r12 /* convert num -> ptr */ 285 add r12, r12, r12 /* convert num -> ptr */
286 addik r30, r0, 1 /* restarts allowed */
283 add r12, r12, r12 287 add r12, r12, r12
284 lwi r12, r12, sys_call_table /* Get function pointer */ 288 lwi r12, r12, sys_call_table /* Get function pointer */
285 addik r15, r0, ret_to_user-8 /* set return address */ 289 addik r15, r0, ret_to_user-8 /* set return address */
@@ -369,6 +373,7 @@ ENTRY(_debug_exception)
369 bralid r15, send_sig 373 bralid r15, send_sig
370 add r7, r0, r0 /* 3rd param zero */ 374 add r7, r0, r0 /* 3rd param zero */
371 375
376 addik r30, r0, 1 /* restarts allowed ??? */
372 /* Restore r3/r4 to work around how ret_to_user works */ 377 /* Restore r3/r4 to work around how ret_to_user works */
373 lwi r3, r1, PT_R3 378 lwi r3, r1, PT_R3
374 lwi r4, r1, PT_R4 379 lwi r4, r1, PT_R4
@@ -482,18 +487,26 @@ ENTRY(ret_from_kernel_thread)
482 addk r3, r0, r0 487 addk r3, r0, r0
483 488
484work_pending: 489work_pending:
490 lwi r11, r1, PT_MODE
491 bneid r11, 2f
4923:
485 enable_irq 493 enable_irq
486
487 andi r11, r19, _TIF_NEED_RESCHED 494 andi r11, r19, _TIF_NEED_RESCHED
488 beqi r11, 1f 495 beqi r11, 1f
489 bralid r15, schedule 496 bralid r15, schedule
490 nop 497 nop
498 bri 4f
4911: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME 4991: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME
492 beqi r11, no_work_pending 500 beqi r11, no_work_pending
493 addk r5, r1, r0 501 addk r5, r30, r0
494 bralid r15, do_notify_resume 502 bralid r15, do_notify_resume
495 addik r6, r0, 1 503 addik r6, r0, 1
496 bri no_work_pending 504 addk r30, r0, r0 /* no restarts from now on */
5054:
506 disable_irq
507 lwi r6, r31, TS_THREAD_INFO /* get thread info */
508 lwi r19, r6, TI_FLAGS /* get flags in thread info */
509 bri 3b
497 510
498ENTRY(ret_to_user) 511ENTRY(ret_to_user)
499 disable_irq 512 disable_irq
@@ -507,6 +520,7 @@ ENTRY(ret_to_user)
507no_work_pending: 520no_work_pending:
508 disable_irq 521 disable_irq
509 522
5232:
510 /* save r31 */ 524 /* save r31 */
511 swi r31, r0, PER_CPU(CURRENT_SAVE) 525 swi r31, r0, PER_CPU(CURRENT_SAVE)
512 /* save mode indicator */ 526 /* save mode indicator */
@@ -559,6 +573,7 @@ no_work_pending:
559 nop 573 nop
560 574
561sys_rt_sigreturn_wrapper: 575sys_rt_sigreturn_wrapper:
576 addk r30, r0, r0 /* no restarts for this one */
562 brid sys_rt_sigreturn 577 brid sys_rt_sigreturn
563 addk r5, r1, r0 578 addk r5, r1, r0
564 579
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index c217367dfc7b..0536bc021cc6 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -354,6 +354,7 @@ C_ENTRY(_user_exception):
354 /* Note Microblaze barrel shift is optional, so don't rely on it */ 354 /* Note Microblaze barrel shift is optional, so don't rely on it */
355 add r12, r12, r12; /* convert num -> ptr */ 355 add r12, r12, r12; /* convert num -> ptr */
356 add r12, r12, r12; 356 add r12, r12, r12;
357 addi r30, r0, 1 /* restarts allowed */
357 358
358#ifdef DEBUG 359#ifdef DEBUG
359 /* Trac syscalls and stored them to syscall_debug_table */ 360 /* Trac syscalls and stored them to syscall_debug_table */
@@ -401,26 +402,27 @@ C_ENTRY(ret_from_trap):
401 * trigger rescheduling. */ 402 * trigger rescheduling. */
402 /* get thread info from current task */ 403 /* get thread info from current task */
403 lwi r11, CURRENT_TASK, TS_THREAD_INFO; 404 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
404 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 405 lwi r19, r11, TI_FLAGS; /* get flags in thread info */
405 andi r11, r11, _TIF_NEED_RESCHED; 406 andi r11, r19, _TIF_NEED_RESCHED;
406 beqi r11, 5f; 407 beqi r11, 5f;
407 408
408 bralid r15, schedule; /* Call scheduler */ 409 bralid r15, schedule; /* Call scheduler */
409 nop; /* delay slot */ 410 nop; /* delay slot */
411 bri 1b
410 412
411 /* Maybe handle a signal */ 413 /* Maybe handle a signal */
4125: /* get thread info from current task*/ 4145:
413 lwi r11, CURRENT_TASK, TS_THREAD_INFO; 415 andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
414 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 416 beqi r11, 4f; /* Signals to handle, handle them */
415 andi r11, r11, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
416 beqi r11, 1f; /* Signals to handle, handle them */
417 417
418 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ 418 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
419 bralid r15, do_notify_resume; /* Handle any signals */ 419 bralid r15, do_notify_resume; /* Handle any signals */
420 addi r6, r0, 1; /* Arg 2: int in_syscall */ 420 add r6, r30, r0; /* Arg 2: int in_syscall */
421 add r30, r0, r0 /* no more restarts */
422 bri 1b
421 423
422/* Finally, return to user state. */ 424/* Finally, return to user state. */
4231: set_bip; /* Ints masked for state restore */ 4254: set_bip; /* Ints masked for state restore */
424 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 426 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
425 VM_OFF; 427 VM_OFF;
426 tophys(r1,r1); 428 tophys(r1,r1);
@@ -464,6 +466,7 @@ C_ENTRY(ret_from_kernel_thread):
464 add r3, r0, r0 466 add r3, r0, r0
465 467
466C_ENTRY(sys_rt_sigreturn_wrapper): 468C_ENTRY(sys_rt_sigreturn_wrapper):
469 addik r30, r0, 0 /* no restarts */
467 brid sys_rt_sigreturn /* Do real work */ 470 brid sys_rt_sigreturn /* Do real work */
468 addik r5, r1, 0; /* add user context as 1st arg */ 471 addik r5, r1, 0; /* add user context as 1st arg */
469 472
@@ -571,20 +574,20 @@ C_ENTRY(ret_from_exc):
571 574
572 /* We're returning to user mode, so check for various conditions that 575 /* We're returning to user mode, so check for various conditions that
573 trigger rescheduling. */ 576 trigger rescheduling. */
5771:
574 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 578 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
575 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 579 lwi r19, r11, TI_FLAGS; /* get flags in thread info */
576 andi r11, r11, _TIF_NEED_RESCHED; 580 andi r11, r19, _TIF_NEED_RESCHED;
577 beqi r11, 5f; 581 beqi r11, 5f;
578 582
579/* Call the scheduler before returning from a syscall/trap. */ 583/* Call the scheduler before returning from a syscall/trap. */
580 bralid r15, schedule; /* Call scheduler */ 584 bralid r15, schedule; /* Call scheduler */
581 nop; /* delay slot */ 585 nop; /* delay slot */
586 bri 1b
582 587
583 /* Maybe handle a signal */ 588 /* Maybe handle a signal */
5845: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 5895: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
585 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 590 beqi r11, 4f; /* Signals to handle, handle them */
586 andi r11, r11, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
587 beqi r11, 1f; /* Signals to handle, handle them */
588 591
589 /* 592 /*
590 * Handle a signal return; Pending signals should be in r18. 593 * Handle a signal return; Pending signals should be in r18.
@@ -600,9 +603,10 @@ C_ENTRY(ret_from_exc):
600 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ 603 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
601 bralid r15, do_notify_resume; /* Handle any signals */ 604 bralid r15, do_notify_resume; /* Handle any signals */
602 addi r6, r0, 0; /* Arg 2: int in_syscall */ 605 addi r6, r0, 0; /* Arg 2: int in_syscall */
606 bri 1b
603 607
604/* Finally, return to user state. */ 608/* Finally, return to user state. */
6051: set_bip; /* Ints masked for state restore */ 6094: set_bip; /* Ints masked for state restore */
606 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 610 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
607 VM_OFF; 611 VM_OFF;
608 tophys(r1,r1); 612 tophys(r1,r1);
@@ -682,22 +686,23 @@ ret_from_irq:
682 lwi r11, r1, PT_MODE; 686 lwi r11, r1, PT_MODE;
683 bnei r11, 2f; 687 bnei r11, 2f;
684 688
6891:
685 lwi r11, CURRENT_TASK, TS_THREAD_INFO; 690 lwi r11, CURRENT_TASK, TS_THREAD_INFO;
686 lwi r11, r11, TI_FLAGS; /* MS: get flags from thread info */ 691 lwi r19, r11, TI_FLAGS; /* MS: get flags from thread info */
687 andi r11, r11, _TIF_NEED_RESCHED; 692 andi r11, r19, _TIF_NEED_RESCHED;
688 beqi r11, 5f 693 beqi r11, 5f
689 bralid r15, schedule; 694 bralid r15, schedule;
690 nop; /* delay slot */ 695 nop; /* delay slot */
696 bri 1b
691 697
692 /* Maybe handle a signal */ 698 /* Maybe handle a signal */
6935: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* MS: get thread info */ 6995: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
694 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
695 andi r11, r11, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
696 beqid r11, no_intr_resched 700 beqid r11, no_intr_resched
697/* Handle a signal return; Pending signals should be in r18. */ 701/* Handle a signal return; Pending signals should be in r18. */
698 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ 702 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
699 bralid r15, do_notify_resume; /* Handle any signals */ 703 bralid r15, do_notify_resume; /* Handle any signals */
700 addi r6, r0, 0; /* Arg 2: int in_syscall */ 704 addi r6, r0, 0; /* Arg 2: int in_syscall */
705 bri 1b
701 706
702/* Finally, return to user state. */ 707/* Finally, return to user state. */
703no_intr_resched: 708no_intr_resched:
@@ -815,28 +820,29 @@ dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */
815 lwi r11, r1, PT_MODE; 820 lwi r11, r1, PT_MODE;
816 bnei r11, 2f; 821 bnei r11, 2f;
817/* MS: Return to user space - gdb */ 822/* MS: Return to user space - gdb */
8231:
818 /* Get current task ptr into r11 */ 824 /* Get current task ptr into r11 */
819 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 825 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
820 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 826 lwi r19, r11, TI_FLAGS; /* get flags in thread info */
821 andi r11, r11, _TIF_NEED_RESCHED; 827 andi r11, r19, _TIF_NEED_RESCHED;
822 beqi r11, 5f; 828 beqi r11, 5f;
823 829
824 /* Call the scheduler before returning from a syscall/trap. */ 830 /* Call the scheduler before returning from a syscall/trap. */
825 bralid r15, schedule; /* Call scheduler */ 831 bralid r15, schedule; /* Call scheduler */
826 nop; /* delay slot */ 832 nop; /* delay slot */
833 bri 1b
827 834
828 /* Maybe handle a signal */ 835 /* Maybe handle a signal */
8295: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 8365: andi r11, r19, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
830 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 837 beqi r11, 4f; /* Signals to handle, handle them */
831 andi r11, r11, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME;
832 beqi r11, 1f; /* Signals to handle, handle them */
833 838
834 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */ 839 addik r5, r1, 0; /* Arg 1: struct pt_regs *regs */
835 bralid r15, do_notify_resume; /* Handle any signals */ 840 bralid r15, do_notify_resume; /* Handle any signals */
836 addi r6, r0, 0; /* Arg 2: int in_syscall */ 841 addi r6, r0, 0; /* Arg 2: int in_syscall */
842 bri 1b
837 843
838/* Finally, return to user state. */ 844/* Finally, return to user state. */
8391: swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 8454: swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
840 VM_OFF; 846 VM_OFF;
841 tophys(r1,r1); 847 tophys(r1,r1);
842 /* MS: Restore all regs */ 848 /* MS: Restore all regs */
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index ab1b9db661f3..b050219c42e6 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -164,29 +164,6 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
164 tracehook_report_syscall_exit(regs, step); 164 tracehook_report_syscall_exit(regs, step);
165} 165}
166 166
167#if 0
168static asmlinkage void syscall_trace(void)
169{
170 if (!test_thread_flag(TIF_SYSCALL_TRACE))
171 return;
172 if (!(current->ptrace & PT_PTRACED))
173 return;
174 /* The 0x80 provides a way for the tracing parent to distinguish
175 between a syscall stop and SIGTRAP delivery */
176 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
177 ? 0x80 : 0));
178 /*
179 * this isn't the same as continuing with a signal, but it will do
180 * for normal use. strace only continues with a signal if the
181 * stopping signal is not SIGTRAP. -brl
182 */
183 if (current->exit_code) {
184 send_sig(current->exit_code, current, 1);
185 current->exit_code = 0;
186 }
187}
188#endif
189
190void ptrace_disable(struct task_struct *child) 167void ptrace_disable(struct task_struct *child)
191{ 168{
192 /* nothing to do */ 169 /* nothing to do */
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index ac3d0a0f4814..9f7a8bde0686 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -41,13 +41,6 @@
41#include <asm/cacheflush.h> 41#include <asm/cacheflush.h>
42#include <asm/syscalls.h> 42#include <asm/syscalls.h>
43 43
44asmlinkage long
45sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
46 struct pt_regs *regs)
47{
48 return do_sigaltstack(uss, uoss, regs->r1);
49}
50
51/* 44/*
52 * Do a signal return; undo the signal stack. 45 * Do a signal return; undo the signal stack.
53 */ 46 */
@@ -109,9 +102,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
109 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval)) 102 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval))
110 goto badframe; 103 goto badframe;
111 104
112 /* It is more difficult to avoid calling this function than to 105 if (restore_altstack(&frame->uc.uc_stack))
113 call it and ignore errors. */
114 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->r1) == -EFAULT)
115 goto badframe; 106 goto badframe;
116 107
117 return rval; 108 return rval;
@@ -194,11 +185,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
194 /* Create the ucontext. */ 185 /* Create the ucontext. */
195 err |= __put_user(0, &frame->uc.uc_flags); 186 err |= __put_user(0, &frame->uc.uc_flags);
196 err |= __put_user(NULL, &frame->uc.uc_link); 187 err |= __put_user(NULL, &frame->uc.uc_link);
197 err |= __put_user((void __user *)current->sas_ss_sp, 188 err |= __save_altstack(&frame->uc.uc_stack, regs->r1);
198 &frame->uc.uc_stack.ss_sp);
199 err |= __put_user(sas_ss_flags(regs->r1),
200 &frame->uc.uc_stack.ss_flags);
201 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
202 err |= setup_sigcontext(&frame->uc.uc_mcontext, 189 err |= setup_sigcontext(&frame->uc.uc_mcontext,
203 regs, set->sig[0]); 190 regs, set->sig[0]);
204 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 191 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
@@ -356,15 +343,6 @@ static void do_signal(struct pt_regs *regs, int in_syscall)
356 343
357asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall) 344asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall)
358{ 345{
359 /*
360 * We want the common case to go fast, which
361 * is why we may in certain cases get here from
362 * kernel mode. Just return without doing anything
363 * if so.
364 */
365 if (kernel_mode(regs))
366 return;
367
368 if (test_thread_flag(TIF_SIGPENDING)) 346 if (test_thread_flag(TIF_SIGPENDING))
369 do_signal(regs, in_syscall); 347 do_signal(regs, in_syscall);
370 348
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 5d7170bfeb28..198641589bb5 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -40,6 +40,7 @@ config MIPS
40 select HAVE_MOD_ARCH_SPECIFIC 40 select HAVE_MOD_ARCH_SPECIFIC
41 select MODULES_USE_ELF_REL if MODULES 41 select MODULES_USE_ELF_REL if MODULES
42 select MODULES_USE_ELF_RELA if MODULES && 64BIT 42 select MODULES_USE_ELF_RELA if MODULES && 64BIT
43 select CLONE_BACKWARDS
43 44
44menu "Machine selection" 45menu "Machine selection"
45 46
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index 3c5d1464b7bd..ebaae9649f8a 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -288,6 +288,14 @@ struct compat_shmid64_ds {
288 compat_ulong_t __unused2; 288 compat_ulong_t __unused2;
289}; 289};
290 290
291/* MIPS has unusual order of fields in stack_t */
292typedef struct compat_sigaltstack {
293 compat_uptr_t ss_sp;
294 compat_size_t ss_size;
295 int ss_flags;
296} compat_stack_t;
297#define compat_sigaltstack compat_sigaltstack
298
291static inline int is_compat_task(void) 299static inline int is_compat_task(void)
292{ 300{
293 return test_thread_flag(TIF_32BIT_ADDR); 301 return test_thread_flag(TIF_32BIT_ADDR);
diff --git a/arch/mips/include/asm/signal.h b/arch/mips/include/asm/signal.h
index cf4a08062d1d..197f6367c201 100644
--- a/arch/mips/include/asm/signal.h
+++ b/arch/mips/include/asm/signal.h
@@ -21,4 +21,6 @@
21#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
22#include <asm/siginfo.h> 22#include <asm/siginfo.h>
23 23
24#define __ARCH_HAS_ODD_SIGACTION
25
24#endif /* _ASM_SIGNAL_H */ 26#endif /* _ASM_SIGNAL_H */
diff --git a/arch/mips/include/asm/sim.h b/arch/mips/include/asm/sim.h
index 0cd719fabb51..91831800c480 100644
--- a/arch/mips/include/asm/sim.h
+++ b/arch/mips/include/asm/sim.h
@@ -20,10 +20,10 @@
20#define save_static_function(symbol) \ 20#define save_static_function(symbol) \
21__asm__( \ 21__asm__( \
22 ".text\n\t" \ 22 ".text\n\t" \
23 ".globl\t" #symbol "\n\t" \ 23 ".globl\t__" #symbol "\n\t" \
24 ".align\t2\n\t" \ 24 ".align\t2\n\t" \
25 ".type\t" #symbol ", @function\n\t" \ 25 ".type\t__" #symbol ", @function\n\t" \
26 ".ent\t" #symbol ", 0\n" \ 26 ".ent\t__" #symbol ", 0\n__" \
27 #symbol":\n\t" \ 27 #symbol":\n\t" \
28 ".frame\t$29, 0, $31\n\t" \ 28 ".frame\t$29, 0, $31\n\t" \
29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ 29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
@@ -35,9 +35,9 @@ __asm__( \
35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \ 35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \
36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \ 36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \
37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \ 37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \
38 "j\t_" #symbol "\n\t" \ 38 "j\t" #symbol "\n\t" \
39 ".end\t" #symbol "\n\t" \ 39 ".end\t__" #symbol "\n\t" \
40 ".size\t" #symbol",. - " #symbol) 40 ".size\t__" #symbol",. - __" #symbol)
41 41
42#define nabi_no_regargs 42#define nabi_no_regargs
43 43
@@ -48,10 +48,10 @@ __asm__( \
48#define save_static_function(symbol) \ 48#define save_static_function(symbol) \
49__asm__( \ 49__asm__( \
50 ".text\n\t" \ 50 ".text\n\t" \
51 ".globl\t" #symbol "\n\t" \ 51 ".globl\t__" #symbol "\n\t" \
52 ".align\t2\n\t" \ 52 ".align\t2\n\t" \
53 ".type\t" #symbol ", @function\n\t" \ 53 ".type\t__" #symbol ", @function\n\t" \
54 ".ent\t" #symbol ", 0\n" \ 54 ".ent\t__" #symbol ", 0\n__" \
55 #symbol":\n\t" \ 55 #symbol":\n\t" \
56 ".frame\t$29, 0, $31\n\t" \ 56 ".frame\t$29, 0, $31\n\t" \
57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \ 57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
@@ -63,9 +63,9 @@ __asm__( \
63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \ 63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \
64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \ 64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \
65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \ 65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \
66 "j\t_" #symbol "\n\t" \ 66 "j\t" #symbol "\n\t" \
67 ".end\t" #symbol "\n\t" \ 67 ".end\t__" #symbol "\n\t" \
68 ".size\t" #symbol",. - " #symbol) 68 ".size\t__" #symbol",. - __" #symbol)
69 69
70#define nabi_no_regargs \ 70#define nabi_no_regargs \
71 unsigned long __dummy0, \ 71 unsigned long __dummy0, \
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 9e47cc11aa26..64f661e32879 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -35,7 +35,6 @@
35#define __ARCH_WANT_SYS_OLDUMOUNT 35#define __ARCH_WANT_SYS_OLDUMOUNT
36#define __ARCH_WANT_SYS_SIGPENDING 36#define __ARCH_WANT_SYS_SIGPENDING
37#define __ARCH_WANT_SYS_SIGPROCMASK 37#define __ARCH_WANT_SYS_SIGPROCMASK
38#define __ARCH_WANT_SYS_RT_SIGACTION
39# ifdef CONFIG_32BIT 38# ifdef CONFIG_32BIT
40# define __ARCH_WANT_STAT64 39# define __ARCH_WANT_STAT64
41# define __ARCH_WANT_SYS_TIME 40# define __ARCH_WANT_SYS_TIME
@@ -43,6 +42,8 @@
43# ifdef CONFIG_MIPS32_O32 42# ifdef CONFIG_MIPS32_O32
44# define __ARCH_WANT_COMPAT_SYS_TIME 43# define __ARCH_WANT_COMPAT_SYS_TIME
45# endif 44# endif
45#define __ARCH_WANT_SYS_FORK
46#define __ARCH_WANT_SYS_CLONE
46 47
47/* whitelists for checksyscalls */ 48/* whitelists for checksyscalls */
48#define __IGNORE_select 49#define __IGNORE_select
diff --git a/arch/mips/include/uapi/asm/signal.h b/arch/mips/include/uapi/asm/signal.h
index 770732cb8d03..6783c887a678 100644
--- a/arch/mips/include/uapi/asm/signal.h
+++ b/arch/mips/include/uapi/asm/signal.h
@@ -96,15 +96,13 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
96 96
97#include <asm-generic/signal-defs.h> 97#include <asm-generic/signal-defs.h>
98 98
99#ifndef __KERNEL__
99struct sigaction { 100struct sigaction {
100 unsigned int sa_flags; 101 unsigned int sa_flags;
101 __sighandler_t sa_handler; 102 __sighandler_t sa_handler;
102 sigset_t sa_mask; 103 sigset_t sa_mask;
103}; 104};
104 105#endif
105struct k_sigaction {
106 struct sigaction sa;
107};
108 106
109/* IRIX compatible stack_t */ 107/* IRIX compatible stack_t */
110typedef struct sigaltstack { 108typedef struct sigaltstack {
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 7adab86c632c..253bd8ad7446 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -119,22 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
119 return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); 119 return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
120} 120}
121 121
122SYSCALL_DEFINE2(32_sched_rr_get_interval, compat_pid_t, pid,
123 struct compat_timespec __user *, interval)
124{
125 struct timespec t;
126 int ret;
127 mm_segment_t old_fs = get_fs();
128
129 set_fs(KERNEL_DS);
130 ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
131 set_fs(old_fs);
132 if (put_user (t.tv_sec, &interval->tv_sec) ||
133 __put_user(t.tv_nsec, &interval->tv_nsec))
134 return -EFAULT;
135 return ret;
136}
137
138#ifdef CONFIG_SYSVIPC 122#ifdef CONFIG_SYSVIPC
139 123
140SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third, 124SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
@@ -295,27 +279,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
295 merge_64(len_a4, len_a5)); 279 merge_64(len_a4, len_a5));
296} 280}
297 281
298save_static_function(sys32_clone);
299static int noinline __used
300_sys32_clone(nabi_no_regargs struct pt_regs regs)
301{
302 unsigned long clone_flags;
303 unsigned long newsp;
304 int __user *parent_tidptr, *child_tidptr;
305
306 clone_flags = regs.regs[4];
307 newsp = regs.regs[5];
308 if (!newsp)
309 newsp = regs.regs[29];
310 parent_tidptr = (int __user *) regs.regs[6];
311
312 /* Use __dummy4 instead of getting it off the stack, so that
313 syscall() works. */
314 child_tidptr = (int __user *) __dummy4;
315 return do_fork(clone_flags, newsp, 0,
316 parent_tidptr, child_tidptr);
317}
318
319asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf, 282asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
320 size_t len) 283 size_t len)
321{ 284{
@@ -328,10 +291,3 @@ SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
328 return sys_fanotify_mark(fanotify_fd, flags, merge_64(a3, a4), 291 return sys_fanotify_mark(fanotify_fd, flags, merge_64(a3, a4),
329 dfd, pathname); 292 dfd, pathname);
330} 293}
331
332SYSCALL_DEFINE6(32_futex, u32 __user *, uaddr, int, op, u32, val,
333 struct compat_timespec __user *, utime, u32 __user *, uaddr2,
334 u32, val3)
335{
336 return compat_sys_futex(uaddr, op, val, utime, uaddr2, val3);
337}
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index a11c6f9fdd5e..a33d2ef8f273 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -156,7 +156,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
156 *childregs = *regs; 156 *childregs = *regs;
157 childregs->regs[7] = 0; /* Clear error flag */ 157 childregs->regs[7] = 0; /* Clear error flag */
158 childregs->regs[2] = 0; /* Child gets zero as return value */ 158 childregs->regs[2] = 0; /* Child gets zero as return value */
159 childregs->regs[29] = usp; 159 if (usp)
160 childregs->regs[29] = usp;
160 ti->addr_limit = USER_DS; 161 ti->addr_limit = USER_DS;
161 162
162 p->thread.reg29 = (unsigned long) childregs; 163 p->thread.reg29 = (unsigned long) childregs;
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index d20a4bc9ed05..80ff9422215f 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -226,7 +226,7 @@ einval: li v0, -ENOSYS
226 .macro syscalltable 226 .macro syscalltable
227 sys sys_syscall 8 /* 4000 */ 227 sys sys_syscall 8 /* 4000 */
228 sys sys_exit 1 228 sys sys_exit 1
229 sys sys_fork 0 229 sys __sys_fork 0
230 sys sys_read 3 230 sys sys_read 3
231 sys sys_write 3 231 sys sys_write 3
232 sys sys_open 3 /* 4005 */ 232 sys sys_open 3 /* 4005 */
@@ -344,7 +344,7 @@ einval: li v0, -ENOSYS
344 sys sys_ipc 6 344 sys sys_ipc 6
345 sys sys_fsync 1 345 sys sys_fsync 1
346 sys sys_sigreturn 0 346 sys sys_sigreturn 0
347 sys sys_clone 0 /* 4120 */ 347 sys __sys_clone 6 /* 4120 */
348 sys sys_setdomainname 2 348 sys sys_setdomainname 2
349 sys sys_newuname 1 349 sys sys_newuname 1
350 sys sys_ni_syscall 0 /* sys_modify_ldt */ 350 sys sys_ni_syscall 0 /* sys_modify_ldt */
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index b64f642da073..9444ad9ea575 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -170,8 +170,8 @@ sys_call_table:
170 PTR sys_socketpair 170 PTR sys_socketpair
171 PTR sys_setsockopt 171 PTR sys_setsockopt
172 PTR sys_getsockopt 172 PTR sys_getsockopt
173 PTR sys_clone /* 5055 */ 173 PTR __sys_clone /* 5055 */
174 PTR sys_fork 174 PTR __sys_fork
175 PTR sys_execve 175 PTR sys_execve
176 PTR sys_exit 176 PTR sys_exit
177 PTR sys_wait4 177 PTR sys_wait4
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index c29ac197f446..3b18a8e29215 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -117,8 +117,8 @@ EXPORT(sysn32_call_table)
117 PTR sys_mprotect /* 6010 */ 117 PTR sys_mprotect /* 6010 */
118 PTR sys_munmap 118 PTR sys_munmap
119 PTR sys_brk 119 PTR sys_brk
120 PTR sys_32_rt_sigaction 120 PTR compat_sys_rt_sigaction
121 PTR sys_32_rt_sigprocmask 121 PTR compat_sys_rt_sigprocmask
122 PTR compat_sys_ioctl /* 6015 */ 122 PTR compat_sys_ioctl /* 6015 */
123 PTR sys_pread64 123 PTR sys_pread64
124 PTR sys_pwrite64 124 PTR sys_pwrite64
@@ -159,8 +159,8 @@ EXPORT(sysn32_call_table)
159 PTR sys_socketpair 159 PTR sys_socketpair
160 PTR compat_sys_setsockopt 160 PTR compat_sys_setsockopt
161 PTR sys_getsockopt 161 PTR sys_getsockopt
162 PTR sys_clone /* 6055 */ 162 PTR __sys_clone /* 6055 */
163 PTR sys_fork 163 PTR __sys_fork
164 PTR compat_sys_execve 164 PTR compat_sys_execve
165 PTR sys_exit 165 PTR sys_exit
166 PTR compat_sys_wait4 166 PTR compat_sys_wait4
@@ -229,11 +229,11 @@ EXPORT(sysn32_call_table)
229 PTR sys_getsid 229 PTR sys_getsid
230 PTR sys_capget 230 PTR sys_capget
231 PTR sys_capset 231 PTR sys_capset
232 PTR sys_32_rt_sigpending /* 6125 */ 232 PTR compat_sys_rt_sigpending /* 6125 */
233 PTR compat_sys_rt_sigtimedwait 233 PTR compat_sys_rt_sigtimedwait
234 PTR sys_32_rt_sigqueueinfo 234 PTR compat_sys_rt_sigqueueinfo
235 PTR sysn32_rt_sigsuspend 235 PTR compat_sys_rt_sigsuspend
236 PTR sys32_sigaltstack 236 PTR compat_sys_sigaltstack
237 PTR compat_sys_utime /* 6130 */ 237 PTR compat_sys_utime /* 6130 */
238 PTR sys_mknod 238 PTR sys_mknod
239 PTR sys_32_personality 239 PTR sys_32_personality
@@ -249,7 +249,7 @@ EXPORT(sysn32_call_table)
249 PTR sys_sched_getscheduler 249 PTR sys_sched_getscheduler
250 PTR sys_sched_get_priority_max 250 PTR sys_sched_get_priority_max
251 PTR sys_sched_get_priority_min 251 PTR sys_sched_get_priority_min
252 PTR sys_32_sched_rr_get_interval /* 6145 */ 252 PTR compat_sys_sched_rr_get_interval /* 6145 */
253 PTR sys_mlock 253 PTR sys_mlock
254 PTR sys_munlock 254 PTR sys_munlock
255 PTR sys_mlockall 255 PTR sys_mlockall
@@ -298,7 +298,7 @@ EXPORT(sysn32_call_table)
298 PTR sys_fremovexattr 298 PTR sys_fremovexattr
299 PTR sys_tkill 299 PTR sys_tkill
300 PTR sys_ni_syscall 300 PTR sys_ni_syscall
301 PTR sys_32_futex 301 PTR compat_sys_futex
302 PTR compat_sys_sched_setaffinity /* 6195 */ 302 PTR compat_sys_sched_setaffinity /* 6195 */
303 PTR compat_sys_sched_getaffinity 303 PTR compat_sys_sched_getaffinity
304 PTR sys_cacheflush 304 PTR sys_cacheflush
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index cf3e75e46650..063cd0d6ddd2 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -194,7 +194,7 @@ einval: li v0, -ENOSYS
194sys_call_table: 194sys_call_table:
195 PTR sys32_syscall /* 4000 */ 195 PTR sys32_syscall /* 4000 */
196 PTR sys_exit 196 PTR sys_exit
197 PTR sys_fork 197 PTR __sys_fork
198 PTR sys_read 198 PTR sys_read
199 PTR sys_write 199 PTR sys_write
200 PTR compat_sys_open /* 4005 */ 200 PTR compat_sys_open /* 4005 */
@@ -312,7 +312,7 @@ sys_call_table:
312 PTR sys_32_ipc 312 PTR sys_32_ipc
313 PTR sys_fsync 313 PTR sys_fsync
314 PTR sys32_sigreturn 314 PTR sys32_sigreturn
315 PTR sys32_clone /* 4120 */ 315 PTR __sys_clone /* 4120 */
316 PTR sys_setdomainname 316 PTR sys_setdomainname
317 PTR sys_newuname 317 PTR sys_newuname
318 PTR sys_ni_syscall /* sys_modify_ldt */ 318 PTR sys_ni_syscall /* sys_modify_ldt */
@@ -357,7 +357,7 @@ sys_call_table:
357 PTR sys_sched_yield 357 PTR sys_sched_yield
358 PTR sys_sched_get_priority_max 358 PTR sys_sched_get_priority_max
359 PTR sys_sched_get_priority_min 359 PTR sys_sched_get_priority_min
360 PTR sys_32_sched_rr_get_interval /* 4165 */ 360 PTR compat_sys_sched_rr_get_interval /* 4165 */
361 PTR compat_sys_nanosleep 361 PTR compat_sys_nanosleep
362 PTR sys_mremap 362 PTR sys_mremap
363 PTR sys_accept 363 PTR sys_accept
@@ -386,19 +386,19 @@ sys_call_table:
386 PTR sys_getresgid 386 PTR sys_getresgid
387 PTR sys_prctl 387 PTR sys_prctl
388 PTR sys32_rt_sigreturn 388 PTR sys32_rt_sigreturn
389 PTR sys_32_rt_sigaction 389 PTR compat_sys_rt_sigaction
390 PTR sys_32_rt_sigprocmask /* 4195 */ 390 PTR compat_sys_rt_sigprocmask /* 4195 */
391 PTR sys_32_rt_sigpending 391 PTR compat_sys_rt_sigpending
392 PTR compat_sys_rt_sigtimedwait 392 PTR compat_sys_rt_sigtimedwait
393 PTR sys_32_rt_sigqueueinfo 393 PTR compat_sys_rt_sigqueueinfo
394 PTR sys32_rt_sigsuspend 394 PTR compat_sys_rt_sigsuspend
395 PTR sys_32_pread /* 4200 */ 395 PTR sys_32_pread /* 4200 */
396 PTR sys_32_pwrite 396 PTR sys_32_pwrite
397 PTR sys_chown 397 PTR sys_chown
398 PTR sys_getcwd 398 PTR sys_getcwd
399 PTR sys_capget 399 PTR sys_capget
400 PTR sys_capset /* 4205 */ 400 PTR sys_capset /* 4205 */
401 PTR sys32_sigaltstack 401 PTR compat_sys_sigaltstack
402 PTR sys_32_sendfile 402 PTR sys_32_sendfile
403 PTR sys_ni_syscall 403 PTR sys_ni_syscall
404 PTR sys_ni_syscall 404 PTR sys_ni_syscall
@@ -430,7 +430,7 @@ sys_call_table:
430 PTR sys_fremovexattr /* 4235 */ 430 PTR sys_fremovexattr /* 4235 */
431 PTR sys_tkill 431 PTR sys_tkill
432 PTR sys_sendfile64 432 PTR sys_sendfile64
433 PTR sys_32_futex 433 PTR compat_sys_futex
434 PTR compat_sys_sched_setaffinity 434 PTR compat_sys_sched_setaffinity
435 PTR compat_sys_sched_getaffinity /* 4240 */ 435 PTR compat_sys_sched_getaffinity /* 4240 */
436 PTR compat_sys_io_setup 436 PTR compat_sys_io_setup
@@ -470,7 +470,7 @@ sys_call_table:
470 PTR compat_sys_mq_notify /* 4275 */ 470 PTR compat_sys_mq_notify /* 4275 */
471 PTR compat_sys_mq_getsetattr 471 PTR compat_sys_mq_getsetattr
472 PTR sys_ni_syscall /* sys_vserver */ 472 PTR sys_ni_syscall /* sys_vserver */
473 PTR sys_32_waitid 473 PTR compat_sys_waitid
474 PTR sys_ni_syscall /* available, was setaltroot */ 474 PTR sys_ni_syscall /* available, was setaltroot */
475 PTR sys_add_key /* 4280 */ 475 PTR sys_add_key /* 4280 */
476 PTR sys_request_key 476 PTR sys_request_key
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index b6aa77035019..95b019d92f50 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -247,35 +247,12 @@ void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
247 */ 247 */
248 248
249#ifdef CONFIG_TRAD_SIGNALS 249#ifdef CONFIG_TRAD_SIGNALS
250asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs) 250SYSCALL_DEFINE1(sigsuspend, sigset_t __user *, uset)
251{ 251{
252 sigset_t newset; 252 return sys_rt_sigsuspend(uset, sizeof(sigset_t));
253 sigset_t __user *uset;
254
255 uset = (sigset_t __user *) regs.regs[4];
256 if (copy_from_user(&newset, uset, sizeof(sigset_t)))
257 return -EFAULT;
258 return sigsuspend(&newset);
259} 253}
260#endif 254#endif
261 255
262asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
263{
264 sigset_t newset;
265 sigset_t __user *unewset;
266 size_t sigsetsize;
267
268 /* XXX Don't preclude handling different sized sigset_t's. */
269 sigsetsize = regs.regs[5];
270 if (sigsetsize != sizeof(sigset_t))
271 return -EINVAL;
272
273 unewset = (sigset_t __user *) regs.regs[4];
274 if (copy_from_user(&newset, unewset, sizeof(newset)))
275 return -EFAULT;
276 return sigsuspend(&newset);
277}
278
279#ifdef CONFIG_TRAD_SIGNALS 256#ifdef CONFIG_TRAD_SIGNALS
280SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act, 257SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
281 struct sigaction __user *, oact) 258 struct sigaction __user *, oact)
@@ -317,15 +294,6 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
317} 294}
318#endif 295#endif
319 296
320asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
321{
322 const stack_t __user *uss = (const stack_t __user *) regs.regs[4];
323 stack_t __user *uoss = (stack_t __user *) regs.regs[5];
324 unsigned long usp = regs.regs[29];
325
326 return do_sigaltstack(uss, uoss, usp);
327}
328
329#ifdef CONFIG_TRAD_SIGNALS 297#ifdef CONFIG_TRAD_SIGNALS
330asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) 298asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
331{ 299{
@@ -382,9 +350,8 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
382 else if (sig) 350 else if (sig)
383 force_sig(sig, current); 351 force_sig(sig, current);
384 352
385 /* It is more difficult to avoid calling this function than to 353 if (restore_altstack(&frame->rs_uc.uc_stack))
386 call it and ignore errors. */ 354 goto badframe;
387 do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]);
388 355
389 /* 356 /*
390 * Don't let your children do this ... 357 * Don't let your children do this ...
@@ -461,12 +428,7 @@ static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
461 /* Create the ucontext. */ 428 /* Create the ucontext. */
462 err |= __put_user(0, &frame->rs_uc.uc_flags); 429 err |= __put_user(0, &frame->rs_uc.uc_flags);
463 err |= __put_user(NULL, &frame->rs_uc.uc_link); 430 err |= __put_user(NULL, &frame->rs_uc.uc_link);
464 err |= __put_user((void __user *)current->sas_ss_sp, 431 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]);
465 &frame->rs_uc.uc_stack.ss_sp);
466 err |= __put_user(sas_ss_flags(regs->regs[29]),
467 &frame->rs_uc.uc_stack.ss_flags);
468 err |= __put_user(current->sas_ss_size,
469 &frame->rs_uc.uc_stack.ss_size);
470 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext); 432 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
471 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); 433 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
472 434
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index da1b56a39ac7..ad7c2be0c33d 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -55,23 +55,10 @@ extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 __user
55typedef unsigned int __sighandler32_t; 55typedef unsigned int __sighandler32_t;
56typedef void (*vfptr_t)(void); 56typedef void (*vfptr_t)(void);
57 57
58struct sigaction32 {
59 unsigned int sa_flags;
60 __sighandler32_t sa_handler;
61 compat_sigset_t sa_mask;
62};
63
64/* IRIX compatible stack_t */
65typedef struct sigaltstack32 {
66 s32 ss_sp;
67 compat_size_t ss_size;
68 int ss_flags;
69} stack32_t;
70
71struct ucontext32 { 58struct ucontext32 {
72 u32 uc_flags; 59 u32 uc_flags;
73 s32 uc_link; 60 s32 uc_link;
74 stack32_t uc_stack; 61 compat_stack_t uc_stack;
75 struct sigcontext32 uc_mcontext; 62 struct sigcontext32 uc_mcontext;
76 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 63 compat_sigset_t uc_sigmask; /* mask last for extensibility */
77}; 64};
@@ -280,36 +267,13 @@ static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf)
280 * Atomically swap in the new signal mask, and wait for a signal. 267 * Atomically swap in the new signal mask, and wait for a signal.
281 */ 268 */
282 269
283asmlinkage int sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) 270asmlinkage int sys32_sigsuspend(compat_sigset_t __user *uset)
284{ 271{
285 compat_sigset_t __user *uset; 272 return compat_sys_rt_sigsuspend(uset, sizeof(compat_sigset_t));
286 sigset_t newset;
287
288 uset = (compat_sigset_t __user *) regs.regs[4];
289 if (get_sigset(&newset, uset))
290 return -EFAULT;
291 return sigsuspend(&newset);
292}
293
294asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
295{
296 compat_sigset_t __user *uset;
297 sigset_t newset;
298 size_t sigsetsize;
299
300 /* XXX Don't preclude handling different sized sigset_t's. */
301 sigsetsize = regs.regs[5];
302 if (sigsetsize != sizeof(compat_sigset_t))
303 return -EINVAL;
304
305 uset = (compat_sigset_t __user *) regs.regs[4];
306 if (get_sigset(&newset, uset))
307 return -EFAULT;
308 return sigsuspend(&newset);
309} 273}
310 274
311SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act, 275SYSCALL_DEFINE3(32_sigaction, long, sig, const struct compat_sigaction __user *, act,
312 struct sigaction32 __user *, oact) 276 struct compat_sigaction __user *, oact)
313{ 277{
314 struct k_sigaction new_ka, old_ka; 278 struct k_sigaction new_ka, old_ka;
315 int ret; 279 int ret;
@@ -350,45 +314,6 @@ SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act,
350 return ret; 314 return ret;
351} 315}
352 316
353asmlinkage int sys32_sigaltstack(nabi_no_regargs struct pt_regs regs)
354{
355 const stack32_t __user *uss = (const stack32_t __user *) regs.regs[4];
356 stack32_t __user *uoss = (stack32_t __user *) regs.regs[5];
357 unsigned long usp = regs.regs[29];
358 stack_t kss, koss;
359 int ret, err = 0;
360 mm_segment_t old_fs = get_fs();
361 s32 sp;
362
363 if (uss) {
364 if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
365 return -EFAULT;
366 err |= __get_user(sp, &uss->ss_sp);
367 kss.ss_sp = (void __user *) (long) sp;
368 err |= __get_user(kss.ss_size, &uss->ss_size);
369 err |= __get_user(kss.ss_flags, &uss->ss_flags);
370 if (err)
371 return -EFAULT;
372 }
373
374 set_fs(KERNEL_DS);
375 ret = do_sigaltstack(uss ? (stack_t __user *)&kss : NULL,
376 uoss ? (stack_t __user *)&koss : NULL, usp);
377 set_fs(old_fs);
378
379 if (!ret && uoss) {
380 if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
381 return -EFAULT;
382 sp = (int) (unsigned long) koss.ss_sp;
383 err |= __put_user(sp, &uoss->ss_sp);
384 err |= __put_user(koss.ss_size, &uoss->ss_size);
385 err |= __put_user(koss.ss_flags, &uoss->ss_flags);
386 if (err)
387 return -EFAULT;
388 }
389 return ret;
390}
391
392int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 317int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
393{ 318{
394 int err; 319 int err;
@@ -490,10 +415,7 @@ badframe:
490asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 415asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
491{ 416{
492 struct rt_sigframe32 __user *frame; 417 struct rt_sigframe32 __user *frame;
493 mm_segment_t old_fs;
494 sigset_t set; 418 sigset_t set;
495 stack_t st;
496 s32 sp;
497 int sig; 419 int sig;
498 420
499 frame = (struct rt_sigframe32 __user *) regs.regs[29]; 421 frame = (struct rt_sigframe32 __user *) regs.regs[29];
@@ -510,22 +432,9 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
510 else if (sig) 432 else if (sig)
511 force_sig(sig, current); 433 force_sig(sig, current);
512 434
513 /* The ucontext contains a stack32_t, so we must convert! */ 435 if (compat_restore_altstack(&frame->rs_uc.uc_stack))
514 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
515 goto badframe;
516 st.ss_sp = (void __user *)(long) sp;
517 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
518 goto badframe;
519 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
520 goto badframe; 436 goto badframe;
521 437
522 /* It is more difficult to avoid calling this function than to
523 call it and ignore errors. */
524 old_fs = get_fs();
525 set_fs(KERNEL_DS);
526 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
527 set_fs(old_fs);
528
529 /* 438 /*
530 * Don't let your children do this ... 439 * Don't let your children do this ...
531 */ 440 */
@@ -590,7 +499,6 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka,
590{ 499{
591 struct rt_sigframe32 __user *frame; 500 struct rt_sigframe32 __user *frame;
592 int err = 0; 501 int err = 0;
593 s32 sp;
594 502
595 frame = get_sigframe(ka, regs, sizeof(*frame)); 503 frame = get_sigframe(ka, regs, sizeof(*frame));
596 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 504 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
@@ -602,13 +510,7 @@ static int setup_rt_frame_32(void *sig_return, struct k_sigaction *ka,
602 /* Create the ucontext. */ 510 /* Create the ucontext. */
603 err |= __put_user(0, &frame->rs_uc.uc_flags); 511 err |= __put_user(0, &frame->rs_uc.uc_flags);
604 err |= __put_user(0, &frame->rs_uc.uc_link); 512 err |= __put_user(0, &frame->rs_uc.uc_link);
605 sp = (int) (long) current->sas_ss_sp; 513 err |= __compat_save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]);
606 err |= __put_user(sp,
607 &frame->rs_uc.uc_stack.ss_sp);
608 err |= __put_user(sas_ss_flags(regs->regs[29]),
609 &frame->rs_uc.uc_stack.ss_flags);
610 err |= __put_user(current->sas_ss_size,
611 &frame->rs_uc.uc_stack.ss_size);
612 err |= setup_sigcontext32(regs, &frame->rs_uc.uc_mcontext); 514 err |= setup_sigcontext32(regs, &frame->rs_uc.uc_mcontext);
613 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set); 515 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set);
614 516
@@ -656,131 +558,6 @@ struct mips_abi mips_abi_32 = {
656 .restart = __NR_O32_restart_syscall 558 .restart = __NR_O32_restart_syscall
657}; 559};
658 560
659SYSCALL_DEFINE4(32_rt_sigaction, int, sig,
660 const struct sigaction32 __user *, act,
661 struct sigaction32 __user *, oact, unsigned int, sigsetsize)
662{
663 struct k_sigaction new_sa, old_sa;
664 int ret = -EINVAL;
665
666 /* XXX: Don't preclude handling different sized sigset_t's. */
667 if (sigsetsize != sizeof(sigset_t))
668 goto out;
669
670 if (act) {
671 s32 handler;
672 int err = 0;
673
674 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
675 return -EFAULT;
676 err |= __get_user(handler, &act->sa_handler);
677 new_sa.sa.sa_handler = (void __user *)(s64)handler;
678 err |= __get_user(new_sa.sa.sa_flags, &act->sa_flags);
679 err |= get_sigset(&new_sa.sa.sa_mask, &act->sa_mask);
680 if (err)
681 return -EFAULT;
682 }
683
684 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
685
686 if (!ret && oact) {
687 int err = 0;
688
689 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
690 return -EFAULT;
691
692 err |= __put_user((u32)(u64)old_sa.sa.sa_handler,
693 &oact->sa_handler);
694 err |= __put_user(old_sa.sa.sa_flags, &oact->sa_flags);
695 err |= put_sigset(&old_sa.sa.sa_mask, &oact->sa_mask);
696 if (err)
697 return -EFAULT;
698 }
699out:
700 return ret;
701}
702
703SYSCALL_DEFINE4(32_rt_sigprocmask, int, how, compat_sigset_t __user *, set,
704 compat_sigset_t __user *, oset, unsigned int, sigsetsize)
705{
706 sigset_t old_set, new_set;
707 int ret;
708 mm_segment_t old_fs = get_fs();
709
710 if (set && get_sigset(&new_set, set))
711 return -EFAULT;
712
713 set_fs(KERNEL_DS);
714 ret = sys_rt_sigprocmask(how, set ? (sigset_t __user *)&new_set : NULL,
715 oset ? (sigset_t __user *)&old_set : NULL,
716 sigsetsize);
717 set_fs(old_fs);
718
719 if (!ret && oset && put_sigset(&old_set, oset))
720 return -EFAULT;
721
722 return ret;
723}
724
725SYSCALL_DEFINE2(32_rt_sigpending, compat_sigset_t __user *, uset,
726 unsigned int, sigsetsize)
727{
728 int ret;
729 sigset_t set;
730 mm_segment_t old_fs = get_fs();
731
732 set_fs(KERNEL_DS);
733 ret = sys_rt_sigpending((sigset_t __user *)&set, sigsetsize);
734 set_fs(old_fs);
735
736 if (!ret && put_sigset(&set, uset))
737 return -EFAULT;
738
739 return ret;
740}
741
742SYSCALL_DEFINE3(32_rt_sigqueueinfo, int, pid, int, sig,
743 compat_siginfo_t __user *, uinfo)
744{
745 siginfo_t info;
746 int ret;
747 mm_segment_t old_fs = get_fs();
748
749 if (copy_from_user(&info, uinfo, 3*sizeof(int)) ||
750 copy_from_user(info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
751 return -EFAULT;
752 set_fs(KERNEL_DS);
753 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
754 set_fs(old_fs);
755 return ret;
756}
757
758SYSCALL_DEFINE5(32_waitid, int, which, compat_pid_t, pid,
759 compat_siginfo_t __user *, uinfo, int, options,
760 struct compat_rusage __user *, uru)
761{
762 siginfo_t info;
763 struct rusage ru;
764 long ret;
765 mm_segment_t old_fs = get_fs();
766
767 info.si_signo = 0;
768 set_fs(KERNEL_DS);
769 ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
770 uru ? (struct rusage __user *) &ru : NULL);
771 set_fs(old_fs);
772
773 if (ret < 0 || info.si_signo == 0)
774 return ret;
775
776 if (uru && (ret = put_compat_rusage(&ru, uru)))
777 return ret;
778
779 BUG_ON(info.si_code & __SI_MASK);
780 info.si_code |= __SI_CHLD;
781 return copy_siginfo_to_user32(uinfo, &info);
782}
783
784static int signal32_init(void) 561static int signal32_init(void)
785{ 562{
786 if (cpu_has_fpu) { 563 if (cpu_has_fpu) {
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index 3574c145511b..5f4ef2ae6199 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -50,18 +50,10 @@
50extern int setup_sigcontext(struct pt_regs *, struct sigcontext __user *); 50extern int setup_sigcontext(struct pt_regs *, struct sigcontext __user *);
51extern int restore_sigcontext(struct pt_regs *, struct sigcontext __user *); 51extern int restore_sigcontext(struct pt_regs *, struct sigcontext __user *);
52 52
53
54/* IRIX compatible stack_t */
55typedef struct sigaltstack32 {
56 s32 ss_sp;
57 compat_size_t ss_size;
58 int ss_flags;
59} stack32_t;
60
61struct ucontextn32 { 53struct ucontextn32 {
62 u32 uc_flags; 54 u32 uc_flags;
63 s32 uc_link; 55 s32 uc_link;
64 stack32_t uc_stack; 56 compat_stack_t uc_stack;
65 struct sigcontext uc_mcontext; 57 struct sigcontext uc_mcontext;
66 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 58 compat_sigset_t uc_sigmask; /* mask last for extensibility */
67}; 59};
@@ -73,34 +65,10 @@ struct rt_sigframe_n32 {
73 struct ucontextn32 rs_uc; 65 struct ucontextn32 rs_uc;
74}; 66};
75 67
76extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
77
78asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
79{
80 compat_sigset_t __user *unewset;
81 compat_sigset_t uset;
82 size_t sigsetsize;
83 sigset_t newset;
84
85 /* XXX Don't preclude handling different sized sigset_t's. */
86 sigsetsize = regs.regs[5];
87 if (sigsetsize != sizeof(sigset_t))
88 return -EINVAL;
89
90 unewset = (compat_sigset_t __user *) regs.regs[4];
91 if (copy_from_user(&uset, unewset, sizeof(uset)))
92 return -EFAULT;
93 sigset_from_compat(&newset, &uset);
94 return sigsuspend(&newset);
95}
96
97asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) 68asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
98{ 69{
99 struct rt_sigframe_n32 __user *frame; 70 struct rt_sigframe_n32 __user *frame;
100 mm_segment_t old_fs;
101 sigset_t set; 71 sigset_t set;
102 stack_t st;
103 s32 sp;
104 int sig; 72 int sig;
105 73
106 frame = (struct rt_sigframe_n32 __user *) regs.regs[29]; 74 frame = (struct rt_sigframe_n32 __user *) regs.regs[29];
@@ -117,23 +85,9 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
117 else if (sig) 85 else if (sig)
118 force_sig(sig, current); 86 force_sig(sig, current);
119 87
120 /* The ucontext contains a stack32_t, so we must convert! */ 88 if (compat_restore_altstack(&frame->rs_uc.uc_stack))
121 if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
122 goto badframe;
123 st.ss_sp = (void __user *)(long) sp;
124 if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
125 goto badframe;
126 if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
127 goto badframe; 89 goto badframe;
128 90
129 /* It is more difficult to avoid calling this function than to
130 call it and ignore errors. */
131 old_fs = get_fs();
132 set_fs(KERNEL_DS);
133 do_sigaltstack((stack_t __user *)&st, NULL, regs.regs[29]);
134 set_fs(old_fs);
135
136
137 /* 91 /*
138 * Don't let your children do this ... 92 * Don't let your children do this ...
139 */ 93 */
@@ -153,7 +107,6 @@ static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka,
153{ 107{
154 struct rt_sigframe_n32 __user *frame; 108 struct rt_sigframe_n32 __user *frame;
155 int err = 0; 109 int err = 0;
156 s32 sp;
157 110
158 frame = get_sigframe(ka, regs, sizeof(*frame)); 111 frame = get_sigframe(ka, regs, sizeof(*frame));
159 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame))) 112 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
@@ -165,13 +118,7 @@ static int setup_rt_frame_n32(void *sig_return, struct k_sigaction *ka,
165 /* Create the ucontext. */ 118 /* Create the ucontext. */
166 err |= __put_user(0, &frame->rs_uc.uc_flags); 119 err |= __put_user(0, &frame->rs_uc.uc_flags);
167 err |= __put_user(0, &frame->rs_uc.uc_link); 120 err |= __put_user(0, &frame->rs_uc.uc_link);
168 sp = (int) (long) current->sas_ss_sp; 121 err |= __compat_save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]);
169 err |= __put_user(sp,
170 &frame->rs_uc.uc_stack.ss_sp);
171 err |= __put_user(sas_ss_flags(regs->regs[29]),
172 &frame->rs_uc.uc_stack.ss_flags);
173 err |= __put_user(current->sas_ss_size,
174 &frame->rs_uc.uc_stack.ss_size);
175 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext); 122 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
176 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set); 123 err |= __copy_conv_sigset_to_user(&frame->rs_uc.uc_sigmask, set);
177 124
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 201cb76b4df9..b32466a1a1d2 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -46,20 +46,14 @@
46 * argument. Historically that used to be expensive in Linux. These days 46 * argument. Historically that used to be expensive in Linux. These days
47 * the performance advantage is negligible. 47 * the performance advantage is negligible.
48 */ 48 */
49asmlinkage int sysm_pipe(nabi_no_regargs volatile struct pt_regs regs) 49asmlinkage int sysm_pipe(void)
50{ 50{
51 int fd[2]; 51 int fd[2];
52 int error, res; 52 int error = do_pipe_flags(fd, 0);
53 53 if (error)
54 error = do_pipe_flags(fd, 0); 54 return error;
55 if (error) { 55 current_pt_regs()->regs[3] = fd[1];
56 res = error; 56 return fd[0];
57 goto out;
58 }
59 regs.regs[3] = fd[1];
60 res = fd[0];
61out:
62 return res;
63} 57}
64 58
65SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len, 59SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
@@ -89,43 +83,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
89} 83}
90 84
91save_static_function(sys_fork); 85save_static_function(sys_fork);
92static int __used noinline
93_sys_fork(nabi_no_regargs struct pt_regs regs)
94{
95 return do_fork(SIGCHLD, regs.regs[29], 0, NULL, NULL);
96}
97
98save_static_function(sys_clone); 86save_static_function(sys_clone);
99static int __used noinline
100_sys_clone(nabi_no_regargs struct pt_regs regs)
101{
102 unsigned long clone_flags;
103 unsigned long newsp;
104 int __user *parent_tidptr, *child_tidptr;
105
106 clone_flags = regs.regs[4];
107 newsp = regs.regs[5];
108 if (!newsp)
109 newsp = regs.regs[29];
110 parent_tidptr = (int __user *) regs.regs[6];
111#ifdef CONFIG_32BIT
112 /* We need to fetch the fifth argument off the stack. */
113 child_tidptr = NULL;
114 if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) {
115 int __user *__user *usp = (int __user *__user *) regs.regs[29];
116 if (regs.regs[2] == __NR_syscall) {
117 if (get_user (child_tidptr, &usp[5]))
118 return -EFAULT;
119 }
120 else if (get_user (child_tidptr, &usp[4]))
121 return -EFAULT;
122 }
123#else
124 child_tidptr = (int __user *) regs.regs[8];
125#endif
126 return do_fork(clone_flags, newsp, 0,
127 parent_tidptr, child_tidptr);
128}
129 87
130SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) 88SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
131{ 89{
@@ -138,10 +96,10 @@ SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
138 return 0; 96 return 0;
139} 97}
140 98
141static inline int mips_atomic_set(struct pt_regs *regs, 99static inline int mips_atomic_set(unsigned long addr, unsigned long new)
142 unsigned long addr, unsigned long new)
143{ 100{
144 unsigned long old, tmp; 101 unsigned long old, tmp;
102 struct pt_regs *regs;
145 unsigned int err; 103 unsigned int err;
146 104
147 if (unlikely(addr & 3)) 105 if (unlikely(addr & 3))
@@ -222,6 +180,7 @@ static inline int mips_atomic_set(struct pt_regs *regs,
222 if (unlikely(err)) 180 if (unlikely(err))
223 return err; 181 return err;
224 182
183 regs = current_pt_regs();
225 regs->regs[2] = old; 184 regs->regs[2] = old;
226 regs->regs[7] = 0; /* No error */ 185 regs->regs[7] = 0; /* No error */
227 186
@@ -235,22 +194,14 @@ static inline int mips_atomic_set(struct pt_regs *regs,
235 : "r" (regs)); 194 : "r" (regs));
236 195
237 /* unreached. Honestly. */ 196 /* unreached. Honestly. */
238 while (1); 197 unreachable();
239} 198}
240 199
241save_static_function(sys_sysmips); 200SYSCALL_DEFINE3(sysmips, long, cmd, long, arg1, long, arg2)
242static int __used noinline
243_sys_sysmips(nabi_no_regargs struct pt_regs regs)
244{ 201{
245 long cmd, arg1, arg2;
246
247 cmd = regs.regs[4];
248 arg1 = regs.regs[5];
249 arg2 = regs.regs[6];
250
251 switch (cmd) { 202 switch (cmd) {
252 case MIPS_ATOMIC_SET: 203 case MIPS_ATOMIC_SET:
253 return mips_atomic_set(&regs, arg1, arg2); 204 return mips_atomic_set(arg1, arg2);
254 205
255 case MIPS_FIXADE: 206 case MIPS_FIXADE:
256 if (arg1 & ~3) 207 if (arg1 & ~3)
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index e70001cfa05b..ad0caea0bfea 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -10,6 +10,8 @@ config MN10300
10 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER 10 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
11 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
12 select MODULES_USE_ELF_RELA 12 select MODULES_USE_ELF_RELA
13 select OLD_SIGSUSPEND3
14 select OLD_SIGACTION
13 15
14config AM33_2 16config AM33_2
15 def_bool n 17 def_bool n
diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h
index d280e9780793..214ff5e9fe60 100644
--- a/arch/mn10300/include/asm/signal.h
+++ b/arch/mn10300/include/asm/signal.h
@@ -26,23 +26,8 @@ typedef struct {
26 unsigned long sig[_NSIG_WORDS]; 26 unsigned long sig[_NSIG_WORDS];
27} sigset_t; 27} sigset_t;
28 28
29struct old_sigaction { 29#define __ARCH_HAS_SA_RESTORER
30 __sighandler_t sa_handler; 30
31 old_sigset_t sa_mask;
32 unsigned long sa_flags;
33 __sigrestore_t sa_restorer;
34};
35
36struct sigaction {
37 __sighandler_t sa_handler;
38 unsigned long sa_flags;
39 __sigrestore_t sa_restorer;
40 sigset_t sa_mask; /* mask last for extensibility */
41};
42
43struct k_sigaction {
44 struct sigaction sa;
45};
46#include <asm/sigcontext.h> 31#include <asm/sigcontext.h>
47 32
48#endif /* _ASM_SIGNAL_H */ 33#endif /* _ASM_SIGNAL_H */
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index e6d2ed4ba68f..7f9d9adfa51e 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -41,8 +41,6 @@
41#define __ARCH_WANT_SYS_OLDUMOUNT 41#define __ARCH_WANT_SYS_OLDUMOUNT
42#define __ARCH_WANT_SYS_SIGPENDING 42#define __ARCH_WANT_SYS_SIGPENDING
43#define __ARCH_WANT_SYS_SIGPROCMASK 43#define __ARCH_WANT_SYS_SIGPROCMASK
44#define __ARCH_WANT_SYS_RT_SIGACTION
45#define __ARCH_WANT_SYS_RT_SIGSUSPEND
46#define __ARCH_WANT_SYS_FORK 44#define __ARCH_WANT_SYS_FORK
47#define __ARCH_WANT_SYS_VFORK 45#define __ARCH_WANT_SYS_VFORK
48#define __ARCH_WANT_SYS_CLONE 46#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index f570b3085ef9..9dfac5cd16e6 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -32,59 +32,6 @@
32#define DEBUG_SIG 0 32#define DEBUG_SIG 0
33 33
34/* 34/*
35 * atomically swap in the new signal mask, and wait for a signal.
36 */
37asmlinkage long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
38{
39 sigset_t blocked;
40 siginitset(&blocked, mask);
41 return sigsuspend(&blocked);
42}
43
44/*
45 * set signal action syscall
46 */
47asmlinkage long sys_sigaction(int sig,
48 const struct old_sigaction __user *act,
49 struct old_sigaction __user *oact)
50{
51 struct k_sigaction new_ka, old_ka;
52 int ret;
53
54 if (act) {
55 old_sigset_t mask;
56 if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
57 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
58 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
59 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
60 __get_user(mask, &act->sa_mask))
61 return -EFAULT;
62 siginitset(&new_ka.sa.sa_mask, mask);
63 }
64
65 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
66
67 if (!ret && oact) {
68 if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
69 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
70 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
71 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
72 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
73 return -EFAULT;
74 }
75
76 return ret;
77}
78
79/*
80 * set alternate signal stack syscall
81 */
82asmlinkage long sys_sigaltstack(const stack_t __user *uss, stack_t *uoss)
83{
84 return do_sigaltstack(uss, uoss, current_frame()->sp);
85}
86
87/*
88 * do a signal return; undo the signal stack. 35 * do a signal return; undo the signal stack.
89 */ 36 */
90static int restore_sigcontext(struct pt_regs *regs, 37static int restore_sigcontext(struct pt_regs *regs,
@@ -193,8 +140,7 @@ asmlinkage long sys_rt_sigreturn(void)
193 if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0)) 140 if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0))
194 goto badframe; 141 goto badframe;
195 142
196 if (do_sigaltstack(&frame->uc.uc_stack, NULL, current_frame()->sp) == 143 if (restore_altstack(&frame->uc.uc_stack))
197 -EFAULT)
198 goto badframe; 144 goto badframe;
199 145
200 return d0; 146 return d0;
@@ -359,9 +305,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
359 /* create the ucontext. */ 305 /* create the ucontext. */
360 if (__put_user(0, &frame->uc.uc_flags) || 306 if (__put_user(0, &frame->uc.uc_flags) ||
361 __put_user(0, &frame->uc.uc_link) || 307 __put_user(0, &frame->uc.uc_link) ||
362 __put_user((void *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) || 308 __save_altstack(&frame->uc.uc_stack, regs->sp) ||
363 __put_user(sas_ss_flags(regs->sp), &frame->uc.uc_stack.ss_flags) ||
364 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size) ||
365 setup_sigcontext(&frame->uc.uc_mcontext, 309 setup_sigcontext(&frame->uc.uc_mcontext,
366 &frame->fpuctx, regs, set->sig[0]) || 310 &frame->fpuctx, regs, set->sig[0]) ||
367 __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set))) 311 __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)))
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index 5e5b30601bbf..54afd0a129fe 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -1083,10 +1083,6 @@ ENTRY(__sys_fork)
1083 l.j _fork_save_extra_regs_and_call 1083 l.j _fork_save_extra_regs_and_call
1084 l.addi r3,r1,0 1084 l.addi r3,r1,0
1085 1085
1086ENTRY(sys_sigaltstack)
1087 l.j _sys_sigaltstack
1088 l.addi r5,r1,0
1089
1090ENTRY(sys_rt_sigreturn) 1086ENTRY(sys_rt_sigreturn)
1091 l.j _sys_rt_sigreturn 1087 l.j _sys_rt_sigreturn
1092 l.addi r3,r1,0 1088 l.addi r3,r1,0
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index ddedc8a77861..ae167f7e081a 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -33,12 +33,6 @@
33 33
34#define DEBUG_SIG 0 34#define DEBUG_SIG 0
35 35
36asmlinkage long
37_sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
38{
39 return do_sigaltstack(uss, uoss, regs->sp);
40}
41
42struct rt_sigframe { 36struct rt_sigframe {
43 struct siginfo *pinfo; 37 struct siginfo *pinfo;
44 void *puc; 38 void *puc;
@@ -103,9 +97,7 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
103 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 97 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
104 goto badframe; 98 goto badframe;
105 99
106 /* It is more difficult to avoid calling this function than to 100 if (restore_altstack(&frame->uc.uc_stack))
107 call it and ignore errors. */
108 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
109 goto badframe; 101 goto badframe;
110 102
111 return regs->gpr[11]; 103 return regs->gpr[11];
@@ -205,10 +197,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
205 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 197 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
206 err |= __put_user(0, &frame->uc.uc_flags); 198 err |= __put_user(0, &frame->uc.uc_flags);
207 err |= __put_user(NULL, &frame->uc.uc_link); 199 err |= __put_user(NULL, &frame->uc.uc_link);
208 err |= __put_user((void *)current->sas_ss_sp, 200 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
209 &frame->uc.uc_stack.ss_sp);
210 err |= __put_user(sas_ss_flags(regs->sp), &frame->uc.uc_stack.ss_flags);
211 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
212 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 201 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
213 202
214 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 203 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
diff --git a/arch/parisc/include/asm/signal.h b/arch/parisc/include/asm/signal.h
index b1a7c4c4a53a..81a545773971 100644
--- a/arch/parisc/include/asm/signal.h
+++ b/arch/parisc/include/asm/signal.h
@@ -20,15 +20,13 @@ typedef struct {
20 unsigned long sig[_NSIG_WORDS]; 20 unsigned long sig[_NSIG_WORDS];
21} sigset_t; 21} sigset_t;
22 22
23#ifndef __KERNEL__
23struct sigaction { 24struct sigaction {
24 __sighandler_t sa_handler; 25 __sighandler_t sa_handler;
25 unsigned long sa_flags; 26 unsigned long sa_flags;
26 sigset_t sa_mask; /* mask last for extensibility */ 27 sigset_t sa_mask; /* mask last for extensibility */
27}; 28};
28 29#endif
29struct k_sigaction {
30 struct sigaction sa;
31};
32 30
33#include <asm/sigcontext.h> 31#include <asm/sigcontext.h>
34 32
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index 74f801ebbe77..ae9a46cbfd92 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -161,9 +161,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
161#define __ARCH_WANT_SYS_OLDUMOUNT 161#define __ARCH_WANT_SYS_OLDUMOUNT
162#define __ARCH_WANT_SYS_SIGPENDING 162#define __ARCH_WANT_SYS_SIGPENDING
163#define __ARCH_WANT_SYS_SIGPROCMASK 163#define __ARCH_WANT_SYS_SIGPROCMASK
164#define __ARCH_WANT_SYS_RT_SIGACTION
165#define __ARCH_WANT_SYS_RT_SIGSUSPEND
166#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
167#define __ARCH_WANT_SYS_FORK 164#define __ARCH_WANT_SYS_FORK
168#define __ARCH_WANT_SYS_VFORK 165#define __ARCH_WANT_SYS_VFORK
169#define __ARCH_WANT_SYS_CLONE 166#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 7c9648919c91..f33201bf8977 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -1748,44 +1748,6 @@ ENTRY(sys_rt_sigreturn_wrapper)
1748 LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */ 1748 LDREG PT_GR28(%r1),%r28 /* reload original r28 for syscall_exit */
1749ENDPROC(sys_rt_sigreturn_wrapper) 1749ENDPROC(sys_rt_sigreturn_wrapper)
1750 1750
1751ENTRY(sys_sigaltstack_wrapper)
1752 /* Get the user stack pointer */
1753 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
1754 ldo TASK_REGS(%r1),%r24 /* get pt regs */
1755 LDREG TASK_PT_GR30(%r24),%r24
1756 STREG %r2, -RP_OFFSET(%r30)
1757#ifdef CONFIG_64BIT
1758 ldo FRAME_SIZE(%r30), %r30
1759 BL do_sigaltstack,%r2
1760 ldo -16(%r30),%r29 /* Reference param save area */
1761#else
1762 BL do_sigaltstack,%r2
1763 ldo FRAME_SIZE(%r30), %r30
1764#endif
1765
1766 ldo -FRAME_SIZE(%r30), %r30
1767 LDREG -RP_OFFSET(%r30), %r2
1768 bv %r0(%r2)
1769 nop
1770ENDPROC(sys_sigaltstack_wrapper)
1771
1772#ifdef CONFIG_64BIT
1773ENTRY(sys32_sigaltstack_wrapper)
1774 /* Get the user stack pointer */
1775 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r24
1776 LDREG TASK_PT_GR30(%r24),%r24
1777 STREG %r2, -RP_OFFSET(%r30)
1778 ldo FRAME_SIZE(%r30), %r30
1779 BL do_sigaltstack32,%r2
1780 ldo -16(%r30),%r29 /* Reference param save area */
1781
1782 ldo -FRAME_SIZE(%r30), %r30
1783 LDREG -RP_OFFSET(%r30), %r2
1784 bv %r0(%r2)
1785 nop
1786ENDPROC(sys32_sigaltstack_wrapper)
1787#endif
1788
1789ENTRY(syscall_exit) 1751ENTRY(syscall_exit)
1790 /* NOTE: HP-UX syscalls also come through here 1752 /* NOTE: HP-UX syscalls also come through here
1791 * after hpux_syscall_exit fixes up return 1753 * after hpux_syscall_exit fixes up return
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 52c85b2f502e..98e9e7126565 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -143,7 +143,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
143 goto give_sigsegv; 143 goto give_sigsegv;
144 DBG(1,"sys_rt_sigreturn: usp %#08lx stack 0x%p\n", 144 DBG(1,"sys_rt_sigreturn: usp %#08lx stack 0x%p\n",
145 usp, &compat_frame->uc.uc_stack); 145 usp, &compat_frame->uc.uc_stack);
146 if (do_sigaltstack32(&compat_frame->uc.uc_stack, NULL, usp) == -EFAULT) 146 if (compat_restore_altstack(&compat_frame->uc.uc_stack))
147 goto give_sigsegv; 147 goto give_sigsegv;
148 } else 148 } else
149#endif 149#endif
@@ -154,7 +154,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
154 goto give_sigsegv; 154 goto give_sigsegv;
155 DBG(1,"sys_rt_sigreturn: usp %#08lx stack 0x%p\n", 155 DBG(1,"sys_rt_sigreturn: usp %#08lx stack 0x%p\n",
156 usp, &frame->uc.uc_stack); 156 usp, &frame->uc.uc_stack);
157 if (do_sigaltstack(&frame->uc.uc_stack, NULL, usp) == -EFAULT) 157 if (restore_altstack(&frame->uc.uc_stack))
158 goto give_sigsegv; 158 goto give_sigsegv;
159 } 159 }
160 160
@@ -262,15 +262,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
262 if (is_compat_task()) { 262 if (is_compat_task()) {
263 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); 263 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
264 err |= copy_siginfo_to_user32(&compat_frame->info, info); 264 err |= copy_siginfo_to_user32(&compat_frame->info, info);
265 DBG(1,"SETUP_RT_FRAME: 1\n"); 265 err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]);
266 compat_val = (compat_int_t)current->sas_ss_sp;
267 err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_sp);
268 DBG(1,"SETUP_RT_FRAME: 2\n");
269 compat_val = (compat_int_t)current->sas_ss_size;
270 err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_size);
271 DBG(1,"SETUP_RT_FRAME: 3\n");
272 compat_val = sas_ss_flags(regs->gr[30]);
273 err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_flags);
274 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc); 266 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc);
275 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext); 267 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext);
276 err |= setup_sigcontext32(&compat_frame->uc.uc_mcontext, 268 err |= setup_sigcontext32(&compat_frame->uc.uc_mcontext,
@@ -282,10 +274,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
282 { 274 {
283 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info); 275 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info);
284 err |= copy_siginfo_to_user(&frame->info, info); 276 err |= copy_siginfo_to_user(&frame->info, info);
285 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 277 err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]);
286 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
287 err |= __put_user(sas_ss_flags(regs->gr[30]),
288 &frame->uc.uc_stack.ss_flags);
289 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc); 278 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc);
290 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext); 279 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext);
291 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, in_syscall); 280 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, in_syscall);
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index 2ddcabb616ce..33eca1b04926 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -60,136 +60,6 @@ sigset_64to32(compat_sigset_t *s32, sigset_t *s64)
60 s32->sig[1] = (s64->sig[0] >> 32) & 0xffffffffUL; 60 s32->sig[1] = (s64->sig[0] >> 32) & 0xffffffffUL;
61} 61}
62 62
63static int
64put_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
65{
66 compat_sigset_t s;
67
68 if (sz != sizeof(compat_sigset_t))
69 return -EINVAL;
70 sigset_64to32(&s, set);
71
72 return copy_to_user(up, &s, sizeof s);
73}
74
75static int
76get_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
77{
78 compat_sigset_t s;
79 int r;
80
81 if (sz != sizeof(compat_sigset_t))
82 return -EINVAL;
83
84 if ((r = copy_from_user(&s, up, sz)) == 0) {
85 sigset_32to64(set, &s);
86 }
87
88 return r;
89}
90
91int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset,
92 unsigned int sigsetsize)
93{
94 sigset_t old_set, new_set;
95 int ret;
96
97 if (set) {
98 ret = get_sigset32(set, &new_set, sigsetsize);
99 if (ret)
100 return ret;
101 }
102
103 KERNEL_SYSCALL(ret, sys_rt_sigprocmask, how, set ? (sigset_t __user *)&new_set : NULL,
104 oset ? (sigset_t __user *)&old_set : NULL, sigsetsize);
105
106 if (!ret && oset && put_sigset32(oset, &old_set, sigsetsize))
107 return -EFAULT;
108
109 return ret;
110}
111
112
113int sys32_rt_sigpending(compat_sigset_t __user *uset, unsigned int sigsetsize)
114{
115 int ret;
116 sigset_t set;
117
118 KERNEL_SYSCALL(ret, sys_rt_sigpending, (sigset_t __user *)&set, sigsetsize);
119
120 if (!ret && put_sigset32(uset, &set, sigsetsize))
121 return -EFAULT;
122
123 return ret;
124}
125
126long
127sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, struct sigaction32 __user *oact,
128 size_t sigsetsize)
129{
130 struct k_sigaction32 new_sa32, old_sa32;
131 struct k_sigaction new_sa, old_sa;
132 int ret = -EINVAL;
133
134 /* XXX: Don't preclude handling different sized sigset_t's. */
135 if (sigsetsize != sizeof(compat_sigset_t))
136 return -EINVAL;
137
138 if (act) {
139 if (copy_from_user(&new_sa32.sa, act, sizeof new_sa32.sa))
140 return -EFAULT;
141 new_sa.sa.sa_handler = (__sighandler_t)(unsigned long)new_sa32.sa.sa_handler;
142 new_sa.sa.sa_flags = new_sa32.sa.sa_flags;
143 sigset_32to64(&new_sa.sa.sa_mask, &new_sa32.sa.sa_mask);
144 }
145
146 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
147
148 if (!ret && oact) {
149 sigset_64to32(&old_sa32.sa.sa_mask, &old_sa.sa.sa_mask);
150 old_sa32.sa.sa_flags = old_sa.sa.sa_flags;
151 old_sa32.sa.sa_handler = (__sighandler_t32)(unsigned long)old_sa.sa.sa_handler;
152 if (copy_to_user(oact, &old_sa32.sa, sizeof old_sa32.sa))
153 return -EFAULT;
154 }
155 return ret;
156}
157
158int
159do_sigaltstack32 (const compat_stack_t __user *uss32, compat_stack_t __user *uoss32, unsigned long sp)
160{
161 compat_stack_t ss32, oss32;
162 stack_t ss, oss;
163 stack_t *ssp = NULL, *ossp = NULL;
164 int ret;
165
166 if (uss32) {
167 if (copy_from_user(&ss32, uss32, sizeof ss32))
168 return -EFAULT;
169
170 ss.ss_sp = (void __user *)(unsigned long)ss32.ss_sp;
171 ss.ss_flags = ss32.ss_flags;
172 ss.ss_size = ss32.ss_size;
173
174 ssp = &ss;
175 }
176
177 if (uoss32)
178 ossp = &oss;
179
180 KERNEL_SYSCALL(ret, do_sigaltstack, (const stack_t __user *)ssp, (stack_t __user *)ossp, sp);
181
182 if (!ret && uoss32) {
183 oss32.ss_sp = (unsigned int)(unsigned long)oss.ss_sp;
184 oss32.ss_flags = oss.ss_flags;
185 oss32.ss_size = oss.ss_size;
186 if (copy_to_user(uoss32, &oss32, sizeof *uoss32))
187 return -EFAULT;
188 }
189
190 return ret;
191}
192
193long 63long
194restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf, 64restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf,
195 struct pt_regs *regs) 65 struct pt_regs *regs)
@@ -506,22 +376,3 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
506 } 376 }
507 return err; 377 return err;
508} 378}
509
510asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
511 struct compat_siginfo __user *uinfo)
512{
513 siginfo_t info;
514
515 if (copy_siginfo_from_user32(&info, uinfo))
516 return -EFAULT;
517
518 /* Not even root can pretend to send signals from the kernel.
519 Nor can they impersonate a kill(), which adds source info. */
520 if (info.si_code >= 0)
521 return -EPERM;
522 info.si_signo = sig;
523
524 /* POSIX.1b doesn't mention process groups. */
525 return kill_proc_info(sig, &info, pid);
526}
527
diff --git a/arch/parisc/kernel/signal32.h b/arch/parisc/kernel/signal32.h
index 08a88b5349a2..72ab41a51f32 100644
--- a/arch/parisc/kernel/signal32.h
+++ b/arch/parisc/kernel/signal32.h
@@ -21,23 +21,6 @@
21 21
22#include <linux/compat.h> 22#include <linux/compat.h>
23 23
24typedef compat_uptr_t compat_sighandler_t;
25
26typedef struct compat_sigaltstack {
27 compat_uptr_t ss_sp;
28 compat_int_t ss_flags;
29 compat_size_t ss_size;
30} compat_stack_t;
31
32/* Most things should be clean enough to redefine this at will, if care
33 is taken to make libc match. */
34
35struct compat_sigaction {
36 compat_sighandler_t sa_handler;
37 compat_uint_t sa_flags;
38 compat_sigset_t sa_mask; /* mask last for extensibility */
39};
40
41/* 32-bit ucontext as seen from an 64-bit kernel */ 24/* 32-bit ucontext as seen from an 64-bit kernel */
42struct compat_ucontext { 25struct compat_ucontext {
43 compat_uint_t uc_flags; 26 compat_uint_t uc_flags;
@@ -51,10 +34,6 @@ struct compat_ucontext {
51 34
52/* ELF32 signal handling */ 35/* ELF32 signal handling */
53 36
54struct k_sigaction32 {
55 struct compat_sigaction sa;
56};
57
58int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from); 37int copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from);
59int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from); 38int copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from);
60 39
@@ -102,8 +81,6 @@ struct compat_rt_sigframe {
102 81
103void sigset_32to64(sigset_t *s64, compat_sigset_t *s32); 82void sigset_32to64(sigset_t *s64, compat_sigset_t *s32);
104void sigset_64to32(compat_sigset_t *s32, sigset_t *s64); 83void sigset_64to32(compat_sigset_t *s32, sigset_t *s64);
105int do_sigaltstack32 (const compat_stack_t __user *uss32,
106 compat_stack_t __user *uoss32, unsigned long sp);
107long restore_sigcontext32(struct compat_sigcontext __user *sc, 84long restore_sigcontext32(struct compat_sigcontext __user *sc,
108 struct compat_regfile __user *rf, 85 struct compat_regfile __user *rf,
109 struct pt_regs *regs); 86 struct pt_regs *regs);
diff --git a/arch/parisc/kernel/sys32.h b/arch/parisc/kernel/sys32.h
index 06c2090cfaba..60dd470f39f8 100644
--- a/arch/parisc/kernel/sys32.h
+++ b/arch/parisc/kernel/sys32.h
@@ -33,16 +33,4 @@
33 set_fs (old_fs); \ 33 set_fs (old_fs); \
34} 34}
35 35
36#ifdef CONFIG_COMPAT
37
38typedef __u32 __sighandler_t32;
39
40struct sigaction32 {
41 __sighandler_t32 sa_handler;
42 unsigned int sa_flags;
43 compat_sigset_t sa_mask; /* mask last for extensibility */
44};
45
46#endif
47
48#endif 36#endif
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 129fd472c471..fc9cab1cc2df 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -252,7 +252,7 @@
252 ENTRY_SAME(mremap) 252 ENTRY_SAME(mremap)
253 ENTRY_SAME(setresuid) 253 ENTRY_SAME(setresuid)
254 ENTRY_SAME(getresuid) /* 165 */ 254 ENTRY_SAME(getresuid) /* 165 */
255 ENTRY_DIFF(sigaltstack_wrapper) 255 ENTRY_COMP(sigaltstack)
256 ENTRY_SAME(ni_syscall) /* query_module */ 256 ENTRY_SAME(ni_syscall) /* query_module */
257 ENTRY_SAME(poll) 257 ENTRY_SAME(poll)
258 /* structs contain pointers and an in_addr... */ 258 /* structs contain pointers and an in_addr... */
@@ -262,9 +262,9 @@
262 ENTRY_SAME(prctl) 262 ENTRY_SAME(prctl)
263 /* signals need a careful review */ 263 /* signals need a careful review */
264 ENTRY_SAME(rt_sigreturn_wrapper) 264 ENTRY_SAME(rt_sigreturn_wrapper)
265 ENTRY_DIFF(rt_sigaction) 265 ENTRY_COMP(rt_sigaction)
266 ENTRY_DIFF(rt_sigprocmask) /* 175 */ 266 ENTRY_COMP(rt_sigprocmask) /* 175 */
267 ENTRY_DIFF(rt_sigpending) 267 ENTRY_COMP(rt_sigpending)
268 ENTRY_COMP(rt_sigtimedwait) 268 ENTRY_COMP(rt_sigtimedwait)
269 /* even though the struct siginfo_t is different, it appears like 269 /* even though the struct siginfo_t is different, it appears like
270 * all the paths use values which should be same wide and narrow. 270 * all the paths use values which should be same wide and narrow.
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a5255f242be9..5c7470689a10 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -143,6 +143,8 @@ config PPC
143 select MODULES_USE_ELF_RELA 143 select MODULES_USE_ELF_RELA
144 select CLONE_BACKWARDS 144 select CLONE_BACKWARDS
145 select ARCH_USE_BUILTIN_BSWAP 145 select ARCH_USE_BUILTIN_BSWAP
146 select OLD_SIGSUSPEND
147 select OLD_SIGACTION if PPC32
146 148
147config EARLY_PRINTK 149config EARLY_PRINTK
148 bool 150 bool
@@ -153,6 +155,7 @@ config COMPAT
153 default y if PPC64 155 default y if PPC64
154 select COMPAT_BINFMT_ELF 156 select COMPAT_BINFMT_ELF
155 select ARCH_WANT_OLD_COMPAT_IPC 157 select ARCH_WANT_OLD_COMPAT_IPC
158 select COMPAT_OLD_SIGACTION
156 159
157config SYSVIPC_COMPAT 160config SYSVIPC_COMPAT
158 bool 161 bool
diff --git a/arch/powerpc/include/asm/signal.h b/arch/powerpc/include/asm/signal.h
index a101637725a2..fbe66c463891 100644
--- a/arch/powerpc/include/asm/signal.h
+++ b/arch/powerpc/include/asm/signal.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_POWERPC_SIGNAL_H 1#ifndef _ASM_POWERPC_SIGNAL_H
2#define _ASM_POWERPC_SIGNAL_H 2#define _ASM_POWERPC_SIGNAL_H
3 3
4#define __ARCH_HAS_SA_RESTORER
4#include <uapi/asm/signal.h> 5#include <uapi/asm/signal.h>
5 6
6#endif /* _ASM_POWERPC_SIGNAL_H */ 7#endif /* _ASM_POWERPC_SIGNAL_H */
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index b5308d3e6d39..23be8f1e7e64 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -5,11 +5,8 @@
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <asm/signal.h>
9 8
10struct pt_regs;
11struct rtas_args; 9struct rtas_args;
12struct sigaction;
13 10
14asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, 11asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
15 unsigned long prot, unsigned long flags, 12 unsigned long prot, unsigned long flags,
@@ -17,20 +14,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
17asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, 14asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
18 unsigned long prot, unsigned long flags, 15 unsigned long prot, unsigned long flags,
19 unsigned long fd, unsigned long pgoff); 16 unsigned long fd, unsigned long pgoff);
20asmlinkage long sys_pipe(int __user *fildes);
21asmlinkage long sys_pipe2(int __user *fildes, int flags);
22asmlinkage long sys_rt_sigaction(int sig,
23 const struct sigaction __user *act,
24 struct sigaction __user *oact, size_t sigsetsize);
25asmlinkage long ppc64_personality(unsigned long personality); 17asmlinkage long ppc64_personality(unsigned long personality);
26asmlinkage int ppc_rtas(struct rtas_args __user *uargs); 18asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
27asmlinkage time_t sys64_time(time_t __user * tloc);
28
29asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset,
30 size_t sigsetsize);
31asmlinkage long sys_sigaltstack(const stack_t __user *uss,
32 stack_t __user *uoss, unsigned long r5, unsigned long r6,
33 unsigned long r7, unsigned long r8, struct pt_regs *regs);
34 19
35#endif /* __KERNEL__ */ 20#endif /* __KERNEL__ */
36#endif /* __ASM_POWERPC_SYSCALLS_H */ 21#endif /* __ASM_POWERPC_SYSCALLS_H */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 97909d3b1d7b..d906f33441c6 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -10,8 +10,8 @@ SYSCALL_SPU(read)
10SYSCALL_SPU(write) 10SYSCALL_SPU(write)
11COMPAT_SYS_SPU(open) 11COMPAT_SYS_SPU(open)
12SYSCALL_SPU(close) 12SYSCALL_SPU(close)
13COMPAT_SYS_SPU(waitpid) 13SYSCALL_SPU(waitpid)
14COMPAT_SYS_SPU(creat) 14SYSCALL_SPU(creat)
15SYSCALL_SPU(link) 15SYSCALL_SPU(link)
16SYSCALL_SPU(unlink) 16SYSCALL_SPU(unlink)
17COMPAT_SYS(execve) 17COMPAT_SYS(execve)
@@ -36,13 +36,13 @@ SYSCALL(pause)
36COMPAT_SYS(utime) 36COMPAT_SYS(utime)
37SYSCALL(ni_syscall) 37SYSCALL(ni_syscall)
38SYSCALL(ni_syscall) 38SYSCALL(ni_syscall)
39COMPAT_SYS_SPU(access) 39SYSCALL_SPU(access)
40COMPAT_SYS_SPU(nice) 40SYSCALL_SPU(nice)
41SYSCALL(ni_syscall) 41SYSCALL(ni_syscall)
42SYSCALL_SPU(sync) 42SYSCALL_SPU(sync)
43COMPAT_SYS_SPU(kill) 43SYSCALL_SPU(kill)
44SYSCALL_SPU(rename) 44SYSCALL_SPU(rename)
45COMPAT_SYS_SPU(mkdir) 45SYSCALL_SPU(mkdir)
46SYSCALL_SPU(rmdir) 46SYSCALL_SPU(rmdir)
47SYSCALL_SPU(dup) 47SYSCALL_SPU(dup)
48SYSCALL_SPU(pipe) 48SYSCALL_SPU(pipe)
@@ -60,10 +60,10 @@ SYSCALL(ni_syscall)
60COMPAT_SYS_SPU(ioctl) 60COMPAT_SYS_SPU(ioctl)
61COMPAT_SYS_SPU(fcntl) 61COMPAT_SYS_SPU(fcntl)
62SYSCALL(ni_syscall) 62SYSCALL(ni_syscall)
63COMPAT_SYS_SPU(setpgid) 63SYSCALL_SPU(setpgid)
64SYSCALL(ni_syscall) 64SYSCALL(ni_syscall)
65SYSX(sys_ni_syscall,sys_olduname, sys_olduname) 65SYSX(sys_ni_syscall,sys_olduname, sys_olduname)
66COMPAT_SYS_SPU(umask) 66SYSCALL_SPU(umask)
67SYSCALL_SPU(chroot) 67SYSCALL_SPU(chroot)
68COMPAT_SYS(ustat) 68COMPAT_SYS(ustat)
69SYSCALL_SPU(dup2) 69SYSCALL_SPU(dup2)
@@ -72,23 +72,24 @@ SYSCALL_SPU(getpgrp)
72SYSCALL_SPU(setsid) 72SYSCALL_SPU(setsid)
73SYS32ONLY(sigaction) 73SYS32ONLY(sigaction)
74SYSCALL_SPU(sgetmask) 74SYSCALL_SPU(sgetmask)
75COMPAT_SYS_SPU(ssetmask) 75SYSCALL_SPU(ssetmask)
76SYSCALL_SPU(setreuid) 76SYSCALL_SPU(setreuid)
77SYSCALL_SPU(setregid) 77SYSCALL_SPU(setregid)
78#define compat_sys_sigsuspend sys_sigsuspend
78SYS32ONLY(sigsuspend) 79SYS32ONLY(sigsuspend)
79COMPAT_SYS(sigpending) 80COMPAT_SYS(sigpending)
80COMPAT_SYS_SPU(sethostname) 81SYSCALL_SPU(sethostname)
81COMPAT_SYS_SPU(setrlimit) 82COMPAT_SYS_SPU(setrlimit)
82COMPAT_SYS(old_getrlimit) 83COMPAT_SYS(old_getrlimit)
83COMPAT_SYS_SPU(getrusage) 84COMPAT_SYS_SPU(getrusage)
84COMPAT_SYS_SPU(gettimeofday) 85COMPAT_SYS_SPU(gettimeofday)
85COMPAT_SYS_SPU(settimeofday) 86COMPAT_SYS_SPU(settimeofday)
86COMPAT_SYS_SPU(getgroups) 87SYSCALL_SPU(getgroups)
87COMPAT_SYS_SPU(setgroups) 88SYSCALL_SPU(setgroups)
88SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select) 89SYSX(sys_ni_syscall,sys_ni_syscall,ppc_select)
89SYSCALL_SPU(symlink) 90SYSCALL_SPU(symlink)
90OLDSYS(lstat) 91OLDSYS(lstat)
91COMPAT_SYS_SPU(readlink) 92SYSCALL_SPU(readlink)
92SYSCALL(uselib) 93SYSCALL(uselib)
93SYSCALL(swapon) 94SYSCALL(swapon)
94SYSCALL(reboot) 95SYSCALL(reboot)
@@ -99,14 +100,14 @@ COMPAT_SYS_SPU(truncate)
99COMPAT_SYS_SPU(ftruncate) 100COMPAT_SYS_SPU(ftruncate)
100SYSCALL_SPU(fchmod) 101SYSCALL_SPU(fchmod)
101SYSCALL_SPU(fchown) 102SYSCALL_SPU(fchown)
102COMPAT_SYS_SPU(getpriority) 103SYSCALL_SPU(getpriority)
103COMPAT_SYS_SPU(setpriority) 104SYSCALL_SPU(setpriority)
104SYSCALL(ni_syscall) 105SYSCALL(ni_syscall)
105COMPAT_SYS(statfs) 106COMPAT_SYS(statfs)
106COMPAT_SYS(fstatfs) 107COMPAT_SYS(fstatfs)
107SYSCALL(ni_syscall) 108SYSCALL(ni_syscall)
108COMPAT_SYS_SPU(socketcall) 109COMPAT_SYS_SPU(socketcall)
109COMPAT_SYS_SPU(syslog) 110SYSCALL_SPU(syslog)
110COMPAT_SYS_SPU(setitimer) 111COMPAT_SYS_SPU(setitimer)
111COMPAT_SYS_SPU(getitimer) 112COMPAT_SYS_SPU(getitimer)
112COMPAT_SYS_SPU(newstat) 113COMPAT_SYS_SPU(newstat)
@@ -124,7 +125,7 @@ COMPAT_SYS(ipc)
124SYSCALL_SPU(fsync) 125SYSCALL_SPU(fsync)
125SYS32ONLY(sigreturn) 126SYS32ONLY(sigreturn)
126PPC_SYS(clone) 127PPC_SYS(clone)
127COMPAT_SYS_SPU(setdomainname) 128SYSCALL_SPU(setdomainname)
128SYSCALL_SPU(newuname) 129SYSCALL_SPU(newuname)
129SYSCALL(ni_syscall) 130SYSCALL(ni_syscall)
130COMPAT_SYS_SPU(adjtimex) 131COMPAT_SYS_SPU(adjtimex)
@@ -135,10 +136,10 @@ SYSCALL(init_module)
135SYSCALL(delete_module) 136SYSCALL(delete_module)
136SYSCALL(ni_syscall) 137SYSCALL(ni_syscall)
137SYSCALL(quotactl) 138SYSCALL(quotactl)
138COMPAT_SYS_SPU(getpgid) 139SYSCALL_SPU(getpgid)
139SYSCALL_SPU(fchdir) 140SYSCALL_SPU(fchdir)
140SYSCALL_SPU(bdflush) 141SYSCALL_SPU(bdflush)
141COMPAT_SYS(sysfs) 142SYSCALL_SPU(sysfs)
142SYSX_SPU(ppc64_personality,ppc64_personality,sys_personality) 143SYSX_SPU(ppc64_personality,ppc64_personality,sys_personality)
143SYSCALL(ni_syscall) 144SYSCALL(ni_syscall)
144SYSCALL_SPU(setfsuid) 145SYSCALL_SPU(setfsuid)
@@ -150,21 +151,21 @@ SYSCALL_SPU(flock)
150SYSCALL_SPU(msync) 151SYSCALL_SPU(msync)
151COMPAT_SYS_SPU(readv) 152COMPAT_SYS_SPU(readv)
152COMPAT_SYS_SPU(writev) 153COMPAT_SYS_SPU(writev)
153COMPAT_SYS_SPU(getsid) 154SYSCALL_SPU(getsid)
154SYSCALL_SPU(fdatasync) 155SYSCALL_SPU(fdatasync)
155COMPAT_SYS(sysctl) 156COMPAT_SYS(sysctl)
156SYSCALL_SPU(mlock) 157SYSCALL_SPU(mlock)
157SYSCALL_SPU(munlock) 158SYSCALL_SPU(munlock)
158SYSCALL_SPU(mlockall) 159SYSCALL_SPU(mlockall)
159SYSCALL_SPU(munlockall) 160SYSCALL_SPU(munlockall)
160COMPAT_SYS_SPU(sched_setparam) 161SYSCALL_SPU(sched_setparam)
161COMPAT_SYS_SPU(sched_getparam) 162SYSCALL_SPU(sched_getparam)
162COMPAT_SYS_SPU(sched_setscheduler) 163SYSCALL_SPU(sched_setscheduler)
163COMPAT_SYS_SPU(sched_getscheduler) 164SYSCALL_SPU(sched_getscheduler)
164SYSCALL_SPU(sched_yield) 165SYSCALL_SPU(sched_yield)
165COMPAT_SYS_SPU(sched_get_priority_max) 166SYSCALL_SPU(sched_get_priority_max)
166COMPAT_SYS_SPU(sched_get_priority_min) 167SYSCALL_SPU(sched_get_priority_min)
167SYSX_SPU(sys_sched_rr_get_interval,compat_sys_sched_rr_get_interval_wrapper,sys_sched_rr_get_interval) 168COMPAT_SYS_SPU(sched_rr_get_interval)
168COMPAT_SYS_SPU(nanosleep) 169COMPAT_SYS_SPU(nanosleep)
169SYSCALL_SPU(mremap) 170SYSCALL_SPU(mremap)
170SYSCALL_SPU(setresuid) 171SYSCALL_SPU(setresuid)
@@ -174,7 +175,7 @@ SYSCALL_SPU(poll)
174SYSCALL(ni_syscall) 175SYSCALL(ni_syscall)
175SYSCALL_SPU(setresgid) 176SYSCALL_SPU(setresgid)
176SYSCALL_SPU(getresgid) 177SYSCALL_SPU(getresgid)
177COMPAT_SYS_SPU(prctl) 178SYSCALL_SPU(prctl)
178COMPAT_SYS(rt_sigreturn) 179COMPAT_SYS(rt_sigreturn)
179COMPAT_SYS(rt_sigaction) 180COMPAT_SYS(rt_sigaction)
180COMPAT_SYS(rt_sigprocmask) 181COMPAT_SYS(rt_sigprocmask)
@@ -253,7 +254,7 @@ COMPAT_SYS_SPU(clock_gettime)
253COMPAT_SYS_SPU(clock_getres) 254COMPAT_SYS_SPU(clock_getres)
254COMPAT_SYS_SPU(clock_nanosleep) 255COMPAT_SYS_SPU(clock_nanosleep)
255SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext) 256SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext)
256COMPAT_SYS_SPU(tgkill) 257SYSCALL_SPU(tgkill)
257COMPAT_SYS_SPU(utimes) 258COMPAT_SYS_SPU(utimes)
258COMPAT_SYS_SPU(statfs64) 259COMPAT_SYS_SPU(statfs64)
259COMPAT_SYS_SPU(fstatfs64) 260COMPAT_SYS_SPU(fstatfs64)
@@ -276,8 +277,8 @@ COMPAT_SYS(add_key)
276COMPAT_SYS(request_key) 277COMPAT_SYS(request_key)
277COMPAT_SYS(keyctl) 278COMPAT_SYS(keyctl)
278COMPAT_SYS(waitid) 279COMPAT_SYS(waitid)
279COMPAT_SYS(ioprio_set) 280SYSCALL(ioprio_set)
280COMPAT_SYS(ioprio_get) 281SYSCALL(ioprio_get)
281SYSCALL(inotify_init) 282SYSCALL(inotify_init)
282SYSCALL(inotify_add_watch) 283SYSCALL(inotify_add_watch)
283SYSCALL(inotify_rm_watch) 284SYSCALL(inotify_rm_watch)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 1d4864a40e35..f25b5c45c435 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -44,17 +44,13 @@
44#define __ARCH_WANT_SYS_OLDUMOUNT 44#define __ARCH_WANT_SYS_OLDUMOUNT
45#define __ARCH_WANT_SYS_SIGPENDING 45#define __ARCH_WANT_SYS_SIGPENDING
46#define __ARCH_WANT_SYS_SIGPROCMASK 46#define __ARCH_WANT_SYS_SIGPROCMASK
47#define __ARCH_WANT_SYS_RT_SIGACTION
48#define __ARCH_WANT_SYS_RT_SIGSUSPEND
49#ifdef CONFIG_PPC32 47#ifdef CONFIG_PPC32
50#define __ARCH_WANT_OLD_STAT 48#define __ARCH_WANT_OLD_STAT
51#endif 49#endif
52#ifdef CONFIG_PPC64 50#ifdef CONFIG_PPC64
53#define __ARCH_WANT_COMPAT_SYS_TIME 51#define __ARCH_WANT_COMPAT_SYS_TIME
54#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
55#define __ARCH_WANT_SYS_NEWFSTATAT 52#define __ARCH_WANT_SYS_NEWFSTATAT
56#define __ARCH_WANT_COMPAT_SYS_SENDFILE 53#define __ARCH_WANT_COMPAT_SYS_SENDFILE
57#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
58#endif 54#endif
59#define __ARCH_WANT_SYS_FORK 55#define __ARCH_WANT_SYS_FORK
60#define __ARCH_WANT_SYS_VFORK 56#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/powerpc/include/uapi/asm/signal.h b/arch/powerpc/include/uapi/asm/signal.h
index e079fb39d5bc..6c69ee94fd8d 100644
--- a/arch/powerpc/include/uapi/asm/signal.h
+++ b/arch/powerpc/include/uapi/asm/signal.h
@@ -90,6 +90,7 @@ typedef struct {
90 90
91#include <asm-generic/signal-defs.h> 91#include <asm-generic/signal-defs.h>
92 92
93#ifndef __KERNEL__
93struct old_sigaction { 94struct old_sigaction {
94 __sighandler_t sa_handler; 95 __sighandler_t sa_handler;
95 old_sigset_t sa_mask; 96 old_sigset_t sa_mask;
@@ -103,10 +104,7 @@ struct sigaction {
103 __sigrestore_t sa_restorer; 104 __sigrestore_t sa_restorer;
104 sigset_t sa_mask; /* mask last for extensibility */ 105 sigset_t sa_mask; /* mask last for extensibility */
105}; 106};
106 107#endif
107struct k_sigaction {
108 struct sigaction sa;
109};
110 108
111typedef struct sigaltstack { 109typedef struct sigaltstack {
112 void __user *ss_sp; 110 void __user *ss_sp;
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h
index 02fb0ee26093..a27c914d5802 100644
--- a/arch/powerpc/kernel/ppc32.h
+++ b/arch/powerpc/kernel/ppc32.h
@@ -16,30 +16,6 @@
16 16
17/* These are here to support 32-bit syscalls on a 64-bit kernel. */ 17/* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 18
19#define __old_sigaction32 old_sigaction32
20
21struct __old_sigaction32 {
22 compat_uptr_t sa_handler;
23 compat_old_sigset_t sa_mask;
24 unsigned int sa_flags;
25 compat_uptr_t sa_restorer; /* not used by Linux/SPARC yet */
26};
27
28
29
30struct sigaction32 {
31 compat_uptr_t sa_handler; /* Really a pointer, but need to deal with 32 bits */
32 unsigned int sa_flags;
33 compat_uptr_t sa_restorer; /* Another 32 bit pointer */
34 compat_sigset_t sa_mask; /* A 32 bit mask */
35};
36
37typedef struct sigaltstack_32 {
38 unsigned int ss_sp;
39 int ss_flags;
40 compat_size_t ss_size;
41} stack_32_t;
42
43struct pt_regs32 { 19struct pt_regs32 {
44 unsigned int gpr[32]; 20 unsigned int gpr[32];
45 unsigned int nip; 21 unsigned int nip;
@@ -75,7 +51,7 @@ struct mcontext32 {
75struct ucontext32 { 51struct ucontext32 {
76 unsigned int uc_flags; 52 unsigned int uc_flags;
77 unsigned int uc_link; 53 unsigned int uc_link;
78 stack_32_t uc_stack; 54 compat_stack_t uc_stack;
79 int uc_pad[7]; 55 int uc_pad[7];
80 compat_uptr_t uc_regs; /* points to uc_mcontext field */ 56 compat_uptr_t uc_regs; /* points to uc_mcontext field */
81 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 57 compat_sigset_t uc_sigmask; /* mask last for extensibility */
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 3003d890e9ef..cf12eae02de5 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -170,10 +170,3 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
170 tracehook_notify_resume(regs); 170 tracehook_notify_resume(regs);
171 } 171 }
172} 172}
173
174long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
175 unsigned long r5, unsigned long r6, unsigned long r7,
176 unsigned long r8, struct pt_regs *regs)
177{
178 return do_sigaltstack(uss, uoss, regs->gpr[1]);
179}
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index e4a88d340de6..3acb28e245b4 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -57,10 +57,7 @@
57#undef DEBUG_SIG 57#undef DEBUG_SIG
58 58
59#ifdef CONFIG_PPC64 59#ifdef CONFIG_PPC64
60#define sys_sigsuspend compat_sys_sigsuspend
61#define sys_rt_sigsuspend compat_sys_rt_sigsuspend
62#define sys_rt_sigreturn compat_sys_rt_sigreturn 60#define sys_rt_sigreturn compat_sys_rt_sigreturn
63#define sys_sigaction compat_sys_sigaction
64#define sys_swapcontext compat_sys_swapcontext 61#define sys_swapcontext compat_sys_swapcontext
65#define sys_sigreturn compat_sys_sigreturn 62#define sys_sigreturn compat_sys_sigreturn
66 63
@@ -69,6 +66,8 @@
69#define mcontext mcontext32 66#define mcontext mcontext32
70#define ucontext ucontext32 67#define ucontext ucontext32
71 68
69#define __save_altstack __compat_save_altstack
70
72/* 71/*
73 * Userspace code may pass a ucontext which doesn't include VSX added 72 * Userspace code may pass a ucontext which doesn't include VSX added
74 * at the end. We need to check for this case. 73 * at the end. We need to check for this case.
@@ -131,23 +130,6 @@ static inline int get_sigset_t(sigset_t *set,
131 return 0; 130 return 0;
132} 131}
133 132
134static inline int get_old_sigaction(struct k_sigaction *new_ka,
135 struct old_sigaction __user *act)
136{
137 compat_old_sigset_t mask;
138 compat_uptr_t handler, restorer;
139
140 if (get_user(handler, &act->sa_handler) ||
141 __get_user(restorer, &act->sa_restorer) ||
142 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
143 __get_user(mask, &act->sa_mask))
144 return -EFAULT;
145 new_ka->sa.sa_handler = compat_ptr(handler);
146 new_ka->sa.sa_restorer = compat_ptr(restorer);
147 siginitset(&new_ka->sa.sa_mask, mask);
148 return 0;
149}
150
151#define to_user_ptr(p) ptr_to_compat(p) 133#define to_user_ptr(p) ptr_to_compat(p)
152#define from_user_ptr(p) compat_ptr(p) 134#define from_user_ptr(p) compat_ptr(p)
153 135
@@ -197,21 +179,6 @@ static inline int get_sigset_t(sigset_t *set, const sigset_t __user *uset)
197 return copy_from_user(set, uset, sizeof(*uset)); 179 return copy_from_user(set, uset, sizeof(*uset));
198} 180}
199 181
200static inline int get_old_sigaction(struct k_sigaction *new_ka,
201 struct old_sigaction __user *act)
202{
203 old_sigset_t mask;
204
205 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
206 __get_user(new_ka->sa.sa_handler, &act->sa_handler) ||
207 __get_user(new_ka->sa.sa_restorer, &act->sa_restorer) ||
208 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
209 __get_user(mask, &act->sa_mask))
210 return -EFAULT;
211 siginitset(&new_ka->sa.sa_mask, mask);
212 return 0;
213}
214
215#define to_user_ptr(p) ((unsigned long)(p)) 182#define to_user_ptr(p) ((unsigned long)(p))
216#define from_user_ptr(p) ((void __user *)(p)) 183#define from_user_ptr(p) ((void __user *)(p))
217 184
@@ -235,50 +202,8 @@ static inline int restore_general_regs(struct pt_regs *regs,
235 return -EFAULT; 202 return -EFAULT;
236 return 0; 203 return 0;
237} 204}
238
239#endif /* CONFIG_PPC64 */
240
241/*
242 * Atomically swap in the new signal mask, and wait for a signal.
243 */
244long sys_sigsuspend(old_sigset_t mask)
245{
246 sigset_t blocked;
247 siginitset(&blocked, mask);
248 return sigsuspend(&blocked);
249}
250
251long sys_sigaction(int sig, struct old_sigaction __user *act,
252 struct old_sigaction __user *oact)
253{
254 struct k_sigaction new_ka, old_ka;
255 int ret;
256
257#ifdef CONFIG_PPC64
258 if (sig < 0)
259 sig = -sig;
260#endif 205#endif
261 206
262 if (act) {
263 if (get_old_sigaction(&new_ka, act))
264 return -EFAULT;
265 }
266
267 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
268 if (!ret && oact) {
269 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
270 __put_user(to_user_ptr(old_ka.sa.sa_handler),
271 &oact->sa_handler) ||
272 __put_user(to_user_ptr(old_ka.sa.sa_restorer),
273 &oact->sa_restorer) ||
274 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
275 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
276 return -EFAULT;
277 }
278
279 return ret;
280}
281
282/* 207/*
283 * When we have signals to deliver, we set up on the 208 * When we have signals to deliver, we set up on the
284 * user stack, going down from the original stack pointer: 209 * user stack, going down from the original stack pointer:
@@ -951,89 +876,6 @@ static long restore_tm_user_regs(struct pt_regs *regs,
951#endif 876#endif
952 877
953#ifdef CONFIG_PPC64 878#ifdef CONFIG_PPC64
954long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
955 struct sigaction32 __user *oact, size_t sigsetsize)
956{
957 struct k_sigaction new_ka, old_ka;
958 int ret;
959
960 /* XXX: Don't preclude handling different sized sigset_t's. */
961 if (sigsetsize != sizeof(compat_sigset_t))
962 return -EINVAL;
963
964 if (act) {
965 compat_uptr_t handler;
966
967 ret = get_user(handler, &act->sa_handler);
968 new_ka.sa.sa_handler = compat_ptr(handler);
969 ret |= get_sigset_t(&new_ka.sa.sa_mask, &act->sa_mask);
970 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
971 if (ret)
972 return -EFAULT;
973 }
974
975 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
976 if (!ret && oact) {
977 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
978 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
979 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
980 }
981 return ret;
982}
983
984/*
985 * Note: it is necessary to treat how as an unsigned int, with the
986 * corresponding cast to a signed int to insure that the proper
987 * conversion (sign extension) between the register representation
988 * of a signed int (msr in 32-bit mode) and the register representation
989 * of a signed int (msr in 64-bit mode) is performed.
990 */
991long compat_sys_rt_sigprocmask(u32 how, compat_sigset_t __user *set,
992 compat_sigset_t __user *oset, size_t sigsetsize)
993{
994 sigset_t s;
995 sigset_t __user *up;
996 int ret;
997 mm_segment_t old_fs = get_fs();
998
999 if (set) {
1000 if (get_sigset_t(&s, set))
1001 return -EFAULT;
1002 }
1003
1004 set_fs(KERNEL_DS);
1005 /* This is valid because of the set_fs() */
1006 up = (sigset_t __user *) &s;
1007 ret = sys_rt_sigprocmask((int)how, set ? up : NULL, oset ? up : NULL,
1008 sigsetsize);
1009 set_fs(old_fs);
1010 if (ret)
1011 return ret;
1012 if (oset) {
1013 if (put_sigset_t(oset, &s))
1014 return -EFAULT;
1015 }
1016 return 0;
1017}
1018
1019long compat_sys_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
1020{
1021 sigset_t s;
1022 int ret;
1023 mm_segment_t old_fs = get_fs();
1024
1025 set_fs(KERNEL_DS);
1026 /* The __user pointer cast is valid because of the set_fs() */
1027 ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
1028 set_fs(old_fs);
1029 if (!ret) {
1030 if (put_sigset_t(set, &s))
1031 return -EFAULT;
1032 }
1033 return ret;
1034}
1035
1036
1037int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s) 879int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s)
1038{ 880{
1039 int err; 881 int err;
@@ -1102,79 +944,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
1102 944
1103 return 0; 945 return 0;
1104} 946}
1105
1106/*
1107 * Note: it is necessary to treat pid and sig as unsigned ints, with the
1108 * corresponding cast to a signed int to insure that the proper conversion
1109 * (sign extension) between the register representation of a signed int
1110 * (msr in 32-bit mode) and the register representation of a signed int
1111 * (msr in 64-bit mode) is performed.
1112 */
1113long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo)
1114{
1115 siginfo_t info;
1116 int ret;
1117 mm_segment_t old_fs = get_fs();
1118
1119 ret = copy_siginfo_from_user32(&info, uinfo);
1120 if (unlikely(ret))
1121 return ret;
1122
1123 set_fs (KERNEL_DS);
1124 /* The __user pointer cast is valid becasuse of the set_fs() */
1125 ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info);
1126 set_fs (old_fs);
1127 return ret;
1128}
1129/*
1130 * Start Alternate signal stack support
1131 *
1132 * System Calls
1133 * sigaltatck compat_sys_sigaltstack
1134 */
1135
1136int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
1137 int r6, int r7, int r8, struct pt_regs *regs)
1138{
1139 stack_32_t __user * newstack = compat_ptr(__new);
1140 stack_32_t __user * oldstack = compat_ptr(__old);
1141 stack_t uss, uoss;
1142 int ret;
1143 mm_segment_t old_fs;
1144 unsigned long sp;
1145 compat_uptr_t ss_sp;
1146
1147 /*
1148 * set sp to the user stack on entry to the system call
1149 * the system call router sets R9 to the saved registers
1150 */
1151 sp = regs->gpr[1];
1152
1153 /* Put new stack info in local 64 bit stack struct */
1154 if (newstack) {
1155 if (get_user(ss_sp, &newstack->ss_sp) ||
1156 __get_user(uss.ss_flags, &newstack->ss_flags) ||
1157 __get_user(uss.ss_size, &newstack->ss_size))
1158 return -EFAULT;
1159 uss.ss_sp = compat_ptr(ss_sp);
1160 }
1161
1162 old_fs = get_fs();
1163 set_fs(KERNEL_DS);
1164 /* The __user pointer casts are valid because of the set_fs() */
1165 ret = do_sigaltstack(
1166 newstack ? (stack_t __user *) &uss : NULL,
1167 oldstack ? (stack_t __user *) &uoss : NULL,
1168 sp);
1169 set_fs(old_fs);
1170 /* Copy the stack information to the user output buffer */
1171 if (!ret && oldstack &&
1172 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
1173 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
1174 __put_user(uoss.ss_size, &oldstack->ss_size)))
1175 return -EFAULT;
1176 return ret;
1177}
1178#endif /* CONFIG_PPC64 */ 947#endif /* CONFIG_PPC64 */
1179 948
1180/* 949/*
@@ -1202,10 +971,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
1202 /* Put the siginfo & fill in most of the ucontext */ 971 /* Put the siginfo & fill in most of the ucontext */
1203 if (copy_siginfo_to_user(&rt_sf->info, info) 972 if (copy_siginfo_to_user(&rt_sf->info, info)
1204 || __put_user(0, &rt_sf->uc.uc_flags) 973 || __put_user(0, &rt_sf->uc.uc_flags)
1205 || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp) 974 || __save_altstack(&rt_sf->uc.uc_stack, regs->gpr[1])
1206 || __put_user(sas_ss_flags(regs->gpr[1]),
1207 &rt_sf->uc.uc_stack.ss_flags)
1208 || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
1209 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext), 975 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext),
1210 &rt_sf->uc.uc_regs) 976 &rt_sf->uc.uc_regs)
1211 || put_sigset_t(&rt_sf->uc.uc_sigmask, oldset)) 977 || put_sigset_t(&rt_sf->uc.uc_sigmask, oldset))
@@ -1494,14 +1260,11 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1494 * change it. -- paulus 1260 * change it. -- paulus
1495 */ 1261 */
1496#ifdef CONFIG_PPC64 1262#ifdef CONFIG_PPC64
1497 /* 1263 if (compat_restore_altstack(&rt_sf->uc.uc_stack))
1498 * We use the compat_sys_ version that does the 32/64 bits conversion 1264 goto bad;
1499 * and takes userland pointer directly. What about error checking ?
1500 * nobody does any...
1501 */
1502 compat_sys_sigaltstack((u32)(u64)&rt_sf->uc.uc_stack, 0, 0, 0, 0, 0, regs);
1503#else 1265#else
1504 do_sigaltstack(&rt_sf->uc.uc_stack, NULL, regs->gpr[1]); 1266 if (restore_altstack(&rt_sf->uc.uc_stack))
1267 goto bad;
1505#endif 1268#endif
1506 set_thread_flag(TIF_RESTOREALL); 1269 set_thread_flag(TIF_RESTOREALL);
1507 return 0; 1270 return 0;
@@ -1617,7 +1380,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1617 * always done it up until now so it is probably better not to 1380 * always done it up until now so it is probably better not to
1618 * change it. -- paulus 1381 * change it. -- paulus
1619 */ 1382 */
1620 do_sigaltstack(&ctx->uc_stack, NULL, regs->gpr[1]); 1383 restore_altstack(&ctx->uc_stack);
1621 1384
1622 set_thread_flag(TIF_RESTOREALL); 1385 set_thread_flag(TIF_RESTOREALL);
1623 out: 1386 out:
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 7a76ee48a952..995f8543cb57 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -676,10 +676,8 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
676 if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext)) 676 if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext))
677 goto badframe; 677 goto badframe;
678 678
679 /* do_sigaltstack expects a __user pointer and won't modify 679 if (restore_altstack(&uc->uc_stack))
680 * what's in there anyway 680 goto badframe;
681 */
682 do_sigaltstack(&uc->uc_stack, NULL, regs->gpr[1]);
683 681
684 set_thread_flag(TIF_RESTOREALL); 682 set_thread_flag(TIF_RESTOREALL);
685 return 0; 683 return 0;
@@ -723,10 +721,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
723 721
724 /* Create the ucontext. */ 722 /* Create the ucontext. */
725 err |= __put_user(0, &frame->uc.uc_flags); 723 err |= __put_user(0, &frame->uc.uc_flags);
726 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 724 err |= __save_altstack(&frame->uc.uc_stack, regs->gpr[1]);
727 err |= __put_user(sas_ss_flags(regs->gpr[1]),
728 &frame->uc.uc_stack.ss_flags);
729 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
730#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 725#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
731 if (MSR_TM_ACTIVE(regs->msr)) { 726 if (MSR_TM_ACTIVE(regs->msr)) {
732 /* The ucontext_t passed to userland points to the second 727 /* The ucontext_t passed to userland points to the second
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 8a93778ed9f5..dbc44ba5b078 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -61,16 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); 61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
62} 62}
63 63
64/* Note: it is necessary to treat option as an unsigned int,
65 * with the corresponding cast to a signed int to insure that the
66 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
67 * and the register representation of a signed int (msr in 64-bit mode) is performed.
68 */
69asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
70{
71 return sys_sysfs((int)option, arg1, arg2);
72}
73
74#ifdef CONFIG_SYSVIPC 64#ifdef CONFIG_SYSVIPC
75long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, 65long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
76 u32 fifth) 66 u32 fifth)
@@ -156,125 +146,6 @@ asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd,
156 (off_t __user *)offset, count); 146 (off_t __user *)offset, count);
157} 147}
158 148
159/* Note: it is necessary to treat option as an unsigned int,
160 * with the corresponding cast to a signed int to insure that the
161 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
162 * and the register representation of a signed int (msr in 64-bit mode) is performed.
163 */
164asmlinkage long compat_sys_prctl(u32 option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
165{
166 return sys_prctl((int)option,
167 (unsigned long) arg2,
168 (unsigned long) arg3,
169 (unsigned long) arg4,
170 (unsigned long) arg5);
171}
172
173/* Note: it is necessary to treat pid as an unsigned int,
174 * with the corresponding cast to a signed int to insure that the
175 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
176 * and the register representation of a signed int (msr in 64-bit mode) is performed.
177 */
178asmlinkage long compat_sys_sched_rr_get_interval_wrapper(u32 pid,
179 struct compat_timespec __user *interval)
180{
181 return compat_sys_sched_rr_get_interval((int)pid, interval);
182}
183
184/* Note: it is necessary to treat mode as an unsigned int,
185 * with the corresponding cast to a signed int to insure that the
186 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
187 * and the register representation of a signed int (msr in 64-bit mode) is performed.
188 */
189asmlinkage long compat_sys_access(const char __user * filename, u32 mode)
190{
191 return sys_access(filename, (int)mode);
192}
193
194
195/* Note: it is necessary to treat mode as an unsigned int,
196 * with the corresponding cast to a signed int to insure that the
197 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
198 * and the register representation of a signed int (msr in 64-bit mode) is performed.
199 */
200asmlinkage long compat_sys_creat(const char __user * pathname, u32 mode)
201{
202 return sys_creat(pathname, (int)mode);
203}
204
205
206/* Note: it is necessary to treat pid and options as unsigned ints,
207 * with the corresponding cast to a signed int to insure that the
208 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
209 * and the register representation of a signed int (msr in 64-bit mode) is performed.
210 */
211asmlinkage long compat_sys_waitpid(u32 pid, unsigned int __user * stat_addr, u32 options)
212{
213 return sys_waitpid((int)pid, stat_addr, (int)options);
214}
215
216
217/* Note: it is necessary to treat gidsetsize as an unsigned int,
218 * with the corresponding cast to a signed int to insure that the
219 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
220 * and the register representation of a signed int (msr in 64-bit mode) is performed.
221 */
222asmlinkage long compat_sys_getgroups(u32 gidsetsize, gid_t __user *grouplist)
223{
224 return sys_getgroups((int)gidsetsize, grouplist);
225}
226
227
228/* Note: it is necessary to treat pid as an unsigned int,
229 * with the corresponding cast to a signed int to insure that the
230 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
231 * and the register representation of a signed int (msr in 64-bit mode) is performed.
232 */
233asmlinkage long compat_sys_getpgid(u32 pid)
234{
235 return sys_getpgid((int)pid);
236}
237
238
239
240/* Note: it is necessary to treat pid as an unsigned int,
241 * with the corresponding cast to a signed int to insure that the
242 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
243 * and the register representation of a signed int (msr in 64-bit mode) is performed.
244 */
245asmlinkage long compat_sys_getsid(u32 pid)
246{
247 return sys_getsid((int)pid);
248}
249
250
251/* Note: it is necessary to treat pid and sig as unsigned ints,
252 * with the corresponding cast to a signed int to insure that the
253 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
254 * and the register representation of a signed int (msr in 64-bit mode) is performed.
255 */
256asmlinkage long compat_sys_kill(u32 pid, u32 sig)
257{
258 return sys_kill((int)pid, (int)sig);
259}
260
261
262/* Note: it is necessary to treat mode as an unsigned int,
263 * with the corresponding cast to a signed int to insure that the
264 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
265 * and the register representation of a signed int (msr in 64-bit mode) is performed.
266 */
267asmlinkage long compat_sys_mkdir(const char __user * pathname, u32 mode)
268{
269 return sys_mkdir(pathname, (int)mode);
270}
271
272long compat_sys_nice(u32 increment)
273{
274 /* sign extend increment */
275 return sys_nice((int)increment);
276}
277
278off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin) 149off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
279{ 150{
280 /* sign extend n */ 151 /* sign extend n */
@@ -293,172 +164,6 @@ long compat_sys_ftruncate(int fd, u32 length)
293 return sys_ftruncate(fd, (int)length); 164 return sys_ftruncate(fd, (int)length);
294} 165}
295 166
296/* Note: it is necessary to treat bufsiz as an unsigned int,
297 * with the corresponding cast to a signed int to insure that the
298 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
299 * and the register representation of a signed int (msr in 64-bit mode) is performed.
300 */
301asmlinkage long compat_sys_readlink(const char __user * path, char __user * buf, u32 bufsiz)
302{
303 return sys_readlink(path, buf, (int)bufsiz);
304}
305
306/* Note: it is necessary to treat option as an unsigned int,
307 * with the corresponding cast to a signed int to insure that the
308 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
309 * and the register representation of a signed int (msr in 64-bit mode) is performed.
310 */
311asmlinkage long compat_sys_sched_get_priority_max(u32 policy)
312{
313 return sys_sched_get_priority_max((int)policy);
314}
315
316
317/* Note: it is necessary to treat policy as an unsigned int,
318 * with the corresponding cast to a signed int to insure that the
319 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
320 * and the register representation of a signed int (msr in 64-bit mode) is performed.
321 */
322asmlinkage long compat_sys_sched_get_priority_min(u32 policy)
323{
324 return sys_sched_get_priority_min((int)policy);
325}
326
327
328/* Note: it is necessary to treat pid as an unsigned int,
329 * with the corresponding cast to a signed int to insure that the
330 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
331 * and the register representation of a signed int (msr in 64-bit mode) is performed.
332 */
333asmlinkage long compat_sys_sched_getparam(u32 pid, struct sched_param __user *param)
334{
335 return sys_sched_getparam((int)pid, param);
336}
337
338
339/* Note: it is necessary to treat pid as an unsigned int,
340 * with the corresponding cast to a signed int to insure that the
341 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
342 * and the register representation of a signed int (msr in 64-bit mode) is performed.
343 */
344asmlinkage long compat_sys_sched_getscheduler(u32 pid)
345{
346 return sys_sched_getscheduler((int)pid);
347}
348
349
350/* Note: it is necessary to treat pid as an unsigned int,
351 * with the corresponding cast to a signed int to insure that the
352 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
353 * and the register representation of a signed int (msr in 64-bit mode) is performed.
354 */
355asmlinkage long compat_sys_sched_setparam(u32 pid, struct sched_param __user *param)
356{
357 return sys_sched_setparam((int)pid, param);
358}
359
360
361/* Note: it is necessary to treat pid and policy as unsigned ints,
362 * with the corresponding cast to a signed int to insure that the
363 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
364 * and the register representation of a signed int (msr in 64-bit mode) is performed.
365 */
366asmlinkage long compat_sys_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param)
367{
368 return sys_sched_setscheduler((int)pid, (int)policy, param);
369}
370
371
372/* Note: it is necessary to treat len as an unsigned int,
373 * with the corresponding cast to a signed int to insure that the
374 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
375 * and the register representation of a signed int (msr in 64-bit mode) is performed.
376 */
377asmlinkage long compat_sys_setdomainname(char __user *name, u32 len)
378{
379 return sys_setdomainname(name, (int)len);
380}
381
382
383/* Note: it is necessary to treat gidsetsize as an unsigned int,
384 * with the corresponding cast to a signed int to insure that the
385 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
386 * and the register representation of a signed int (msr in 64-bit mode) is performed.
387 */
388asmlinkage long compat_sys_setgroups(u32 gidsetsize, gid_t __user *grouplist)
389{
390 return sys_setgroups((int)gidsetsize, grouplist);
391}
392
393
394asmlinkage long compat_sys_sethostname(char __user *name, u32 len)
395{
396 /* sign extend len */
397 return sys_sethostname(name, (int)len);
398}
399
400
401/* Note: it is necessary to treat pid and pgid as unsigned ints,
402 * with the corresponding cast to a signed int to insure that the
403 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
404 * and the register representation of a signed int (msr in 64-bit mode) is performed.
405 */
406asmlinkage long compat_sys_setpgid(u32 pid, u32 pgid)
407{
408 return sys_setpgid((int)pid, (int)pgid);
409}
410
411long compat_sys_getpriority(u32 which, u32 who)
412{
413 /* sign extend which and who */
414 return sys_getpriority((int)which, (int)who);
415}
416
417long compat_sys_setpriority(u32 which, u32 who, u32 niceval)
418{
419 /* sign extend which, who and niceval */
420 return sys_setpriority((int)which, (int)who, (int)niceval);
421}
422
423long compat_sys_ioprio_get(u32 which, u32 who)
424{
425 /* sign extend which and who */
426 return sys_ioprio_get((int)which, (int)who);
427}
428
429long compat_sys_ioprio_set(u32 which, u32 who, u32 ioprio)
430{
431 /* sign extend which, who and ioprio */
432 return sys_ioprio_set((int)which, (int)who, (int)ioprio);
433}
434
435/* Note: it is necessary to treat newmask as an unsigned int,
436 * with the corresponding cast to a signed int to insure that the
437 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
438 * and the register representation of a signed int (msr in 64-bit mode) is performed.
439 */
440asmlinkage long compat_sys_ssetmask(u32 newmask)
441{
442 return sys_ssetmask((int) newmask);
443}
444
445asmlinkage long compat_sys_syslog(u32 type, char __user * buf, u32 len)
446{
447 /* sign extend len */
448 return sys_syslog(type, buf, (int)len);
449}
450
451
452/* Note: it is necessary to treat mask as an unsigned int,
453 * with the corresponding cast to a signed int to insure that the
454 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
455 * and the register representation of a signed int (msr in 64-bit mode) is performed.
456 */
457asmlinkage long compat_sys_umask(u32 mask)
458{
459 return sys_umask((int)mask);
460}
461
462unsigned long compat_sys_mmap2(unsigned long addr, size_t len, 167unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
463 unsigned long prot, unsigned long flags, 168 unsigned long prot, unsigned long flags,
464 unsigned long fd, unsigned long pgoff) 169 unsigned long fd, unsigned long pgoff)
@@ -467,12 +172,6 @@ unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
467 return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); 172 return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);
468} 173}
469 174
470long compat_sys_tgkill(u32 tgid, u32 pid, int sig)
471{
472 /* sign extend tgid, pid */
473 return sys_tgkill((int)tgid, (int)pid, sig);
474}
475
476/* 175/*
477 * long long munging: 176 * long long munging:
478 * The 32 bit ABI passes long longs in an odd even register pair. 177 * The 32 bit ABI passes long longs in an odd even register pair.
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b220e152aefa..f09ae7b0b4c5 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -137,6 +137,8 @@ config S390
137 select INIT_ALL_POSSIBLE 137 select INIT_ALL_POSSIBLE
138 select KTIME_SCALAR if 32BIT 138 select KTIME_SCALAR if 32BIT
139 select MODULES_USE_ELF_RELA 139 select MODULES_USE_ELF_RELA
140 select OLD_SIGSUSPEND3
141 select OLD_SIGACTION
140 select SYSCTL_EXCEPTION_TRACE 142 select SYSCTL_EXCEPTION_TRACE
141 select USE_GENERIC_SMP_HELPERS if SMP 143 select USE_GENERIC_SMP_HELPERS if SMP
142 select VIRT_CPU_ACCOUNTING 144 select VIRT_CPU_ACCOUNTING
@@ -249,6 +251,7 @@ config COMPAT
249 depends on 64BIT 251 depends on 64BIT
250 select COMPAT_BINFMT_ELF if BINFMT_ELF 252 select COMPAT_BINFMT_ELF if BINFMT_ELF
251 select ARCH_WANT_OLD_COMPAT_IPC 253 select ARCH_WANT_OLD_COMPAT_IPC
254 select COMPAT_OLD_SIGACTION
252 help 255 help
253 Select this option if you want to enable your system kernel to 256 Select this option if you want to enable your system kernel to
254 handle system-calls from ELF binaries for 31 bit ESA. This option 257 handle system-calls from ELF binaries for 31 bit ESA. This option
diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h
index db7ddfaf5b79..abf9e5735943 100644
--- a/arch/s390/include/asm/signal.h
+++ b/arch/s390/include/asm/signal.h
@@ -21,22 +21,5 @@ typedef struct {
21 unsigned long sig[_NSIG_WORDS]; 21 unsigned long sig[_NSIG_WORDS];
22} sigset_t; 22} sigset_t;
23 23
24struct old_sigaction { 24#define __ARCH_HAS_SA_RESTORER
25 __sighandler_t sa_handler;
26 old_sigset_t sa_mask;
27 unsigned long sa_flags;
28 void (*sa_restorer)(void);
29};
30
31struct sigaction {
32 __sighandler_t sa_handler;
33 unsigned long sa_flags;
34 void (*sa_restorer)(void);
35 sigset_t sa_mask; /* mask last for extensibility */
36};
37
38struct k_sigaction {
39 struct sigaction sa;
40};
41
42#endif 25#endif
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 636530872516..a6667a952969 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -43,15 +43,12 @@
43#define __ARCH_WANT_SYS_OLDUMOUNT 43#define __ARCH_WANT_SYS_OLDUMOUNT
44#define __ARCH_WANT_SYS_SIGPENDING 44#define __ARCH_WANT_SYS_SIGPENDING
45#define __ARCH_WANT_SYS_SIGPROCMASK 45#define __ARCH_WANT_SYS_SIGPROCMASK
46#define __ARCH_WANT_SYS_RT_SIGACTION
47#define __ARCH_WANT_SYS_RT_SIGSUSPEND
48# ifndef CONFIG_64BIT 46# ifndef CONFIG_64BIT
49# define __ARCH_WANT_STAT64 47# define __ARCH_WANT_STAT64
50# define __ARCH_WANT_SYS_TIME 48# define __ARCH_WANT_SYS_TIME
51# endif 49# endif
52# ifdef CONFIG_COMPAT 50# ifdef CONFIG_COMPAT
53# define __ARCH_WANT_COMPAT_SYS_TIME 51# define __ARCH_WANT_COMPAT_SYS_TIME
54# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
55# endif 52# endif
56#define __ARCH_WANT_SYS_FORK 53#define __ARCH_WANT_SYS_FORK
57#define __ARCH_WANT_SYS_VFORK 54#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 65cca95843e1..19f26de27fae 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -352,86 +352,6 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
352 return sys_ftruncate(fd, (high << 32) | low); 352 return sys_ftruncate(fd, (high << 32) | low);
353} 353}
354 354
355asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
356 struct compat_timespec __user *interval)
357{
358 struct timespec t;
359 int ret;
360 mm_segment_t old_fs = get_fs ();
361
362 set_fs (KERNEL_DS);
363 ret = sys_sched_rr_get_interval(pid,
364 (struct timespec __force __user *) &t);
365 set_fs (old_fs);
366 if (put_compat_timespec(&t, interval))
367 return -EFAULT;
368 return ret;
369}
370
371asmlinkage long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
372 compat_sigset_t __user *oset, size_t sigsetsize)
373{
374 sigset_t s;
375 compat_sigset_t s32;
376 int ret;
377 mm_segment_t old_fs = get_fs();
378
379 if (set) {
380 if (copy_from_user (&s32, set, sizeof(compat_sigset_t)))
381 return -EFAULT;
382 s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
383 }
384 set_fs (KERNEL_DS);
385 ret = sys_rt_sigprocmask(how,
386 set ? (sigset_t __force __user *) &s : NULL,
387 oset ? (sigset_t __force __user *) &s : NULL,
388 sigsetsize);
389 set_fs (old_fs);
390 if (ret) return ret;
391 if (oset) {
392 s32.sig[1] = (s.sig[0] >> 32);
393 s32.sig[0] = s.sig[0];
394 if (copy_to_user (oset, &s32, sizeof(compat_sigset_t)))
395 return -EFAULT;
396 }
397 return 0;
398}
399
400asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
401 size_t sigsetsize)
402{
403 sigset_t s;
404 compat_sigset_t s32;
405 int ret;
406 mm_segment_t old_fs = get_fs();
407
408 set_fs (KERNEL_DS);
409 ret = sys_rt_sigpending((sigset_t __force __user *) &s, sigsetsize);
410 set_fs (old_fs);
411 if (!ret) {
412 s32.sig[1] = (s.sig[0] >> 32);
413 s32.sig[0] = s.sig[0];
414 if (copy_to_user (set, &s32, sizeof(compat_sigset_t)))
415 return -EFAULT;
416 }
417 return ret;
418}
419
420asmlinkage long
421sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
422{
423 siginfo_t info;
424 int ret;
425 mm_segment_t old_fs = get_fs();
426
427 if (copy_siginfo_from_user32(&info, uinfo))
428 return -EFAULT;
429 set_fs (KERNEL_DS);
430 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __force __user *) &info);
431 set_fs (old_fs);
432 return ret;
433}
434
435asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 355asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
436 size_t count, u32 poshi, u32 poslo) 356 size_t count, u32 poshi, u32 poslo)
437{ 357{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index d4d0239970ac..00d92a5a6f6c 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -17,13 +17,6 @@ struct ipc_kludge_32 {
17 __s32 msgtyp; 17 __s32 msgtyp;
18}; 18};
19 19
20struct old_sigaction32 {
21 __u32 sa_handler; /* Really a pointer, but need to deal with 32 bits */
22 compat_old_sigset_t sa_mask; /* A 32 bit mask */
23 __u32 sa_flags;
24 __u32 sa_restorer; /* Another 32 bit pointer */
25};
26
27/* asm/sigcontext.h */ 20/* asm/sigcontext.h */
28typedef union 21typedef union
29{ 22{
@@ -68,24 +61,12 @@ struct sigcontext32
68}; 61};
69 62
70/* asm/signal.h */ 63/* asm/signal.h */
71struct sigaction32 {
72 __u32 sa_handler; /* pointer */
73 __u32 sa_flags;
74 __u32 sa_restorer; /* pointer */
75 compat_sigset_t sa_mask; /* mask last for extensibility */
76};
77
78typedef struct {
79 __u32 ss_sp; /* pointer */
80 int ss_flags;
81 compat_size_t ss_size;
82} stack_t32;
83 64
84/* asm/ucontext.h */ 65/* asm/ucontext.h */
85struct ucontext32 { 66struct ucontext32 {
86 __u32 uc_flags; 67 __u32 uc_flags;
87 __u32 uc_link; /* pointer */ 68 __u32 uc_link; /* pointer */
88 stack_t32 uc_stack; 69 compat_stack_t uc_stack;
89 _sigregs32 uc_mcontext; 70 _sigregs32 uc_mcontext;
90 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 71 compat_sigset_t uc_sigmask; /* mask last for extensibility */
91}; 72};
@@ -93,8 +74,6 @@ struct ucontext32 {
93struct stat64_emu31; 74struct stat64_emu31;
94struct mmap_arg_struct_emu31; 75struct mmap_arg_struct_emu31;
95struct fadvise64_64_args; 76struct fadvise64_64_args;
96struct old_sigaction32;
97struct old_sigaction32;
98 77
99long sys32_chown16(const char __user * filename, u16 user, u16 group); 78long sys32_chown16(const char __user * filename, u16 user, u16 group);
100long sys32_lchown16(const char __user * filename, u16 user, u16 group); 79long sys32_lchown16(const char __user * filename, u16 user, u16 group);
@@ -119,12 +98,6 @@ long sys32_ipc(u32 call, int first, int second, int third, u32 ptr);
119long sys32_truncate64(const char __user * path, unsigned long high, 98long sys32_truncate64(const char __user * path, unsigned long high,
120 unsigned long low); 99 unsigned long low);
121long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low); 100long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
122long sys32_sched_rr_get_interval(compat_pid_t pid,
123 struct compat_timespec __user *interval);
124long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
125 compat_sigset_t __user *oset, size_t sigsetsize);
126long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
127long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
128long sys32_init_module(void __user *umod, unsigned long len, 101long sys32_init_module(void __user *umod, unsigned long len,
129 const char __user *uargs); 102 const char __user *uargs);
130long sys32_delete_module(const char __user *name_user, unsigned int flags); 103long sys32_delete_module(const char __user *name_user, unsigned int flags);
@@ -149,9 +122,4 @@ long sys32_read(unsigned int fd, char __user * buf, size_t count);
149long sys32_write(unsigned int fd, const char __user * buf, size_t count); 122long sys32_write(unsigned int fd, const char __user * buf, size_t count);
150long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise); 123long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
151long sys32_fadvise64_64(struct fadvise64_64_args __user *args); 124long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
152long sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
153 struct old_sigaction32 __user *oact);
154long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
155 struct sigaction32 __user *oact, size_t sigsetsize);
156long sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss);
157#endif /* _ASM_S390X_S390_H */ 125#endif /* _ASM_S390X_S390_H */
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 593fcc9253fc..3e71194c1902 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -157,122 +157,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
157 return err; 157 return err;
158} 158}
159 159
160asmlinkage long
161sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
162 struct old_sigaction32 __user *oact)
163{
164 struct k_sigaction new_ka, old_ka;
165 unsigned long sa_handler, sa_restorer;
166 int ret;
167
168 if (act) {
169 compat_old_sigset_t mask;
170 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
171 __get_user(sa_handler, &act->sa_handler) ||
172 __get_user(sa_restorer, &act->sa_restorer) ||
173 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
174 __get_user(mask, &act->sa_mask))
175 return -EFAULT;
176 new_ka.sa.sa_handler = (__sighandler_t) sa_handler;
177 new_ka.sa.sa_restorer = (void (*)(void)) sa_restorer;
178 siginitset(&new_ka.sa.sa_mask, mask);
179 }
180
181 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
182
183 if (!ret && oact) {
184 sa_handler = (unsigned long) old_ka.sa.sa_handler;
185 sa_restorer = (unsigned long) old_ka.sa.sa_restorer;
186 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
187 __put_user(sa_handler, &oact->sa_handler) ||
188 __put_user(sa_restorer, &oact->sa_restorer) ||
189 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
190 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
191 return -EFAULT;
192 }
193
194 return ret;
195}
196
197asmlinkage long
198sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
199 struct sigaction32 __user *oact, size_t sigsetsize)
200{
201 struct k_sigaction new_ka, old_ka;
202 unsigned long sa_handler;
203 int ret;
204 compat_sigset_t set32;
205
206 /* XXX: Don't preclude handling different sized sigset_t's. */
207 if (sigsetsize != sizeof(compat_sigset_t))
208 return -EINVAL;
209
210 if (act) {
211 ret = get_user(sa_handler, &act->sa_handler);
212 ret |= __copy_from_user(&set32, &act->sa_mask,
213 sizeof(compat_sigset_t));
214 new_ka.sa.sa_mask.sig[0] =
215 set32.sig[0] | (((long)set32.sig[1]) << 32);
216 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
217
218 if (ret)
219 return -EFAULT;
220 new_ka.sa.sa_handler = (__sighandler_t) sa_handler;
221 }
222
223 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
224
225 if (!ret && oact) {
226 set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32);
227 set32.sig[0] = old_ka.sa.sa_mask.sig[0];
228 ret = put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler);
229 ret |= __copy_to_user(&oact->sa_mask, &set32,
230 sizeof(compat_sigset_t));
231 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
232 }
233
234 return ret;
235}
236
237asmlinkage long
238sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss)
239{
240 struct pt_regs *regs = task_pt_regs(current);
241 stack_t kss, koss;
242 unsigned long ss_sp;
243 int ret, err = 0;
244 mm_segment_t old_fs = get_fs();
245
246 if (uss) {
247 if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
248 return -EFAULT;
249 err |= __get_user(ss_sp, &uss->ss_sp);
250 err |= __get_user(kss.ss_size, &uss->ss_size);
251 err |= __get_user(kss.ss_flags, &uss->ss_flags);
252 if (err)
253 return -EFAULT;
254 kss.ss_sp = (void __user *) ss_sp;
255 }
256
257 set_fs (KERNEL_DS);
258 ret = do_sigaltstack((stack_t __force __user *) (uss ? &kss : NULL),
259 (stack_t __force __user *) (uoss ? &koss : NULL),
260 regs->gprs[15]);
261 set_fs (old_fs);
262
263 if (!ret && uoss) {
264 if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
265 return -EFAULT;
266 ss_sp = (unsigned long) koss.ss_sp;
267 err |= __put_user(ss_sp, &uoss->ss_sp);
268 err |= __put_user(koss.ss_size, &uoss->ss_size);
269 err |= __put_user(koss.ss_flags, &uoss->ss_flags);
270 if (err)
271 return -EFAULT;
272 }
273 return ret;
274}
275
276static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs) 160static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
277{ 161{
278 _s390_regs_common32 regs32; 162 _s390_regs_common32 regs32;
@@ -380,10 +264,6 @@ asmlinkage long sys32_rt_sigreturn(void)
380 struct pt_regs *regs = task_pt_regs(current); 264 struct pt_regs *regs = task_pt_regs(current);
381 rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; 265 rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
382 sigset_t set; 266 sigset_t set;
383 stack_t st;
384 __u32 ss_sp;
385 int err;
386 mm_segment_t old_fs = get_fs();
387 267
388 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 268 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
389 goto badframe; 269 goto badframe;
@@ -394,15 +274,8 @@ asmlinkage long sys32_rt_sigreturn(void)
394 goto badframe; 274 goto badframe;
395 if (restore_sigregs_gprs_high(regs, frame->gprs_high)) 275 if (restore_sigregs_gprs_high(regs, frame->gprs_high))
396 goto badframe; 276 goto badframe;
397 err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); 277 if (compat_restore_altstack(&frame->uc.uc_stack))
398 st.ss_sp = compat_ptr(ss_sp);
399 err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
400 err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
401 if (err)
402 goto badframe; 278 goto badframe;
403 set_fs (KERNEL_DS);
404 do_sigaltstack((stack_t __force __user *)&st, NULL, regs->gprs[15]);
405 set_fs (old_fs);
406 return regs->gprs[2]; 279 return regs->gprs[2];
407badframe: 280badframe:
408 force_sig(SIGSEGV, current); 281 force_sig(SIGSEGV, current);
@@ -530,10 +403,7 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
530 /* Create the ucontext. */ 403 /* Create the ucontext. */
531 err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags); 404 err |= __put_user(UC_EXTENDED, &frame->uc.uc_flags);
532 err |= __put_user(0, &frame->uc.uc_link); 405 err |= __put_user(0, &frame->uc.uc_link);
533 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 406 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->gprs[15]);
534 err |= __put_user(sas_ss_flags(regs->gprs[15]),
535 &frame->uc.uc_stack.ss_flags);
536 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
537 err |= save_sigregs32(regs, &frame->uc.uc_mcontext); 407 err |= save_sigregs32(regs, &frame->uc.uc_mcontext);
538 err |= save_sigregs_gprs_high(regs, frame->gprs_high); 408 err |= save_sigregs_gprs_high(regs, frame->gprs_high);
539 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 409 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 9b9a805656b5..c14faf39ae36 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -24,12 +24,6 @@ ENTRY(sys32_write_wrapper)
24 llgfr %r4,%r4 # size_t 24 llgfr %r4,%r4 # size_t
25 jg sys32_write # branch to system call 25 jg sys32_write # branch to system call
26 26
27ENTRY(sys32_open_wrapper)
28 llgtr %r2,%r2 # const char *
29 lgfr %r3,%r3 # int
30 lgfr %r4,%r4 # int
31 jg compat_sys_open # branch to system call
32
33ENTRY(sys32_close_wrapper) 27ENTRY(sys32_close_wrapper)
34 llgfr %r2,%r2 # unsigned int 28 llgfr %r2,%r2 # unsigned int
35 jg sys_close # branch to system call 29 jg sys_close # branch to system call
@@ -226,12 +220,6 @@ ENTRY(sys32_dup2_wrapper)
226 220
227#sys32_setsid_wrapper # void 221#sys32_setsid_wrapper # void
228 222
229ENTRY(sys32_sigaction_wrapper)
230 lgfr %r2,%r2 # int
231 llgtr %r3,%r3 # const struct old_sigaction *
232 llgtr %r4,%r4 # struct old_sigaction32 *
233 jg sys32_sigaction # branch to system call
234
235ENTRY(sys32_setreuid16_wrapper) 223ENTRY(sys32_setreuid16_wrapper)
236 llgfr %r2,%r2 # __kernel_old_uid_emu31_t 224 llgfr %r2,%r2 # __kernel_old_uid_emu31_t
237 llgfr %r3,%r3 # __kernel_old_uid_emu31_t 225 llgfr %r3,%r3 # __kernel_old_uid_emu31_t
@@ -396,17 +384,6 @@ ENTRY(sys32_syslog_wrapper)
396 lgfr %r4,%r4 # int 384 lgfr %r4,%r4 # int
397 jg sys_syslog # branch to system call 385 jg sys_syslog # branch to system call
398 386
399ENTRY(compat_sys_setitimer_wrapper)
400 lgfr %r2,%r2 # int
401 llgtr %r3,%r3 # struct itimerval_emu31 *
402 llgtr %r4,%r4 # struct itimerval_emu31 *
403 jg compat_sys_setitimer # branch to system call
404
405ENTRY(compat_sys_getitimer_wrapper)
406 lgfr %r2,%r2 # int
407 llgtr %r3,%r3 # struct itimerval_emu31 *
408 jg compat_sys_getitimer # branch to system call
409
410ENTRY(compat_sys_newstat_wrapper) 387ENTRY(compat_sys_newstat_wrapper)
411 llgtr %r2,%r2 # char * 388 llgtr %r2,%r2 # char *
412 llgtr %r3,%r3 # struct stat_emu31 * 389 llgtr %r3,%r3 # struct stat_emu31 *
@@ -424,13 +401,6 @@ ENTRY(compat_sys_newfstat_wrapper)
424 401
425#sys32_vhangup_wrapper # void 402#sys32_vhangup_wrapper # void
426 403
427ENTRY(compat_sys_wait4_wrapper)
428 lgfr %r2,%r2 # pid_t
429 llgtr %r3,%r3 # unsigned int *
430 lgfr %r4,%r4 # int
431 llgtr %r5,%r5 # struct rusage *
432 jg compat_sys_wait4 # branch to system call
433
434ENTRY(sys32_swapoff_wrapper) 404ENTRY(sys32_swapoff_wrapper)
435 llgtr %r2,%r2 # const char * 405 llgtr %r2,%r2 # const char *
436 jg sys_swapoff # branch to system call 406 jg sys_swapoff # branch to system call
@@ -474,12 +444,6 @@ ENTRY(sys32_mprotect_wrapper)
474 llgfr %r4,%r4 # unsigned long 444 llgfr %r4,%r4 # unsigned long
475 jg sys_mprotect # branch to system call 445 jg sys_mprotect # branch to system call
476 446
477ENTRY(compat_sys_sigprocmask_wrapper)
478 lgfr %r2,%r2 # int
479 llgtr %r3,%r3 # compat_old_sigset_t *
480 llgtr %r4,%r4 # compat_old_sigset_t *
481 jg compat_sys_sigprocmask # branch to system call
482
483ENTRY(sys_init_module_wrapper) 447ENTRY(sys_init_module_wrapper)
484 llgtr %r2,%r2 # void * 448 llgtr %r2,%r2 # void *
485 llgfr %r3,%r3 # unsigned long 449 llgfr %r3,%r3 # unsigned long
@@ -628,11 +592,6 @@ ENTRY(sys32_sched_get_priority_min_wrapper)
628 lgfr %r2,%r2 # int 592 lgfr %r2,%r2 # int
629 jg sys_sched_get_priority_min # branch to system call 593 jg sys_sched_get_priority_min # branch to system call
630 594
631ENTRY(sys32_sched_rr_get_interval_wrapper)
632 lgfr %r2,%r2 # pid_t
633 llgtr %r3,%r3 # struct compat_timespec *
634 jg sys32_sched_rr_get_interval # branch to system call
635
636ENTRY(compat_sys_nanosleep_wrapper) 595ENTRY(compat_sys_nanosleep_wrapper)
637 llgtr %r2,%r2 # struct compat_timespec * 596 llgtr %r2,%r2 # struct compat_timespec *
638 llgtr %r3,%r3 # struct compat_timespec * 597 llgtr %r3,%r3 # struct compat_timespec *
@@ -686,43 +645,6 @@ ENTRY(sys32_prctl_wrapper)
686 645
687#sys32_rt_sigreturn_wrapper # done in rt_sigreturn_glue 646#sys32_rt_sigreturn_wrapper # done in rt_sigreturn_glue
688 647
689ENTRY(sys32_rt_sigaction_wrapper)
690 lgfr %r2,%r2 # int
691 llgtr %r3,%r3 # const struct sigaction_emu31 *
692 llgtr %r4,%r4 # const struct sigaction_emu31 *
693 llgfr %r5,%r5 # size_t
694 jg sys32_rt_sigaction # branch to system call
695
696ENTRY(sys32_rt_sigprocmask_wrapper)
697 lgfr %r2,%r2 # int
698 llgtr %r3,%r3 # old_sigset_emu31 *
699 llgtr %r4,%r4 # old_sigset_emu31 *
700 llgfr %r5,%r5 # size_t
701 jg sys32_rt_sigprocmask # branch to system call
702
703ENTRY(sys32_rt_sigpending_wrapper)
704 llgtr %r2,%r2 # sigset_emu31 *
705 llgfr %r3,%r3 # size_t
706 jg sys32_rt_sigpending # branch to system call
707
708ENTRY(compat_sys_rt_sigtimedwait_wrapper)
709 llgtr %r2,%r2 # const sigset_emu31_t *
710 llgtr %r3,%r3 # siginfo_emu31_t *
711 llgtr %r4,%r4 # const struct compat_timespec *
712 llgfr %r5,%r5 # size_t
713 jg compat_sys_rt_sigtimedwait # branch to system call
714
715ENTRY(sys32_rt_sigqueueinfo_wrapper)
716 lgfr %r2,%r2 # int
717 lgfr %r3,%r3 # int
718 llgtr %r4,%r4 # siginfo_emu31_t *
719 jg sys32_rt_sigqueueinfo # branch to system call
720
721ENTRY(compat_sys_rt_sigsuspend_wrapper)
722 llgtr %r2,%r2 # compat_sigset_t *
723 llgfr %r3,%r3 # compat_size_t
724 jg compat_sys_rt_sigsuspend
725
726ENTRY(sys32_pread64_wrapper) 648ENTRY(sys32_pread64_wrapper)
727 llgfr %r2,%r2 # unsigned int 649 llgfr %r2,%r2 # unsigned int
728 llgtr %r3,%r3 # char * 650 llgtr %r3,%r3 # char *
@@ -760,11 +682,6 @@ ENTRY(sys32_capset_wrapper)
760 llgtr %r3,%r3 # const cap_user_data_t 682 llgtr %r3,%r3 # const cap_user_data_t
761 jg sys_capset # branch to system call 683 jg sys_capset # branch to system call
762 684
763ENTRY(sys32_sigaltstack_wrapper)
764 llgtr %r2,%r2 # const stack_emu31_t *
765 llgtr %r3,%r3 # stack_emu31_t *
766 jg sys32_sigaltstack
767
768ENTRY(sys32_sendfile_wrapper) 685ENTRY(sys32_sendfile_wrapper)
769 lgfr %r2,%r2 # int 686 lgfr %r2,%r2 # int
770 lgfr %r3,%r3 # int 687 lgfr %r3,%r3 # int
@@ -921,16 +838,6 @@ ENTRY(sys32_fstat64_wrapper)
921 llgtr %r3,%r3 # struct stat64 * 838 llgtr %r3,%r3 # struct stat64 *
922 jg sys32_fstat64 # branch to system call 839 jg sys32_fstat64 # branch to system call
923 840
924ENTRY(compat_sys_futex_wrapper)
925 llgtr %r2,%r2 # u32 *
926 lgfr %r3,%r3 # int
927 lgfr %r4,%r4 # int
928 llgtr %r5,%r5 # struct compat_timespec *
929 llgtr %r6,%r6 # u32 *
930 lgf %r0,164(%r15) # int
931 stg %r0,160(%r15)
932 jg compat_sys_futex # branch to system call
933
934ENTRY(sys32_setxattr_wrapper) 841ENTRY(sys32_setxattr_wrapper)
935 llgtr %r2,%r2 # char * 842 llgtr %r2,%r2 # char *
936 llgtr %r3,%r3 # char * 843 llgtr %r3,%r3 # char *
@@ -1216,14 +1123,6 @@ ENTRY(sys32_remap_file_pages_wrapper)
1216 llgfr %r6,%r6 # unsigned long 1123 llgfr %r6,%r6 # unsigned long
1217 jg sys_remap_file_pages 1124 jg sys_remap_file_pages
1218 1125
1219ENTRY(compat_sys_waitid_wrapper)
1220 lgfr %r2,%r2 # int
1221 lgfr %r3,%r3 # pid_t
1222 llgtr %r4,%r4 # siginfo_emu31_t *
1223 lgfr %r5,%r5 # int
1224 llgtr %r6,%r6 # struct rusage_emu31 *
1225 jg compat_sys_waitid
1226
1227ENTRY(compat_sys_kexec_load_wrapper) 1126ENTRY(compat_sys_kexec_load_wrapper)
1228 llgfr %r2,%r2 # unsigned long 1127 llgfr %r2,%r2 # unsigned long
1229 llgfr %r3,%r3 # unsigned long 1128 llgfr %r3,%r3 # unsigned long
@@ -1253,13 +1152,6 @@ ENTRY(sys_inotify_rm_watch_wrapper)
1253 llgfr %r3,%r3 # u32 1152 llgfr %r3,%r3 # u32
1254 jg sys_inotify_rm_watch 1153 jg sys_inotify_rm_watch
1255 1154
1256ENTRY(compat_sys_openat_wrapper)
1257 llgfr %r2,%r2 # unsigned int
1258 llgtr %r3,%r3 # const char *
1259 lgfr %r4,%r4 # int
1260 lgfr %r5,%r5 # int
1261 jg compat_sys_openat
1262
1263ENTRY(sys_mkdirat_wrapper) 1155ENTRY(sys_mkdirat_wrapper)
1264 lgfr %r2,%r2 # int 1156 lgfr %r2,%r2 # int
1265 llgtr %r3,%r3 # const char * 1157 llgtr %r3,%r3 # const char *
@@ -1362,17 +1254,6 @@ ENTRY(sys_unshare_wrapper)
1362 llgfr %r2,%r2 # unsigned long 1254 llgfr %r2,%r2 # unsigned long
1363 jg sys_unshare 1255 jg sys_unshare
1364 1256
1365ENTRY(compat_sys_set_robust_list_wrapper)
1366 llgtr %r2,%r2 # struct compat_robust_list_head *
1367 llgfr %r3,%r3 # size_t
1368 jg compat_sys_set_robust_list
1369
1370ENTRY(compat_sys_get_robust_list_wrapper)
1371 lgfr %r2,%r2 # int
1372 llgtr %r3,%r3 # compat_uptr_t_t *
1373 llgtr %r4,%r4 # compat_size_t *
1374 jg compat_sys_get_robust_list
1375
1376ENTRY(sys_splice_wrapper) 1257ENTRY(sys_splice_wrapper)
1377 lgfr %r2,%r2 # int 1258 lgfr %r2,%r2 # int
1378 llgtr %r3,%r3 # loff_t * 1259 llgtr %r3,%r3 # loff_t *
@@ -1458,18 +1339,6 @@ ENTRY(sys_timerfd_create_wrapper)
1458 lgfr %r3,%r3 # int 1339 lgfr %r3,%r3 # int
1459 jg sys_timerfd_create 1340 jg sys_timerfd_create
1460 1341
1461ENTRY(compat_sys_timerfd_settime_wrapper)
1462 lgfr %r2,%r2 # int
1463 lgfr %r3,%r3 # int
1464 llgtr %r4,%r4 # struct compat_itimerspec *
1465 llgtr %r5,%r5 # struct compat_itimerspec *
1466 jg compat_sys_timerfd_settime
1467
1468ENTRY(compat_sys_timerfd_gettime_wrapper)
1469 lgfr %r2,%r2 # int
1470 llgtr %r3,%r3 # struct compat_itimerspec *
1471 jg compat_sys_timerfd_gettime
1472
1473ENTRY(compat_sys_signalfd4_wrapper) 1342ENTRY(compat_sys_signalfd4_wrapper)
1474 lgfr %r2,%r2 # int 1343 lgfr %r2,%r2 # int
1475 llgtr %r3,%r3 # compat_sigset_t * 1344 llgtr %r3,%r3 # compat_sigset_t *
@@ -1550,13 +1419,6 @@ ENTRY(compat_sys_pwritev_wrapper)
1550 llgfr %r6,%r6 # u32 1419 llgfr %r6,%r6 # u32
1551 jg compat_sys_pwritev # branch to system call 1420 jg compat_sys_pwritev # branch to system call
1552 1421
1553ENTRY(compat_sys_rt_tgsigqueueinfo_wrapper)
1554 lgfr %r2,%r2 # compat_pid_t
1555 lgfr %r3,%r3 # compat_pid_t
1556 lgfr %r4,%r4 # int
1557 llgtr %r5,%r5 # struct compat_siginfo *
1558 jg compat_sys_rt_tgsigqueueinfo_wrapper # branch to system call
1559
1560ENTRY(sys_perf_event_open_wrapper) 1422ENTRY(sys_perf_event_open_wrapper)
1561 llgtr %r2,%r2 # const struct perf_event_attr * 1423 llgtr %r2,%r2 # const struct perf_event_attr *
1562 lgfr %r3,%r3 # pid_t 1424 lgfr %r3,%r3 # pid_t
@@ -1607,12 +1469,6 @@ ENTRY(sys_name_to_handle_at_wrapper)
1607 lgfr %r6,%r6 # int 1469 lgfr %r6,%r6 # int
1608 jg sys_name_to_handle_at 1470 jg sys_name_to_handle_at
1609 1471
1610ENTRY(compat_sys_open_by_handle_at_wrapper)
1611 lgfr %r2,%r2 # int
1612 llgtr %r3,%r3 # struct file_handle __user *
1613 lgfr %r4,%r4 # int
1614 jg compat_sys_open_by_handle_at
1615
1616ENTRY(compat_sys_clock_adjtime_wrapper) 1472ENTRY(compat_sys_clock_adjtime_wrapper)
1617 lgfr %r2,%r2 # clockid_t (int) 1473 lgfr %r2,%r2 # clockid_t (int)
1618 llgtr %r3,%r3 # struct compat_timex __user * 1474 llgtr %r3,%r3 # struct compat_timex __user *
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index 2711936fe706..c3a736a3ed44 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -73,10 +73,6 @@ long sys_s390_fadvise64(int fd, u32 offset_high, u32 offset_low,
73long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args); 73long sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
74long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high, 74long sys_s390_fallocate(int fd, int mode, loff_t offset, u32 len_high,
75 u32 len_low); 75 u32 len_low);
76long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
77long sys_sigaction(int sig, const struct old_sigaction __user *act,
78 struct old_sigaction __user *oact);
79long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss);
80long sys_sigreturn(void); 76long sys_sigreturn(void);
81long sys_rt_sigreturn(void); 77long sys_rt_sigreturn(void);
82long sys32_sigreturn(void); 78long sys32_sigreturn(void);
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index c3ff70a7b247..9c6e747a5e1e 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -48,54 +48,6 @@ typedef struct
48 struct ucontext uc; 48 struct ucontext uc;
49} rt_sigframe; 49} rt_sigframe;
50 50
51/*
52 * Atomically swap in the new signal mask, and wait for a signal.
53 */
54SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask)
55{
56 sigset_t blocked;
57 siginitset(&blocked, mask);
58 return sigsuspend(&blocked);
59}
60
61SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act,
62 struct old_sigaction __user *, oact)
63{
64 struct k_sigaction new_ka, old_ka;
65 int ret;
66
67 if (act) {
68 old_sigset_t mask;
69 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
70 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
71 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
72 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
73 __get_user(mask, &act->sa_mask))
74 return -EFAULT;
75 siginitset(&new_ka.sa.sa_mask, mask);
76 }
77
78 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
79
80 if (!ret && oact) {
81 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
82 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
83 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
84 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
85 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
86 return -EFAULT;
87 }
88
89 return ret;
90}
91
92SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
93 stack_t __user *, uoss)
94{
95 struct pt_regs *regs = task_pt_regs(current);
96 return do_sigaltstack(uss, uoss, regs->gprs[15]);
97}
98
99/* Returns non-zero on fault. */ 51/* Returns non-zero on fault. */
100static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs) 52static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
101{ 53{
@@ -190,8 +142,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
190 set_current_blocked(&set); 142 set_current_blocked(&set);
191 if (restore_sigregs(regs, &frame->uc.uc_mcontext)) 143 if (restore_sigregs(regs, &frame->uc.uc_mcontext))
192 goto badframe; 144 goto badframe;
193 if (do_sigaltstack(&frame->uc.uc_stack, NULL, 145 if (restore_altstack(&frame->uc.uc_stack))
194 regs->gprs[15]) == -EFAULT)
195 goto badframe; 146 goto badframe;
196 return regs->gprs[2]; 147 return regs->gprs[2];
197badframe: 148badframe:
@@ -325,10 +276,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
325 /* Create the ucontext. */ 276 /* Create the ucontext. */
326 err |= __put_user(0, &frame->uc.uc_flags); 277 err |= __put_user(0, &frame->uc.uc_flags);
327 err |= __put_user(NULL, &frame->uc.uc_link); 278 err |= __put_user(NULL, &frame->uc.uc_link);
328 err |= __put_user((void __user *)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 279 err |= __save_altstack(&frame->uc.uc_stack, regs->gprs[15]);
329 err |= __put_user(sas_ss_flags(regs->gprs[15]),
330 &frame->uc.uc_stack.ss_flags);
331 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
332 err |= save_sigregs(regs, &frame->uc.uc_mcontext); 280 err |= save_sigregs(regs, &frame->uc.uc_mcontext);
333 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 281 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
334 if (err) 282 if (err)
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 6a6c61f94dd3..aaac708aa110 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -13,7 +13,7 @@ SYSCALL(sys_exit,sys_exit,sys32_exit_wrapper)
13SYSCALL(sys_fork,sys_fork,sys_fork) 13SYSCALL(sys_fork,sys_fork,sys_fork)
14SYSCALL(sys_read,sys_read,sys32_read_wrapper) 14SYSCALL(sys_read,sys_read,sys32_read_wrapper)
15SYSCALL(sys_write,sys_write,sys32_write_wrapper) 15SYSCALL(sys_write,sys_write,sys32_write_wrapper)
16SYSCALL(sys_open,sys_open,sys32_open_wrapper) /* 5 */ 16SYSCALL(sys_open,sys_open,compat_sys_open) /* 5 */
17SYSCALL(sys_close,sys_close,sys32_close_wrapper) 17SYSCALL(sys_close,sys_close,sys32_close_wrapper)
18SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall) 18SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall)
19SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper) 19SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper)
@@ -75,7 +75,7 @@ SYSCALL(sys_dup2,sys_dup2,sys32_dup2_wrapper)
75SYSCALL(sys_getppid,sys_getppid,sys_getppid) 75SYSCALL(sys_getppid,sys_getppid,sys_getppid)
76SYSCALL(sys_getpgrp,sys_getpgrp,sys_getpgrp) /* 65 */ 76SYSCALL(sys_getpgrp,sys_getpgrp,sys_getpgrp) /* 65 */
77SYSCALL(sys_setsid,sys_setsid,sys_setsid) 77SYSCALL(sys_setsid,sys_setsid,sys_setsid)
78SYSCALL(sys_sigaction,sys_sigaction,sys32_sigaction_wrapper) 78SYSCALL(sys_sigaction,sys_sigaction,compat_sys_sigaction)
79NI_SYSCALL /* old sgetmask syscall*/ 79NI_SYSCALL /* old sgetmask syscall*/
80NI_SYSCALL /* old ssetmask syscall*/ 80NI_SYSCALL /* old ssetmask syscall*/
81SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */ 81SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */
@@ -112,8 +112,8 @@ SYSCALL(sys_fstatfs,sys_fstatfs,compat_sys_fstatfs_wrapper) /* 100 */
112NI_SYSCALL /* ioperm for i386 */ 112NI_SYSCALL /* ioperm for i386 */
113SYSCALL(sys_socketcall,sys_socketcall,compat_sys_socketcall_wrapper) 113SYSCALL(sys_socketcall,sys_socketcall,compat_sys_socketcall_wrapper)
114SYSCALL(sys_syslog,sys_syslog,sys32_syslog_wrapper) 114SYSCALL(sys_syslog,sys_syslog,sys32_syslog_wrapper)
115SYSCALL(sys_setitimer,sys_setitimer,compat_sys_setitimer_wrapper) 115SYSCALL(sys_setitimer,sys_setitimer,compat_sys_setitimer)
116SYSCALL(sys_getitimer,sys_getitimer,compat_sys_getitimer_wrapper) /* 105 */ 116SYSCALL(sys_getitimer,sys_getitimer,compat_sys_getitimer) /* 105 */
117SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat_wrapper) 117SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat_wrapper)
118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper) 118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper)
119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper) 119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper)
@@ -122,7 +122,7 @@ SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,sys32_lookup_dcookie_wrapper) /* 1
122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup) 122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup)
123NI_SYSCALL /* old "idle" system call */ 123NI_SYSCALL /* old "idle" system call */
124NI_SYSCALL /* vm86old for i386 */ 124NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4_wrapper) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper)
@@ -134,7 +134,7 @@ SYSCALL(sys_newuname,sys_newuname,sys32_newuname_wrapper)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */
137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper) 137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask)
138NI_SYSCALL /* old "create module" */ 138NI_SYSCALL /* old "create module" */
139SYSCALL(sys_init_module,sys_init_module,sys_init_module_wrapper) 139SYSCALL(sys_init_module,sys_init_module,sys_init_module_wrapper)
140SYSCALL(sys_delete_module,sys_delete_module,sys_delete_module_wrapper) 140SYSCALL(sys_delete_module,sys_delete_module,sys_delete_module_wrapper)
@@ -169,7 +169,7 @@ SYSCALL(sys_sched_getscheduler,sys_sched_getscheduler,sys32_sched_getscheduler_w
169SYSCALL(sys_sched_yield,sys_sched_yield,sys_sched_yield) 169SYSCALL(sys_sched_yield,sys_sched_yield,sys_sched_yield)
170SYSCALL(sys_sched_get_priority_max,sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper) 170SYSCALL(sys_sched_get_priority_max,sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper)
171SYSCALL(sys_sched_get_priority_min,sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper) /* 160 */ 171SYSCALL(sys_sched_get_priority_min,sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper) /* 160 */
172SYSCALL(sys_sched_rr_get_interval,sys_sched_rr_get_interval,sys32_sched_rr_get_interval_wrapper) 172SYSCALL(sys_sched_rr_get_interval,sys_sched_rr_get_interval,compat_sys_sched_rr_get_interval)
173SYSCALL(sys_nanosleep,sys_nanosleep,compat_sys_nanosleep_wrapper) 173SYSCALL(sys_nanosleep,sys_nanosleep,compat_sys_nanosleep_wrapper)
174SYSCALL(sys_mremap,sys_mremap,sys32_mremap_wrapper) 174SYSCALL(sys_mremap,sys_mremap,sys32_mremap_wrapper)
175SYSCALL(sys_setresuid16,sys_ni_syscall,sys32_setresuid16_wrapper) /* old setresuid16 syscall */ 175SYSCALL(sys_setresuid16,sys_ni_syscall,sys32_setresuid16_wrapper) /* old setresuid16 syscall */
@@ -182,19 +182,19 @@ SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper) /* 170 old set
182SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */ 182SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */
183SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper) 183SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper)
184SYSCALL(sys_rt_sigreturn,sys_rt_sigreturn,sys32_rt_sigreturn) 184SYSCALL(sys_rt_sigreturn,sys_rt_sigreturn,sys32_rt_sigreturn)
185SYSCALL(sys_rt_sigaction,sys_rt_sigaction,sys32_rt_sigaction_wrapper) 185SYSCALL(sys_rt_sigaction,sys_rt_sigaction,compat_sys_rt_sigaction)
186SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 175 */ 186SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,compat_sys_rt_sigprocmask) /* 175 */
187SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper) 187SYSCALL(sys_rt_sigpending,sys_rt_sigpending,compat_sys_rt_sigpending)
188SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait_wrapper) 188SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait)
189SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper) 189SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,compat_sys_rt_sigqueueinfo)
190SYSCALL(sys_rt_sigsuspend,sys_rt_sigsuspend,compat_sys_rt_sigsuspend_wrapper) 190SYSCALL(sys_rt_sigsuspend,sys_rt_sigsuspend,compat_sys_rt_sigsuspend)
191SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */ 191SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */
192SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper) 192SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper)
193SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */ 193SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */
194SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper) 194SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper)
195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper) 195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */ 196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */
197SYSCALL(sys_sigaltstack,sys_sigaltstack,sys32_sigaltstack_wrapper) 197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack)
198SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper) 198SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper)
199NI_SYSCALL /* streams1 */ 199NI_SYSCALL /* streams1 */
200NI_SYSCALL /* streams2 */ 200NI_SYSCALL /* streams2 */
@@ -246,7 +246,7 @@ SYSCALL(sys_lremovexattr,sys_lremovexattr,sys32_lremovexattr_wrapper)
246SYSCALL(sys_fremovexattr,sys_fremovexattr,sys32_fremovexattr_wrapper) /* 235 */ 246SYSCALL(sys_fremovexattr,sys_fremovexattr,sys32_fremovexattr_wrapper) /* 235 */
247SYSCALL(sys_gettid,sys_gettid,sys_gettid) 247SYSCALL(sys_gettid,sys_gettid,sys_gettid)
248SYSCALL(sys_tkill,sys_tkill,sys_tkill_wrapper) 248SYSCALL(sys_tkill,sys_tkill,sys_tkill_wrapper)
249SYSCALL(sys_futex,sys_futex,compat_sys_futex_wrapper) 249SYSCALL(sys_futex,sys_futex,compat_sys_futex)
250SYSCALL(sys_sched_setaffinity,sys_sched_setaffinity,sys32_sched_setaffinity_wrapper) 250SYSCALL(sys_sched_setaffinity,sys_sched_setaffinity,sys32_sched_setaffinity_wrapper)
251SYSCALL(sys_sched_getaffinity,sys_sched_getaffinity,sys32_sched_getaffinity_wrapper) /* 240 */ 251SYSCALL(sys_sched_getaffinity,sys_sched_getaffinity,sys32_sched_getaffinity_wrapper) /* 240 */
252SYSCALL(sys_tgkill,sys_tgkill,sys_tgkill_wrapper) 252SYSCALL(sys_tgkill,sys_tgkill,sys_tgkill_wrapper)
@@ -289,14 +289,14 @@ SYSCALL(sys_kexec_load,sys_kexec_load,compat_sys_kexec_load_wrapper)
289SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key_wrapper) 289SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key_wrapper)
290SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key_wrapper) 290SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key_wrapper)
291SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl_wrapper) /* 280 */ 291SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl_wrapper) /* 280 */
292SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid_wrapper) 292SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid)
293SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper) 293SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper)
294SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper) 294SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper)
295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init) 295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init)
296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) /* 285 */ 296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) /* 285 */
297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper) 297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper)
298NI_SYSCALL /* 287 sys_migrate_pages */ 298NI_SYSCALL /* 287 sys_migrate_pages */
299SYSCALL(sys_openat,sys_openat,compat_sys_openat_wrapper) 299SYSCALL(sys_openat,sys_openat,compat_sys_openat)
300SYSCALL(sys_mkdirat,sys_mkdirat,sys_mkdirat_wrapper) 300SYSCALL(sys_mkdirat,sys_mkdirat,sys_mkdirat_wrapper)
301SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */ 301SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */
302SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper) 302SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper)
@@ -312,8 +312,8 @@ SYSCALL(sys_faccessat,sys_faccessat,sys_faccessat_wrapper) /* 300 */
312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper) 312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper)
313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper) 313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper)
314SYSCALL(sys_unshare,sys_unshare,sys_unshare_wrapper) 314SYSCALL(sys_unshare,sys_unshare,sys_unshare_wrapper)
315SYSCALL(sys_set_robust_list,sys_set_robust_list,compat_sys_set_robust_list_wrapper) 315SYSCALL(sys_set_robust_list,sys_set_robust_list,compat_sys_set_robust_list)
316SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list_wrapper) 316SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) 317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper)
318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) 318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) 319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
@@ -328,8 +328,8 @@ SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper)
328NI_SYSCALL /* 317 old sys_timer_fd */ 328NI_SYSCALL /* 317 old sys_timer_fd */
329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) 329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper)
330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) 330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper)
331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime_wrapper) /* 320 */ 331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */
332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime_wrapper) 332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime)
333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4_wrapper) 333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4_wrapper)
334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper) 334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper)
335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper) 335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper)
@@ -338,13 +338,13 @@ SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper)
338SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper) 338SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper) 339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ 341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */
342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) 342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper) 343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper)
344SYSCALL(sys_fanotify_mark,sys_fanotify_mark,sys_fanotify_mark_wrapper) 344SYSCALL(sys_fanotify_mark,sys_fanotify_mark,sys_fanotify_mark_wrapper)
345SYSCALL(sys_prlimit64,sys_prlimit64,sys_prlimit64_wrapper) 345SYSCALL(sys_prlimit64,sys_prlimit64,sys_prlimit64_wrapper)
346SYSCALL(sys_name_to_handle_at,sys_name_to_handle_at,sys_name_to_handle_at_wrapper) /* 335 */ 346SYSCALL(sys_name_to_handle_at,sys_name_to_handle_at,sys_name_to_handle_at_wrapper) /* 335 */
347SYSCALL(sys_open_by_handle_at,sys_open_by_handle_at,compat_sys_open_by_handle_at_wrapper) 347SYSCALL(sys_open_by_handle_at,sys_open_by_handle_at,compat_sys_open_by_handle_at)
348SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime_wrapper) 348SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime_wrapper)
349SYSCALL(sys_syncfs,sys_syncfs,sys_syncfs_wrapper) 349SYSCALL(sys_syncfs,sys_syncfs,sys_syncfs_wrapper)
350SYSCALL(sys_setns,sys_setns,sys_setns_wrapper) 350SYSCALL(sys_setns,sys_setns,sys_setns_wrapper)
diff --git a/arch/score/include/asm/syscalls.h b/arch/score/include/asm/syscalls.h
index acaeed680956..98d1df92fbd1 100644
--- a/arch/score/include/asm/syscalls.h
+++ b/arch/score/include/asm/syscalls.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_SCORE_SYSCALLS_H 1#ifndef _ASM_SCORE_SYSCALLS_H
2#define _ASM_SCORE_SYSCALLS_H 2#define _ASM_SCORE_SYSCALLS_H
3 3
4asmlinkage long score_sigaltstack(struct pt_regs *regs);
5asmlinkage long score_rt_sigreturn(struct pt_regs *regs); 4asmlinkage long score_rt_sigreturn(struct pt_regs *regs);
6 5
7#include <asm-generic/syscalls.h> 6#include <asm-generic/syscalls.h>
diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
index 1557ca1a2951..7234ed09b7b7 100644
--- a/arch/score/kernel/entry.S
+++ b/arch/score/kernel/entry.S
@@ -491,8 +491,3 @@ ENTRY(sys_rt_sigreturn)
491 mv r4, r0 491 mv r4, r0
492 la r8, score_rt_sigreturn 492 la r8, score_rt_sigreturn
493 br r8 493 br r8
494
495ENTRY(sys_sigaltstack)
496 mv r4, r0
497 la r8, score_sigaltstack
498 br r8
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index 02353bde92d8..a00fba32b0eb 100644
--- a/arch/score/kernel/signal.c
+++ b/arch/score/kernel/signal.c
@@ -134,16 +134,6 @@ static void __user *get_sigframe(struct k_sigaction *ka,
134} 134}
135 135
136asmlinkage long 136asmlinkage long
137score_sigaltstack(struct pt_regs *regs)
138{
139 const stack_t __user *uss = (const stack_t __user *) regs->regs[4];
140 stack_t __user *uoss = (stack_t __user *) regs->regs[5];
141 unsigned long usp = regs->regs[0];
142
143 return do_sigaltstack(uss, uoss, usp);
144}
145
146asmlinkage long
147score_rt_sigreturn(struct pt_regs *regs) 137score_rt_sigreturn(struct pt_regs *regs)
148{ 138{
149 struct rt_sigframe __user *frame; 139 struct rt_sigframe __user *frame;
@@ -167,9 +157,7 @@ score_rt_sigreturn(struct pt_regs *regs)
167 else if (sig) 157 else if (sig)
168 force_sig(sig, current); 158 force_sig(sig, current);
169 159
170 /* It is more difficult to avoid calling this function than to 160 if (restore_altstack(&frame->rs_uc.uc_stack))
171 call it and ignore errors. */
172 if (do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs->regs[0]) == -EFAULT)
173 goto badframe; 161 goto badframe;
174 regs->is_syscall = 0; 162 regs->is_syscall = 0;
175 163
@@ -209,12 +197,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
209 err |= copy_siginfo_to_user(&frame->rs_info, info); 197 err |= copy_siginfo_to_user(&frame->rs_info, info);
210 err |= __put_user(0, &frame->rs_uc.uc_flags); 198 err |= __put_user(0, &frame->rs_uc.uc_flags);
211 err |= __put_user(NULL, &frame->rs_uc.uc_link); 199 err |= __put_user(NULL, &frame->rs_uc.uc_link);
212 err |= __put_user((void __user *)current->sas_ss_sp, 200 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[0]);
213 &frame->rs_uc.uc_stack.ss_sp);
214 err |= __put_user(sas_ss_flags(regs->regs[0]),
215 &frame->rs_uc.uc_stack.ss_flags);
216 err |= __put_user(current->sas_ss_size,
217 &frame->rs_uc.uc_stack.ss_size);
218 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext); 201 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
219 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set)); 202 err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
220 203
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 479146c180cb..ef6717a64bc7 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -39,6 +39,8 @@ config SUPERH
39 select GENERIC_STRNLEN_USER 39 select GENERIC_STRNLEN_USER
40 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER 40 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
41 select MODULES_USE_ELF_RELA 41 select MODULES_USE_ELF_RELA
42 select OLD_SIGSUSPEND
43 select OLD_SIGACTION
42 help 44 help
43 The SuperH is a RISC processor targeted for use in embedded systems 45 The SuperH is a RISC processor targeted for use in embedded systems
44 and consumer electronics; it was also used in the Sega Dreamcast 46 and consumer electronics; it was also used in the Sega Dreamcast
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h
index cc25485996bb..4f97df87d7d5 100644
--- a/arch/sh/include/asm/syscalls_32.h
+++ b/arch/sh/include/asm/syscalls_32.h
@@ -9,12 +9,6 @@
9 9
10struct pt_regs; 10struct pt_regs;
11 11
12asmlinkage int sys_sigsuspend(old_sigset_t mask);
13asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act,
14 struct old_sigaction __user *oact);
15asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
16 unsigned long r6, unsigned long r7,
17 struct pt_regs __regs);
18asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, 12asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
19 unsigned long r6, unsigned long r7, 13 unsigned long r6, unsigned long r7,
20 struct pt_regs __regs); 14 struct pt_regs __regs);
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 012004ed3330..5e90fa2b7eed 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -4,7 +4,6 @@
4# include <asm/unistd_64.h> 4# include <asm/unistd_64.h>
5# endif 5# endif
6 6
7# define __ARCH_WANT_SYS_RT_SIGSUSPEND
8# define __ARCH_WANT_OLD_READDIR 7# define __ARCH_WANT_OLD_READDIR
9# define __ARCH_WANT_OLD_STAT 8# define __ARCH_WANT_OLD_STAT
10# define __ARCH_WANT_STAT64 9# define __ARCH_WANT_STAT64
@@ -27,7 +26,6 @@
27# define __ARCH_WANT_SYS_OLDUMOUNT 26# define __ARCH_WANT_SYS_OLDUMOUNT
28# define __ARCH_WANT_SYS_SIGPENDING 27# define __ARCH_WANT_SYS_SIGPENDING
29# define __ARCH_WANT_SYS_SIGPROCMASK 28# define __ARCH_WANT_SYS_SIGPROCMASK
30# define __ARCH_WANT_SYS_RT_SIGACTION
31# define __ARCH_WANT_SYS_FORK 29# define __ARCH_WANT_SYS_FORK
32# define __ARCH_WANT_SYS_VFORK 30# define __ARCH_WANT_SYS_VFORK
33# define __ARCH_WANT_SYS_CLONE 31# define __ARCH_WANT_SYS_CLONE
diff --git a/arch/sh/include/uapi/asm/signal.h b/arch/sh/include/uapi/asm/signal.h
index 9ac530a90bce..cb96d02f55a4 100644
--- a/arch/sh/include/uapi/asm/signal.h
+++ b/arch/sh/include/uapi/asm/signal.h
@@ -5,11 +5,13 @@
5 5
6#include <asm-generic/signal.h> 6#include <asm-generic/signal.h>
7 7
8#ifndef __KERNEL__
8struct old_sigaction { 9struct old_sigaction {
9 __sighandler_t sa_handler; 10 __sighandler_t sa_handler;
10 old_sigset_t sa_mask; 11 old_sigset_t sa_mask;
11 unsigned long sa_flags; 12 unsigned long sa_flags;
12 void (*sa_restorer)(void); 13 void (*sa_restorer)(void);
13}; 14};
15#endif
14 16
15#endif /* __ASM_SH_SIGNAL_H */ 17#endif /* __ASM_SH_SIGNAL_H */
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 2f1f65356c0c..6af6e7c5cac8 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -47,60 +47,6 @@ struct fdpic_func_descriptor {
47#define UNWINDGUARD 64 47#define UNWINDGUARD 64
48 48
49/* 49/*
50 * Atomically swap in the new signal mask, and wait for a signal.
51 */
52asmlinkage int
53sys_sigsuspend(old_sigset_t mask)
54{
55 sigset_t blocked;
56 siginitset(&blocked, mask);
57 return sigsuspend(&blocked);
58}
59
60asmlinkage int
61sys_sigaction(int sig, const struct old_sigaction __user *act,
62 struct old_sigaction __user *oact)
63{
64 struct k_sigaction new_ka, old_ka;
65 int ret;
66
67 if (act) {
68 old_sigset_t mask;
69 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
70 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
71 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
72 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
73 __get_user(mask, &act->sa_mask))
74 return -EFAULT;
75 siginitset(&new_ka.sa.sa_mask, mask);
76 }
77
78 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
79
80 if (!ret && oact) {
81 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
82 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
83 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
84 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
85 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
86 return -EFAULT;
87 }
88
89 return ret;
90}
91
92asmlinkage int
93sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
94 unsigned long r6, unsigned long r7,
95 struct pt_regs __regs)
96{
97 struct pt_regs *regs = RELOC_HIDE(&__regs, 0);
98
99 return do_sigaltstack(uss, uoss, regs->regs[15]);
100}
101
102
103/*
104 * Do a signal return; undo the signal stack. 50 * Do a signal return; undo the signal stack.
105 */ 51 */
106 52
@@ -257,8 +203,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
257 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0)) 203 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
258 goto badframe; 204 goto badframe;
259 205
260 if (do_sigaltstack(&frame->uc.uc_stack, NULL, 206 if (restore_altstack(&frame->uc.uc_stack))
261 regs->regs[15]) == -EFAULT)
262 goto badframe; 207 goto badframe;
263 208
264 return r0; 209 return r0;
@@ -423,11 +368,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
423 /* Create the ucontext. */ 368 /* Create the ucontext. */
424 err |= __put_user(0, &frame->uc.uc_flags); 369 err |= __put_user(0, &frame->uc.uc_flags);
425 err |= __put_user(NULL, &frame->uc.uc_link); 370 err |= __put_user(NULL, &frame->uc.uc_link);
426 err |= __put_user((void *)current->sas_ss_sp, 371 err |= __save_altstack(&frame->uc.uc_stack, regs->regs[15]);
427 &frame->uc.uc_stack.ss_sp);
428 err |= __put_user(sas_ss_flags(regs->regs[15]),
429 &frame->uc.uc_stack.ss_flags);
430 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
431 err |= setup_sigcontext(&frame->uc.uc_mcontext, 372 err |= setup_sigcontext(&frame->uc.uc_mcontext,
432 regs, set->sig[0]); 373 regs, set->sig[0]);
433 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 374 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index d867cd95a622..23d4c71c91af 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -128,58 +128,6 @@ static void do_signal(struct pt_regs *regs)
128} 128}
129 129
130/* 130/*
131 * Atomically swap in the new signal mask, and wait for a signal.
132 */
133asmlinkage int
134sys_sigsuspend(old_sigset_t mask)
135{
136 sigset_t blocked;
137 siginitset(&blocked, mask);
138 return sigsuspend(&blocked);
139}
140
141asmlinkage int
142sys_sigaction(int sig, const struct old_sigaction __user *act,
143 struct old_sigaction __user *oact)
144{
145 struct k_sigaction new_ka, old_ka;
146 int ret;
147
148 if (act) {
149 old_sigset_t mask;
150 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
151 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
152 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
153 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
154 __get_user(mask, &act->sa_mask))
155 return -EFAULT;
156 siginitset(&new_ka.sa.sa_mask, mask);
157 }
158
159 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
160
161 if (!ret && oact) {
162 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
163 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
164 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
165 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
166 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
167 return -EFAULT;
168 }
169
170 return ret;
171}
172
173asmlinkage int
174sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
175 unsigned long r4, unsigned long r5, unsigned long r6,
176 unsigned long r7,
177 struct pt_regs * regs)
178{
179 return do_sigaltstack(uss, uoss, REF_REG_SP);
180}
181
182/*
183 * Do a signal return; undo the signal stack. 131 * Do a signal return; undo the signal stack.
184 */ 132 */
185struct sigframe { 133struct sigframe {
@@ -364,9 +312,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3,
364 goto badframe; 312 goto badframe;
365 regs->pc -= 4; 313 regs->pc -= 4;
366 314
367 /* It is more difficult to avoid calling this function than to 315 if (restore_altstack(&frame->uc.uc_stack))
368 call it and ignore errors. */
369 if (do_sigaltstack(&frame->uc.uc_stack, NULL, REF_REG_SP) == -EFAULT)
370 goto badframe; 316 goto badframe;
371 317
372 return (int) ret; 318 return (int) ret;
@@ -560,11 +506,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
560 /* Create the ucontext. */ 506 /* Create the ucontext. */
561 err |= __put_user(0, &frame->uc.uc_flags); 507 err |= __put_user(0, &frame->uc.uc_flags);
562 err |= __put_user(0, &frame->uc.uc_link); 508 err |= __put_user(0, &frame->uc.uc_link);
563 err |= __put_user((void *)current->sas_ss_sp, 509 err |= __save_altstack(&frame->uc.uc_stack, regs->regs[REG_SP]);
564 &frame->uc.uc_stack.ss_sp);
565 err |= __put_user(sas_ss_flags(regs->regs[REG_SP]),
566 &frame->uc.uc_stack.ss_flags);
567 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
568 err |= setup_sigcontext(&frame->uc.uc_mcontext, 510 err |= setup_sigcontext(&frame->uc.uc_mcontext,
569 regs, set->sig[0]); 511 regs, set->sig[0]);
570 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 512 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9bff3db17c8c..58fb1e3f631d 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -40,12 +40,15 @@ config SPARC
40 select GENERIC_STRNCPY_FROM_USER 40 select GENERIC_STRNCPY_FROM_USER
41 select GENERIC_STRNLEN_USER 41 select GENERIC_STRNLEN_USER
42 select MODULES_USE_ELF_RELA 42 select MODULES_USE_ELF_RELA
43 select ODD_RT_SIGACTION
44 select OLD_SIGSUSPEND
43 45
44config SPARC32 46config SPARC32
45 def_bool !64BIT 47 def_bool !64BIT
46 select GENERIC_ATOMIC64 48 select GENERIC_ATOMIC64
47 select CLZ_TAB 49 select CLZ_TAB
48 select HAVE_UID16 50 select HAVE_UID16
51 select OLD_SIGACTION
49 52
50config SPARC64 53config SPARC64
51 def_bool 64BIT 54 def_bool 64BIT
@@ -543,6 +546,7 @@ config COMPAT
543 select COMPAT_BINFMT_ELF 546 select COMPAT_BINFMT_ELF
544 select HAVE_UID16 547 select HAVE_UID16
545 select ARCH_WANT_OLD_COMPAT_IPC 548 select ARCH_WANT_OLD_COMPAT_IPC
549 select COMPAT_OLD_SIGACTION
546 550
547config SYSVIPC_COMPAT 551config SYSVIPC_COMPAT
548 bool 552 bool
diff --git a/arch/sparc/include/asm/compat_signal.h b/arch/sparc/include/asm/compat_signal.h
index b759eab9b51c..9ed1f128b4d1 100644
--- a/arch/sparc/include/asm/compat_signal.h
+++ b/arch/sparc/include/asm/compat_signal.h
@@ -18,12 +18,6 @@ struct __old_sigaction32 {
18 unsigned int sa_flags; 18 unsigned int sa_flags;
19 unsigned sa_restorer; /* not used by Linux/SPARC yet */ 19 unsigned sa_restorer; /* not used by Linux/SPARC yet */
20}; 20};
21
22typedef struct sigaltstack32 {
23 u32 ss_sp;
24 int ss_flags;
25 compat_size_t ss_size;
26} stack_t32;
27#endif 21#endif
28 22
29#endif /* !(_COMPAT_SIGNAL_H) */ 23#endif /* !(_COMPAT_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
index 77b85850d543..c33ce3f2ba84 100644
--- a/arch/sparc/include/asm/signal.h
+++ b/arch/sparc/include/asm/signal.h
@@ -21,10 +21,8 @@
21 */ 21 */
22#define SA_STATIC_ALLOC 0x8000 22#define SA_STATIC_ALLOC 0x8000
23 23
24struct k_sigaction { 24#define __ARCH_HAS_KA_RESTORER
25 struct __new_sigaction sa; 25#define __ARCH_HAS_SA_RESTORER
26 void __user *ka_restorer;
27};
28 26
29#endif /* !(__ASSEMBLY__) */ 27#endif /* !(__ASSEMBLY__) */
30#endif /* !(__SPARC_SIGNAL_H) */ 28#endif /* !(__SPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 87ce24c5eb95..5356810bd7e7 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -38,14 +38,11 @@
38#define __ARCH_WANT_SYS_OLDUMOUNT 38#define __ARCH_WANT_SYS_OLDUMOUNT
39#define __ARCH_WANT_SYS_SIGPENDING 39#define __ARCH_WANT_SYS_SIGPENDING
40#define __ARCH_WANT_SYS_SIGPROCMASK 40#define __ARCH_WANT_SYS_SIGPROCMASK
41#define __ARCH_WANT_SYS_RT_SIGSUSPEND
42#ifdef __32bit_syscall_numbers__ 41#ifdef __32bit_syscall_numbers__
43#define __ARCH_WANT_SYS_IPC 42#define __ARCH_WANT_SYS_IPC
44#else 43#else
45#define __ARCH_WANT_COMPAT_SYS_TIME 44#define __ARCH_WANT_COMPAT_SYS_TIME
46#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
47#define __ARCH_WANT_COMPAT_SYS_SENDFILE 45#define __ARCH_WANT_COMPAT_SYS_SENDFILE
48#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
49#endif 46#endif
50 47
51/* 48/*
diff --git a/arch/sparc/include/uapi/asm/signal.h b/arch/sparc/include/uapi/asm/signal.h
index c4ffd6c97106..f387400fcfdf 100644
--- a/arch/sparc/include/uapi/asm/signal.h
+++ b/arch/sparc/include/uapi/asm/signal.h
@@ -153,6 +153,7 @@ struct sigstack {
153 153
154#include <asm-generic/signal-defs.h> 154#include <asm-generic/signal-defs.h>
155 155
156#ifndef __KERNEL__
156struct __new_sigaction { 157struct __new_sigaction {
157 __sighandler_t sa_handler; 158 __sighandler_t sa_handler;
158 unsigned long sa_flags; 159 unsigned long sa_flags;
@@ -166,6 +167,7 @@ struct __old_sigaction {
166 unsigned long sa_flags; 167 unsigned long sa_flags;
167 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */ 168 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
168}; 169};
170#endif
169 171
170typedef struct sigaltstack { 172typedef struct sigaltstack {
171 void __user *ss_sp; 173 void __user *ss_sp;
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 21fd1a8f47d2..e2a030045089 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -820,14 +820,6 @@ sys_sparc_pipe:
820 mov %l5, %o7 820 mov %l5, %o7
821 821
822 .align 4 822 .align 4
823 .globl sys_sigaltstack
824sys_sigaltstack:
825 mov %o7, %l5
826 mov %fp, %o2
827 call do_sigaltstack
828 mov %l5, %o7
829
830 .align 4
831 .globl sys_sigstack 823 .globl sys_sigstack
832sys_sigstack: 824sys_sigstack:
833 mov %o7, %l5 825 mov %o7, %l5
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 53e48f721ce3..cd5dc4d411d1 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -61,7 +61,7 @@ struct rt_signal_frame32 {
61 compat_sigset_t mask; 61 compat_sigset_t mask;
62 /* __siginfo_fpu_t * */ u32 fpu_save; 62 /* __siginfo_fpu_t * */ u32 fpu_save;
63 unsigned int insns[2]; 63 unsigned int insns[2];
64 stack_t32 stack; 64 compat_stack_t stack;
65 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ 65 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */
66 /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ 66 /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */
67 siginfo_extra_v8plus_t v8plus; 67 siginfo_extra_v8plus_t v8plus;
@@ -230,13 +230,11 @@ segv:
230asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) 230asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
231{ 231{
232 struct rt_signal_frame32 __user *sf; 232 struct rt_signal_frame32 __user *sf;
233 unsigned int psr, pc, npc, u_ss_sp; 233 unsigned int psr, pc, npc;
234 compat_uptr_t fpu_save; 234 compat_uptr_t fpu_save;
235 compat_uptr_t rwin_save; 235 compat_uptr_t rwin_save;
236 mm_segment_t old_fs;
237 sigset_t set; 236 sigset_t set;
238 compat_sigset_t seta; 237 compat_sigset_t seta;
239 stack_t st;
240 int err, i; 238 int err, i;
241 239
242 /* Always make any pending restarted system calls return -EINTR */ 240 /* Always make any pending restarted system calls return -EINTR */
@@ -295,20 +293,10 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
295 if (!err && fpu_save) 293 if (!err && fpu_save)
296 err |= restore_fpu_state(regs, compat_ptr(fpu_save)); 294 err |= restore_fpu_state(regs, compat_ptr(fpu_save));
297 err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t)); 295 err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t));
298 err |= __get_user(u_ss_sp, &sf->stack.ss_sp); 296 err |= compat_restore_altstack(&sf->stack);
299 st.ss_sp = compat_ptr(u_ss_sp);
300 err |= __get_user(st.ss_flags, &sf->stack.ss_flags);
301 err |= __get_user(st.ss_size, &sf->stack.ss_size);
302 if (err) 297 if (err)
303 goto segv; 298 goto segv;
304 299
305 /* It is more difficult to avoid calling this function than to
306 call it and ignore errors. */
307 old_fs = get_fs();
308 set_fs(KERNEL_DS);
309 do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf);
310 set_fs(old_fs);
311
312 err |= __get_user(rwin_save, &sf->rwin_save); 300 err |= __get_user(rwin_save, &sf->rwin_save);
313 if (!err && rwin_save) { 301 if (!err && rwin_save) {
314 if (restore_rwin_state(compat_ptr(rwin_save))) 302 if (restore_rwin_state(compat_ptr(rwin_save)))
@@ -335,7 +323,7 @@ static int invalid_frame_pointer(void __user *fp, int fplen)
335 return 0; 323 return 0;
336} 324}
337 325
338static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, unsigned long framesize) 326static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, unsigned long framesize)
339{ 327{
340 unsigned long sp; 328 unsigned long sp;
341 329
@@ -350,12 +338,7 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
350 return (void __user *) -1L; 338 return (void __user *) -1L;
351 339
352 /* This is the X/Open sanctioned signal stack switching. */ 340 /* This is the X/Open sanctioned signal stack switching. */
353 if (sa->sa_flags & SA_ONSTACK) { 341 sp = sigsp(sp, ksig) - framesize;
354 if (sas_ss_flags(sp) == 0)
355 sp = current->sas_ss_sp + current->sas_ss_size;
356 }
357
358 sp -= framesize;
359 342
360 /* Always align the stack frame. This handles two cases. First, 343 /* Always align the stack frame. This handles two cases. First,
361 * sigaltstack need not be mindful of platform specific stack 344 * sigaltstack need not be mindful of platform specific stack
@@ -426,8 +409,8 @@ out_irqs_on:
426 409
427} 410}
428 411
429static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, 412static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
430 int signo, sigset_t *oldset) 413 sigset_t *oldset)
431{ 414{
432 struct signal_frame32 __user *sf; 415 struct signal_frame32 __user *sf;
433 int i, err, wsaved; 416 int i, err, wsaved;
@@ -449,10 +432,12 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
449 sigframe_size += sizeof(__siginfo_rwin_t); 432 sigframe_size += sizeof(__siginfo_rwin_t);
450 433
451 sf = (struct signal_frame32 __user *) 434 sf = (struct signal_frame32 __user *)
452 get_sigframe(&ka->sa, regs, sigframe_size); 435 get_sigframe(ksig, regs, sigframe_size);
453 436
454 if (invalid_frame_pointer(sf, sigframe_size)) 437 if (invalid_frame_pointer(sf, sigframe_size)) {
455 goto sigill; 438 do_exit(SIGILL);
439 return -EINVAL;
440 }
456 441
457 tail = (sf + 1); 442 tail = (sf + 1);
458 443
@@ -526,16 +511,16 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
526 err |= __put_user(rp->ins[7], &sf->ss.callers_pc); 511 err |= __put_user(rp->ins[7], &sf->ss.callers_pc);
527 } 512 }
528 if (err) 513 if (err)
529 goto sigsegv; 514 return err;
530 515
531 /* 3. signal handler back-trampoline and parameters */ 516 /* 3. signal handler back-trampoline and parameters */
532 regs->u_regs[UREG_FP] = (unsigned long) sf; 517 regs->u_regs[UREG_FP] = (unsigned long) sf;
533 regs->u_regs[UREG_I0] = signo; 518 regs->u_regs[UREG_I0] = ksig->sig;
534 regs->u_regs[UREG_I1] = (unsigned long) &sf->info; 519 regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
535 regs->u_regs[UREG_I2] = (unsigned long) &sf->info; 520 regs->u_regs[UREG_I2] = (unsigned long) &sf->info;
536 521
537 /* 4. signal handler */ 522 /* 4. signal handler */
538 regs->tpc = (unsigned long) ka->sa.sa_handler; 523 regs->tpc = (unsigned long) ksig->ka.sa.sa_handler;
539 regs->tnpc = (regs->tpc + 4); 524 regs->tnpc = (regs->tpc + 4);
540 if (test_thread_flag(TIF_32BIT)) { 525 if (test_thread_flag(TIF_32BIT)) {
541 regs->tpc &= 0xffffffff; 526 regs->tpc &= 0xffffffff;
@@ -543,8 +528,8 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
543 } 528 }
544 529
545 /* 5. return to kernel instructions */ 530 /* 5. return to kernel instructions */
546 if (ka->ka_restorer) { 531 if (ksig->ka.ka_restorer) {
547 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; 532 regs->u_regs[UREG_I7] = (unsigned long)ksig->ka.ka_restorer;
548 } else { 533 } else {
549 unsigned long address = ((unsigned long)&(sf->insns[0])); 534 unsigned long address = ((unsigned long)&(sf->insns[0]));
550 535
@@ -553,23 +538,14 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
553 err = __put_user(0x821020d8, &sf->insns[0]); /*mov __NR_sigreturn, %g1*/ 538 err = __put_user(0x821020d8, &sf->insns[0]); /*mov __NR_sigreturn, %g1*/
554 err |= __put_user(0x91d02010, &sf->insns[1]); /*t 0x10*/ 539 err |= __put_user(0x91d02010, &sf->insns[1]); /*t 0x10*/
555 if (err) 540 if (err)
556 goto sigsegv; 541 return err;
557 flush_signal_insns(address); 542 flush_signal_insns(address);
558 } 543 }
559 return 0; 544 return 0;
560
561sigill:
562 do_exit(SIGILL);
563 return -EINVAL;
564
565sigsegv:
566 force_sigsegv(signo, current);
567 return -EFAULT;
568} 545}
569 546
570static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs, 547static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs,
571 unsigned long signr, sigset_t *oldset, 548 sigset_t *oldset)
572 siginfo_t *info)
573{ 549{
574 struct rt_signal_frame32 __user *sf; 550 struct rt_signal_frame32 __user *sf;
575 int i, err, wsaved; 551 int i, err, wsaved;
@@ -591,10 +567,12 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
591 sigframe_size += sizeof(__siginfo_rwin_t); 567 sigframe_size += sizeof(__siginfo_rwin_t);
592 568
593 sf = (struct rt_signal_frame32 __user *) 569 sf = (struct rt_signal_frame32 __user *)
594 get_sigframe(&ka->sa, regs, sigframe_size); 570 get_sigframe(ksig, regs, sigframe_size);
595 571
596 if (invalid_frame_pointer(sf, sigframe_size)) 572 if (invalid_frame_pointer(sf, sigframe_size)) {
597 goto sigill; 573 do_exit(SIGILL);
574 return -EINVAL;
575 }
598 576
599 tail = (sf + 1); 577 tail = (sf + 1);
600 578
@@ -639,12 +617,10 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
639 } 617 }
640 618
641 /* Update the siginfo structure. */ 619 /* Update the siginfo structure. */
642 err |= copy_siginfo_to_user32(&sf->info, info); 620 err |= copy_siginfo_to_user32(&sf->info, &ksig->info);
643 621
644 /* Setup sigaltstack */ 622 /* Setup sigaltstack */
645 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 623 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
646 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
647 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
648 624
649 switch (_NSIG_WORDS) { 625 switch (_NSIG_WORDS) {
650 case 4: seta.sig[7] = (oldset->sig[3] >> 32); 626 case 4: seta.sig[7] = (oldset->sig[3] >> 32);
@@ -674,16 +650,16 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
674 err |= __put_user(rp->ins[7], &sf->ss.callers_pc); 650 err |= __put_user(rp->ins[7], &sf->ss.callers_pc);
675 } 651 }
676 if (err) 652 if (err)
677 goto sigsegv; 653 return err;
678 654
679 /* 3. signal handler back-trampoline and parameters */ 655 /* 3. signal handler back-trampoline and parameters */
680 regs->u_regs[UREG_FP] = (unsigned long) sf; 656 regs->u_regs[UREG_FP] = (unsigned long) sf;
681 regs->u_regs[UREG_I0] = signr; 657 regs->u_regs[UREG_I0] = ksig->sig;
682 regs->u_regs[UREG_I1] = (unsigned long) &sf->info; 658 regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
683 regs->u_regs[UREG_I2] = (unsigned long) &sf->regs; 659 regs->u_regs[UREG_I2] = (unsigned long) &sf->regs;
684 660
685 /* 4. signal handler */ 661 /* 4. signal handler */
686 regs->tpc = (unsigned long) ka->sa.sa_handler; 662 regs->tpc = (unsigned long) ksig->ka.sa.sa_handler;
687 regs->tnpc = (regs->tpc + 4); 663 regs->tnpc = (regs->tpc + 4);
688 if (test_thread_flag(TIF_32BIT)) { 664 if (test_thread_flag(TIF_32BIT)) {
689 regs->tpc &= 0xffffffff; 665 regs->tpc &= 0xffffffff;
@@ -691,8 +667,8 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
691 } 667 }
692 668
693 /* 5. return to kernel instructions */ 669 /* 5. return to kernel instructions */
694 if (ka->ka_restorer) 670 if (ksig->ka.ka_restorer)
695 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; 671 regs->u_regs[UREG_I7] = (unsigned long)ksig->ka.ka_restorer;
696 else { 672 else {
697 unsigned long address = ((unsigned long)&(sf->insns[0])); 673 unsigned long address = ((unsigned long)&(sf->insns[0]));
698 674
@@ -704,36 +680,25 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
704 /* t 0x10 */ 680 /* t 0x10 */
705 err |= __put_user(0x91d02010, &sf->insns[1]); 681 err |= __put_user(0x91d02010, &sf->insns[1]);
706 if (err) 682 if (err)
707 goto sigsegv; 683 return err;
708 684
709 flush_signal_insns(address); 685 flush_signal_insns(address);
710 } 686 }
711 return 0; 687 return 0;
712
713sigill:
714 do_exit(SIGILL);
715 return -EINVAL;
716
717sigsegv:
718 force_sigsegv(signr, current);
719 return -EFAULT;
720} 688}
721 689
722static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka, 690static inline void handle_signal32(struct ksignal *ksig,
723 siginfo_t *info, 691 struct pt_regs *regs)
724 sigset_t *oldset, struct pt_regs *regs)
725{ 692{
693 sigset_t *oldset = sigmask_to_save();
726 int err; 694 int err;
727 695
728 if (ka->sa.sa_flags & SA_SIGINFO) 696 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
729 err = setup_rt_frame32(ka, regs, signr, oldset, info); 697 err = setup_rt_frame32(ksig, regs, oldset);
730 else 698 else
731 err = setup_frame32(ka, regs, signr, oldset); 699 err = setup_frame32(ksig, regs, oldset);
732
733 if (err)
734 return;
735 700
736 signal_delivered(signr, info, ka, regs, 0); 701 signal_setup_done(err, ksig, 0);
737} 702}
738 703
739static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, 704static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs,
@@ -763,50 +728,41 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
763 */ 728 */
764void do_signal32(sigset_t *oldset, struct pt_regs * regs) 729void do_signal32(sigset_t *oldset, struct pt_regs * regs)
765{ 730{
766 struct k_sigaction ka; 731 struct ksignal ksig;
767 unsigned long orig_i0; 732 unsigned long orig_i0 = 0;
768 int restart_syscall; 733 int restart_syscall = 0;
769 siginfo_t info; 734 bool has_handler = get_signal(&ksig);
770 int signr;
771
772 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
773 735
774 restart_syscall = 0;
775 orig_i0 = 0;
776 if (pt_regs_is_syscall(regs) && 736 if (pt_regs_is_syscall(regs) &&
777 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { 737 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
778 restart_syscall = 1; 738 restart_syscall = 1;
779 orig_i0 = regs->u_regs[UREG_G6]; 739 orig_i0 = regs->u_regs[UREG_G6];
780 } 740 }
781 741
782 if (signr > 0) { 742 if (has_handler) {
783 if (restart_syscall) 743 if (restart_syscall)
784 syscall_restart32(orig_i0, regs, &ka.sa); 744 syscall_restart32(orig_i0, regs, &ksig.ka.sa);
785 handle_signal32(signr, &ka, &info, oldset, regs); 745 handle_signal32(&ksig, regs);
786 return; 746 } else {
787 } 747 if (restart_syscall) {
788 if (restart_syscall && 748 switch (regs->u_regs[UREG_I0]) {
789 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 749 case ERESTARTNOHAND:
790 regs->u_regs[UREG_I0] == ERESTARTSYS || 750 case ERESTARTSYS:
791 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 751 case ERESTARTNOINTR:
792 /* replay the system call when we are done */ 752 /* replay the system call when we are done */
793 regs->u_regs[UREG_I0] = orig_i0; 753 regs->u_regs[UREG_I0] = orig_i0;
794 regs->tpc -= 4; 754 regs->tpc -= 4;
795 regs->tnpc -= 4; 755 regs->tnpc -= 4;
796 pt_regs_clear_syscall(regs); 756 pt_regs_clear_syscall(regs);
797 } 757 case ERESTART_RESTARTBLOCK:
798 if (restart_syscall && 758 regs->u_regs[UREG_G1] = __NR_restart_syscall;
799 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 759 regs->tpc -= 4;
800 regs->u_regs[UREG_G1] = __NR_restart_syscall; 760 regs->tnpc -= 4;
801 regs->tpc -= 4; 761 pt_regs_clear_syscall(regs);
802 regs->tnpc -= 4; 762 }
803 pt_regs_clear_syscall(regs); 763 }
764 restore_saved_sigmask();
804 } 765 }
805
806 /* If there's no signal to deliver, we just put the saved sigmask
807 * back
808 */
809 restore_saved_sigmask();
810} 766}
811 767
812struct sigstack32 { 768struct sigstack32 {
@@ -856,29 +812,3 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp)
856out: 812out:
857 return ret; 813 return ret;
858} 814}
859
860asmlinkage long do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp)
861{
862 stack_t uss, uoss;
863 u32 u_ss_sp = 0;
864 int ret;
865 mm_segment_t old_fs;
866 stack_t32 __user *uss32 = compat_ptr(ussa);
867 stack_t32 __user *uoss32 = compat_ptr(uossa);
868
869 if (ussa && (get_user(u_ss_sp, &uss32->ss_sp) ||
870 __get_user(uss.ss_flags, &uss32->ss_flags) ||
871 __get_user(uss.ss_size, &uss32->ss_size)))
872 return -EFAULT;
873 uss.ss_sp = compat_ptr(u_ss_sp);
874 old_fs = get_fs();
875 set_fs(KERNEL_DS);
876 ret = do_sigaltstack(ussa ? (stack_t __user *) &uss : NULL,
877 uossa ? (stack_t __user *) &uoss : NULL, sp);
878 set_fs(old_fs);
879 if (!ret && uossa && (put_user(ptr_to_compat(uoss.ss_sp), &uoss32->ss_sp) ||
880 __put_user(uoss.ss_flags, &uoss32->ss_flags) ||
881 __put_user(uoss.ss_size, &uoss32->ss_size)))
882 return -EFAULT;
883 return ret;
884}
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 68f9c8650af4..7d5d8e1f8415 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -59,18 +59,6 @@ struct rt_signal_frame {
59#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7))) 59#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7)))
60#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7))) 60#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7)))
61 61
62static int _sigpause_common(old_sigset_t set)
63{
64 sigset_t blocked;
65 siginitset(&blocked, set);
66 return sigsuspend(&blocked);
67}
68
69asmlinkage int sys_sigsuspend(old_sigset_t set)
70{
71 return _sigpause_common(set);
72}
73
74asmlinkage void do_sigreturn(struct pt_regs *regs) 62asmlinkage void do_sigreturn(struct pt_regs *regs)
75{ 63{
76 struct signal_frame __user *sf; 64 struct signal_frame __user *sf;
@@ -141,9 +129,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
141 unsigned int psr, pc, npc; 129 unsigned int psr, pc, npc;
142 __siginfo_fpu_t __user *fpu_save; 130 __siginfo_fpu_t __user *fpu_save;
143 __siginfo_rwin_t __user *rwin_save; 131 __siginfo_rwin_t __user *rwin_save;
144 mm_segment_t old_fs;
145 sigset_t set; 132 sigset_t set;
146 stack_t st;
147 int err; 133 int err;
148 134
149 synchronize_user_stack(); 135 synchronize_user_stack();
@@ -171,8 +157,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
171 if (!err && fpu_save) 157 if (!err && fpu_save)
172 err |= restore_fpu_state(regs, fpu_save); 158 err |= restore_fpu_state(regs, fpu_save);
173 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 159 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
174 160 err |= restore_altstack(&sf->stack);
175 err |= __copy_from_user(&st, &sf->stack, sizeof(stack_t));
176 161
177 if (err) 162 if (err)
178 goto segv; 163 goto segv;
@@ -180,14 +165,6 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
180 regs->pc = pc; 165 regs->pc = pc;
181 regs->npc = npc; 166 regs->npc = npc;
182 167
183 /* It is more difficult to avoid calling this function than to
184 * call it and ignore errors.
185 */
186 old_fs = get_fs();
187 set_fs(KERNEL_DS);
188 do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
189 set_fs(old_fs);
190
191 err |= __get_user(rwin_save, &sf->rwin_save); 168 err |= __get_user(rwin_save, &sf->rwin_save);
192 if (!err && rwin_save) { 169 if (!err && rwin_save) {
193 if (restore_rwin_state(rwin_save)) 170 if (restore_rwin_state(rwin_save))
@@ -209,7 +186,7 @@ static inline int invalid_frame_pointer(void __user *fp, int fplen)
209 return 0; 186 return 0;
210} 187}
211 188
212static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, unsigned long framesize) 189static inline void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, unsigned long framesize)
213{ 190{
214 unsigned long sp = regs->u_regs[UREG_FP]; 191 unsigned long sp = regs->u_regs[UREG_FP];
215 192
@@ -221,12 +198,7 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
221 return (void __user *) -1L; 198 return (void __user *) -1L;
222 199
223 /* This is the X/Open sanctioned signal stack switching. */ 200 /* This is the X/Open sanctioned signal stack switching. */
224 if (sa->sa_flags & SA_ONSTACK) { 201 sp = sigsp(sp, ksig) - framesize;
225 if (sas_ss_flags(sp) == 0)
226 sp = current->sas_ss_sp + current->sas_ss_size;
227 }
228
229 sp -= framesize;
230 202
231 /* Always align the stack frame. This handles two cases. First, 203 /* Always align the stack frame. This handles two cases. First,
232 * sigaltstack need not be mindful of platform specific stack 204 * sigaltstack need not be mindful of platform specific stack
@@ -239,8 +211,8 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
239 return (void __user *) sp; 211 return (void __user *) sp;
240} 212}
241 213
242static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs, 214static int setup_frame(struct ksignal *ksig, struct pt_regs *regs,
243 int signo, sigset_t *oldset) 215 sigset_t *oldset)
244{ 216{
245 struct signal_frame __user *sf; 217 struct signal_frame __user *sf;
246 int sigframe_size, err, wsaved; 218 int sigframe_size, err, wsaved;
@@ -258,10 +230,12 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
258 sigframe_size += sizeof(__siginfo_rwin_t); 230 sigframe_size += sizeof(__siginfo_rwin_t);
259 231
260 sf = (struct signal_frame __user *) 232 sf = (struct signal_frame __user *)
261 get_sigframe(&ka->sa, regs, sigframe_size); 233 get_sigframe(ksig, regs, sigframe_size);
262 234
263 if (invalid_frame_pointer(sf, sigframe_size)) 235 if (invalid_frame_pointer(sf, sigframe_size)) {
264 goto sigill_and_return; 236 do_exit(SIGILL);
237 return -EINVAL;
238 }
265 239
266 tail = sf + 1; 240 tail = sf + 1;
267 241
@@ -300,21 +274,21 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
300 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32)); 274 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32));
301 } 275 }
302 if (err) 276 if (err)
303 goto sigsegv; 277 return err;
304 278
305 /* 3. signal handler back-trampoline and parameters */ 279 /* 3. signal handler back-trampoline and parameters */
306 regs->u_regs[UREG_FP] = (unsigned long) sf; 280 regs->u_regs[UREG_FP] = (unsigned long) sf;
307 regs->u_regs[UREG_I0] = signo; 281 regs->u_regs[UREG_I0] = ksig->sig;
308 regs->u_regs[UREG_I1] = (unsigned long) &sf->info; 282 regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
309 regs->u_regs[UREG_I2] = (unsigned long) &sf->info; 283 regs->u_regs[UREG_I2] = (unsigned long) &sf->info;
310 284
311 /* 4. signal handler */ 285 /* 4. signal handler */
312 regs->pc = (unsigned long) ka->sa.sa_handler; 286 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
313 regs->npc = (regs->pc + 4); 287 regs->npc = (regs->pc + 4);
314 288
315 /* 5. return to kernel instructions */ 289 /* 5. return to kernel instructions */
316 if (ka->ka_restorer) 290 if (ksig->ka.ka_restorer)
317 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; 291 regs->u_regs[UREG_I7] = (unsigned long)ksig->ka.ka_restorer;
318 else { 292 else {
319 regs->u_regs[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2); 293 regs->u_regs[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2);
320 294
@@ -324,24 +298,16 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
324 /* t 0x10 */ 298 /* t 0x10 */
325 err |= __put_user(0x91d02010, &sf->insns[1]); 299 err |= __put_user(0x91d02010, &sf->insns[1]);
326 if (err) 300 if (err)
327 goto sigsegv; 301 return err;
328 302
329 /* Flush instruction space. */ 303 /* Flush instruction space. */
330 flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); 304 flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0]));
331 } 305 }
332 return 0; 306 return 0;
333
334sigill_and_return:
335 do_exit(SIGILL);
336 return -EINVAL;
337
338sigsegv:
339 force_sigsegv(signo, current);
340 return -EFAULT;
341} 307}
342 308
343static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, 309static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
344 int signo, sigset_t *oldset, siginfo_t *info) 310 sigset_t *oldset)
345{ 311{
346 struct rt_signal_frame __user *sf; 312 struct rt_signal_frame __user *sf;
347 int sigframe_size, wsaved; 313 int sigframe_size, wsaved;
@@ -357,9 +323,11 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
357 if (wsaved) 323 if (wsaved)
358 sigframe_size += sizeof(__siginfo_rwin_t); 324 sigframe_size += sizeof(__siginfo_rwin_t);
359 sf = (struct rt_signal_frame __user *) 325 sf = (struct rt_signal_frame __user *)
360 get_sigframe(&ka->sa, regs, sigframe_size); 326 get_sigframe(ksig, regs, sigframe_size);
361 if (invalid_frame_pointer(sf, sigframe_size)) 327 if (invalid_frame_pointer(sf, sigframe_size)) {
362 goto sigill; 328 do_exit(SIGILL);
329 return -EINVAL;
330 }
363 331
364 tail = sf + 1; 332 tail = sf + 1;
365 err = __put_user(regs->pc, &sf->regs.pc); 333 err = __put_user(regs->pc, &sf->regs.pc);
@@ -391,9 +359,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
391 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t)); 359 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t));
392 360
393 /* Setup sigaltstack */ 361 /* Setup sigaltstack */
394 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 362 err |= __save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
395 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
396 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
397 363
398 if (!wsaved) { 364 if (!wsaved) {
399 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 365 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
@@ -405,21 +371,21 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
405 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32)); 371 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32));
406 } 372 }
407 373
408 err |= copy_siginfo_to_user(&sf->info, info); 374 err |= copy_siginfo_to_user(&sf->info, &ksig->info);
409 375
410 if (err) 376 if (err)
411 goto sigsegv; 377 return err;
412 378
413 regs->u_regs[UREG_FP] = (unsigned long) sf; 379 regs->u_regs[UREG_FP] = (unsigned long) sf;
414 regs->u_regs[UREG_I0] = signo; 380 regs->u_regs[UREG_I0] = ksig->sig;
415 regs->u_regs[UREG_I1] = (unsigned long) &sf->info; 381 regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
416 regs->u_regs[UREG_I2] = (unsigned long) &sf->regs; 382 regs->u_regs[UREG_I2] = (unsigned long) &sf->regs;
417 383
418 regs->pc = (unsigned long) ka->sa.sa_handler; 384 regs->pc = (unsigned long) ksig->ka.sa.sa_handler;
419 regs->npc = (regs->pc + 4); 385 regs->npc = (regs->pc + 4);
420 386
421 if (ka->ka_restorer) 387 if (ksig->ka.ka_restorer)
422 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; 388 regs->u_regs[UREG_I7] = (unsigned long)ksig->ka.ka_restorer;
423 else { 389 else {
424 regs->u_regs[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2); 390 regs->u_regs[UREG_I7] = (unsigned long)(&(sf->insns[0]) - 2);
425 391
@@ -429,38 +395,25 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
429 /* t 0x10 */ 395 /* t 0x10 */
430 err |= __put_user(0x91d02010, &sf->insns[1]); 396 err |= __put_user(0x91d02010, &sf->insns[1]);
431 if (err) 397 if (err)
432 goto sigsegv; 398 return err;
433 399
434 /* Flush instruction space. */ 400 /* Flush instruction space. */
435 flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); 401 flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0]));
436 } 402 }
437 return 0; 403 return 0;
438
439sigill:
440 do_exit(SIGILL);
441 return -EINVAL;
442
443sigsegv:
444 force_sigsegv(signo, current);
445 return -EFAULT;
446} 404}
447 405
448static inline void 406static inline void
449handle_signal(unsigned long signr, struct k_sigaction *ka, 407handle_signal(struct ksignal *ksig, struct pt_regs *regs)
450 siginfo_t *info, struct pt_regs *regs)
451{ 408{
452 sigset_t *oldset = sigmask_to_save(); 409 sigset_t *oldset = sigmask_to_save();
453 int err; 410 int err;
454 411
455 if (ka->sa.sa_flags & SA_SIGINFO) 412 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
456 err = setup_rt_frame(ka, regs, signr, oldset, info); 413 err = setup_rt_frame(ksig, regs, oldset);
457 else 414 else
458 err = setup_frame(ka, regs, signr, oldset); 415 err = setup_frame(ksig, regs, oldset);
459 416 signal_setup_done(err, ksig, 0);
460 if (err)
461 return;
462
463 signal_delivered(signr, info, ka, regs, 0);
464} 417}
465 418
466static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, 419static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
@@ -490,10 +443,9 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
490 */ 443 */
491static void do_signal(struct pt_regs *regs, unsigned long orig_i0) 444static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
492{ 445{
493 struct k_sigaction ka; 446 struct ksignal ksig;
494 int restart_syscall; 447 int restart_syscall;
495 siginfo_t info; 448 bool has_handler;
496 int signr;
497 449
498 /* It's a lot of work and synchronization to add a new ptrace 450 /* It's a lot of work and synchronization to add a new ptrace
499 * register for GDB to save and restore in order to get 451 * register for GDB to save and restore in order to get
@@ -516,7 +468,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
516 if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) 468 if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C))
517 regs->u_regs[UREG_G6] = orig_i0; 469 regs->u_regs[UREG_G6] = orig_i0;
518 470
519 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 471 has_handler = get_signal(&ksig);
520 472
521 /* If the debugger messes with the program counter, it clears 473 /* If the debugger messes with the program counter, it clears
522 * the software "in syscall" bit, directing us to not perform 474 * the software "in syscall" bit, directing us to not perform
@@ -528,35 +480,30 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
528 orig_i0 = regs->u_regs[UREG_G6]; 480 orig_i0 = regs->u_regs[UREG_G6];
529 } 481 }
530 482
531 483 if (has_handler) {
532 if (signr > 0) {
533 if (restart_syscall) 484 if (restart_syscall)
534 syscall_restart(orig_i0, regs, &ka.sa); 485 syscall_restart(orig_i0, regs, &ksig.ka.sa);
535 handle_signal(signr, &ka, &info, regs); 486 handle_signal(&ksig, regs);
536 return; 487 } else {
537 } 488 if (restart_syscall) {
538 if (restart_syscall && 489 switch (regs->u_regs[UREG_I0]) {
539 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 490 case ERESTARTNOHAND:
540 regs->u_regs[UREG_I0] == ERESTARTSYS || 491 case ERESTARTSYS:
541 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 492 case ERESTARTNOINTR:
542 /* replay the system call when we are done */ 493 /* replay the system call when we are done */
543 regs->u_regs[UREG_I0] = orig_i0; 494 regs->u_regs[UREG_I0] = orig_i0;
544 regs->pc -= 4; 495 regs->pc -= 4;
545 regs->npc -= 4; 496 regs->npc -= 4;
546 pt_regs_clear_syscall(regs); 497 pt_regs_clear_syscall(regs);
547 } 498 case ERESTART_RESTARTBLOCK:
548 if (restart_syscall && 499 regs->u_regs[UREG_G1] = __NR_restart_syscall;
549 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 500 regs->pc -= 4;
550 regs->u_regs[UREG_G1] = __NR_restart_syscall; 501 regs->npc -= 4;
551 regs->pc -= 4; 502 pt_regs_clear_syscall(regs);
552 regs->npc -= 4; 503 }
553 pt_regs_clear_syscall(regs); 504 }
505 restore_saved_sigmask();
554 } 506 }
555
556 /* if there's no signal to deliver, we just put the saved sigmask
557 * back
558 */
559 restore_saved_sigmask();
560} 507}
561 508
562void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, 509void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 689e1ba62809..35923e8abd82 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -236,23 +236,6 @@ struct rt_signal_frame {
236 __siginfo_rwin_t *rwin_save; 236 __siginfo_rwin_t *rwin_save;
237}; 237};
238 238
239static long _sigpause_common(old_sigset_t set)
240{
241 sigset_t blocked;
242 siginitset(&blocked, set);
243 return sigsuspend(&blocked);
244}
245
246asmlinkage long sys_sigpause(unsigned int set)
247{
248 return _sigpause_common(set);
249}
250
251asmlinkage long sys_sigsuspend(old_sigset_t set)
252{
253 return _sigpause_common(set);
254}
255
256void do_rt_sigreturn(struct pt_regs *regs) 239void do_rt_sigreturn(struct pt_regs *regs)
257{ 240{
258 struct rt_signal_frame __user *sf; 241 struct rt_signal_frame __user *sf;
@@ -295,7 +278,8 @@ void do_rt_sigreturn(struct pt_regs *regs)
295 err |= restore_fpu_state(regs, fpu_save); 278 err |= restore_fpu_state(regs, fpu_save);
296 279
297 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 280 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
298 if (err || do_sigaltstack(&sf->stack, NULL, (unsigned long)sf) == -EFAULT) 281 err |= restore_altstack(&sf->stack);
282 if (err)
299 goto segv; 283 goto segv;
300 284
301 err |= __get_user(rwin_save, &sf->rwin_save); 285 err |= __get_user(rwin_save, &sf->rwin_save);
@@ -324,7 +308,7 @@ static int invalid_frame_pointer(void __user *fp)
324 return 0; 308 return 0;
325} 309}
326 310
327static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize) 311static inline void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, unsigned long framesize)
328{ 312{
329 unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS; 313 unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS;
330 314
@@ -336,12 +320,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *
336 return (void __user *) -1L; 320 return (void __user *) -1L;
337 321
338 /* This is the X/Open sanctioned signal stack switching. */ 322 /* This is the X/Open sanctioned signal stack switching. */
339 if (ka->sa.sa_flags & SA_ONSTACK) { 323 sp = sigsp(sp, ksig) - framesize;
340 if (sas_ss_flags(sp) == 0)
341 sp = current->sas_ss_sp + current->sas_ss_size;
342 }
343
344 sp -= framesize;
345 324
346 /* Always align the stack frame. This handles two cases. First, 325 /* Always align the stack frame. This handles two cases. First,
347 * sigaltstack need not be mindful of platform specific stack 326 * sigaltstack need not be mindful of platform specific stack
@@ -355,8 +334,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *
355} 334}
356 335
357static inline int 336static inline int
358setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, 337setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
359 int signo, sigset_t *oldset, siginfo_t *info)
360{ 338{
361 struct rt_signal_frame __user *sf; 339 struct rt_signal_frame __user *sf;
362 int wsaved, err, sf_size; 340 int wsaved, err, sf_size;
@@ -374,10 +352,12 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
374 if (wsaved) 352 if (wsaved)
375 sf_size += sizeof(__siginfo_rwin_t); 353 sf_size += sizeof(__siginfo_rwin_t);
376 sf = (struct rt_signal_frame __user *) 354 sf = (struct rt_signal_frame __user *)
377 get_sigframe(ka, regs, sf_size); 355 get_sigframe(ksig, regs, sf_size);
378 356
379 if (invalid_frame_pointer (sf)) 357 if (invalid_frame_pointer (sf)) {
380 goto sigill; 358 do_exit(SIGILL); /* won't return, actually */
359 return -EINVAL;
360 }
381 361
382 tail = (sf + 1); 362 tail = (sf + 1);
383 363
@@ -403,11 +383,9 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
403 } 383 }
404 384
405 /* Setup sigaltstack */ 385 /* Setup sigaltstack */
406 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 386 err |= __save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
407 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
408 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
409 387
410 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t)); 388 err |= copy_to_user(&sf->mask, sigmask_to_save(), sizeof(sigset_t));
411 389
412 if (!wsaved) { 390 if (!wsaved) {
413 err |= copy_in_user((u64 __user *)sf, 391 err |= copy_in_user((u64 __user *)sf,
@@ -420,18 +398,18 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
420 rp = &current_thread_info()->reg_window[wsaved - 1]; 398 rp = &current_thread_info()->reg_window[wsaved - 1];
421 err |= copy_to_user(sf, rp, sizeof(struct reg_window)); 399 err |= copy_to_user(sf, rp, sizeof(struct reg_window));
422 } 400 }
423 if (info) 401 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
424 err |= copy_siginfo_to_user(&sf->info, info); 402 err |= copy_siginfo_to_user(&sf->info, &ksig->info);
425 else { 403 else {
426 err |= __put_user(signo, &sf->info.si_signo); 404 err |= __put_user(ksig->sig, &sf->info.si_signo);
427 err |= __put_user(SI_NOINFO, &sf->info.si_code); 405 err |= __put_user(SI_NOINFO, &sf->info.si_code);
428 } 406 }
429 if (err) 407 if (err)
430 goto sigsegv; 408 return err;
431 409
432 /* 3. signal handler back-trampoline and parameters */ 410 /* 3. signal handler back-trampoline and parameters */
433 regs->u_regs[UREG_FP] = ((unsigned long) sf) - STACK_BIAS; 411 regs->u_regs[UREG_FP] = ((unsigned long) sf) - STACK_BIAS;
434 regs->u_regs[UREG_I0] = signo; 412 regs->u_regs[UREG_I0] = ksig->sig;
435 regs->u_regs[UREG_I1] = (unsigned long) &sf->info; 413 regs->u_regs[UREG_I1] = (unsigned long) &sf->info;
436 414
437 /* The sigcontext is passed in this way because of how it 415 /* The sigcontext is passed in this way because of how it
@@ -441,37 +419,15 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
441 regs->u_regs[UREG_I2] = (unsigned long) &sf->info; 419 regs->u_regs[UREG_I2] = (unsigned long) &sf->info;
442 420
443 /* 5. signal handler */ 421 /* 5. signal handler */
444 regs->tpc = (unsigned long) ka->sa.sa_handler; 422 regs->tpc = (unsigned long) ksig->ka.sa.sa_handler;
445 regs->tnpc = (regs->tpc + 4); 423 regs->tnpc = (regs->tpc + 4);
446 if (test_thread_flag(TIF_32BIT)) { 424 if (test_thread_flag(TIF_32BIT)) {
447 regs->tpc &= 0xffffffff; 425 regs->tpc &= 0xffffffff;
448 regs->tnpc &= 0xffffffff; 426 regs->tnpc &= 0xffffffff;
449 } 427 }
450 /* 4. return to kernel instructions */ 428 /* 4. return to kernel instructions */
451 regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; 429 regs->u_regs[UREG_I7] = (unsigned long)ksig->ka.ka_restorer;
452 return 0; 430 return 0;
453
454sigill:
455 do_exit(SIGILL);
456 return -EINVAL;
457
458sigsegv:
459 force_sigsegv(signo, current);
460 return -EFAULT;
461}
462
463static inline void handle_signal(unsigned long signr, struct k_sigaction *ka,
464 siginfo_t *info,
465 sigset_t *oldset, struct pt_regs *regs)
466{
467 int err;
468
469 err = setup_rt_frame(ka, regs, signr, oldset,
470 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
471 if (err)
472 return;
473
474 signal_delivered(signr, info, ka, regs, 0);
475} 431}
476 432
477static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, 433static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
@@ -501,11 +457,9 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
501 */ 457 */
502static void do_signal(struct pt_regs *regs, unsigned long orig_i0) 458static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
503{ 459{
504 struct k_sigaction ka; 460 struct ksignal ksig;
505 int restart_syscall; 461 int restart_syscall;
506 sigset_t *oldset = sigmask_to_save(); 462 bool has_handler;
507 siginfo_t info;
508 int signr;
509 463
510 /* It's a lot of work and synchronization to add a new ptrace 464 /* It's a lot of work and synchronization to add a new ptrace
511 * register for GDB to save and restore in order to get 465 * register for GDB to save and restore in order to get
@@ -531,13 +485,13 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
531 485
532#ifdef CONFIG_COMPAT 486#ifdef CONFIG_COMPAT
533 if (test_thread_flag(TIF_32BIT)) { 487 if (test_thread_flag(TIF_32BIT)) {
534 extern void do_signal32(sigset_t *, struct pt_regs *); 488 extern void do_signal32(struct pt_regs *);
535 do_signal32(oldset, regs); 489 do_signal32(regs);
536 return; 490 return;
537 } 491 }
538#endif 492#endif
539 493
540 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 494 has_handler = get_signal(&ksig);
541 495
542 restart_syscall = 0; 496 restart_syscall = 0;
543 if (pt_regs_is_syscall(regs) && 497 if (pt_regs_is_syscall(regs) &&
@@ -546,34 +500,30 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
546 orig_i0 = regs->u_regs[UREG_G6]; 500 orig_i0 = regs->u_regs[UREG_G6];
547 } 501 }
548 502
549 if (signr > 0) { 503 if (has_handler) {
550 if (restart_syscall) 504 if (restart_syscall)
551 syscall_restart(orig_i0, regs, &ka.sa); 505 syscall_restart(orig_i0, regs, &ksig.ka.sa);
552 handle_signal(signr, &ka, &info, oldset, regs); 506 signal_setup_done(setup_rt_frame(&ksig, regs), &ksig, 0);
553 return; 507 } else {
554 } 508 if (restart_syscall) {
555 if (restart_syscall && 509 switch (regs->u_regs[UREG_I0]) {
556 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 510 case ERESTARTNOHAND:
557 regs->u_regs[UREG_I0] == ERESTARTSYS || 511 case ERESTARTSYS:
558 regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { 512 case ERESTARTNOINTR:
559 /* replay the system call when we are done */ 513 /* replay the system call when we are done */
560 regs->u_regs[UREG_I0] = orig_i0; 514 regs->u_regs[UREG_I0] = orig_i0;
561 regs->tpc -= 4; 515 regs->tpc -= 4;
562 regs->tnpc -= 4; 516 regs->tnpc -= 4;
563 pt_regs_clear_syscall(regs); 517 pt_regs_clear_syscall(regs);
564 } 518 case ERESTART_RESTARTBLOCK:
565 if (restart_syscall && 519 regs->u_regs[UREG_G1] = __NR_restart_syscall;
566 regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { 520 regs->tpc -= 4;
567 regs->u_regs[UREG_G1] = __NR_restart_syscall; 521 regs->tnpc -= 4;
568 regs->tpc -= 4; 522 pt_regs_clear_syscall(regs);
569 regs->tnpc -= 4; 523 }
570 pt_regs_clear_syscall(regs); 524 }
525 restore_saved_sigmask();
571 } 526 }
572
573 /* If there's no signal to deliver, we just put the saved sigmask
574 * back
575 */
576 restore_saved_sigmask();
577} 527}
578 528
579void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) 529void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags)
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index 8475a474273a..240a3cecc11e 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -36,108 +36,22 @@ STUB: sra REG1, 0, REG1; \
36 jmpl %g1 + %lo(SYSCALL), %g0; \ 36 jmpl %g1 + %lo(SYSCALL), %g0; \
37 sra REG3, 0, REG3 37 sra REG3, 0, REG3
38 38
39#define SIGN4(STUB,SYSCALL,REG1,REG2,REG3,REG4) \
40 .align 32; \
41 .globl STUB; \
42STUB: sra REG1, 0, REG1; \
43 sethi %hi(SYSCALL), %g1; \
44 sra REG2, 0, REG2; \
45 sra REG3, 0, REG3; \
46 jmpl %g1 + %lo(SYSCALL), %g0; \
47 sra REG4, 0, REG4
48
49SIGN1(sys32_exit, sparc_exit, %o0)
50SIGN1(sys32_exit_group, sparc_exit_group, %o0)
51SIGN1(sys32_wait4, compat_sys_wait4, %o2)
52SIGN1(sys32_creat, sys_creat, %o1)
53SIGN1(sys32_mknod, sys_mknod, %o1)
54SIGN1(sys32_umount, sys_umount, %o1)
55SIGN1(sys32_signal, sys_signal, %o0)
56SIGN1(sys32_access, sys_access, %o1)
57SIGN1(sys32_msync, sys_msync, %o2)
58SIGN2(sys32_reboot, sys_reboot, %o0, %o1)
59SIGN1(sys32_setitimer, compat_sys_setitimer, %o0)
60SIGN1(sys32_getitimer, compat_sys_getitimer, %o0)
61SIGN1(sys32_sethostname, sys_sethostname, %o1)
62SIGN1(sys32_swapon, sys_swapon, %o1)
63SIGN1(sys32_sigaction, compat_sys_sigaction, %o0)
64SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0)
65SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0)
66SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0)
67SIGN2(sys32_rt_sigqueueinfo, compat_sys_rt_sigqueueinfo, %o0, %o1)
68SIGN1(sys32_getrusage, compat_sys_getrusage, %o0) 39SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
69SIGN1(sys32_setxattr, sys_setxattr, %o4)
70SIGN1(sys32_lsetxattr, sys_lsetxattr, %o4)
71SIGN1(sys32_fsetxattr, sys_fsetxattr, %o4)
72SIGN1(sys32_fgetxattr, sys_fgetxattr, %o0)
73SIGN1(sys32_flistxattr, sys_flistxattr, %o0)
74SIGN1(sys32_fremovexattr, sys_fremovexattr, %o0)
75SIGN2(sys32_tkill, sys_tkill, %o0, %o1)
76SIGN1(sys32_epoll_create, sys_epoll_create, %o0)
77SIGN3(sys32_epoll_ctl, sys_epoll_ctl, %o0, %o1, %o2)
78SIGN3(sys32_epoll_wait, sys_epoll_wait, %o0, %o2, %o3)
79SIGN1(sys32_readahead, compat_sys_readahead, %o0) 40SIGN1(sys32_readahead, compat_sys_readahead, %o0)
80SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4) 41SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
81SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5) 42SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
82SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1)
83SIGN1(sys32_mlockall, sys_mlockall, %o0)
84SIGN1(sys32_clock_nanosleep, compat_sys_clock_nanosleep, %o1) 43SIGN1(sys32_clock_nanosleep, compat_sys_clock_nanosleep, %o1)
85SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1) 44SIGN1(sys32_timer_settime, compat_sys_timer_settime, %o1)
86SIGN1(sys32_io_submit, compat_sys_io_submit, %o1) 45SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
87SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) 46SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
88SIGN1(sys32_select, compat_sys_select, %o0) 47SIGN1(sys32_select, compat_sys_select, %o0)
89SIGN1(sys32_mkdir, sys_mkdir, %o1)
90SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) 48SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5)
91SIGN1(sys32_sysfs, compat_sys_sysfs, %o0)
92SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1) 49SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
93SIGN2(sys32_sendfile64, sys_sendfile, %o0, %o1)
94SIGN1(sys32_prctl, sys_prctl, %o0)
95SIGN1(sys32_sched_rr_get_interval, compat_sys_sched_rr_get_interval, %o0)
96SIGN2(sys32_waitpid, sys_waitpid, %o0, %o2)
97SIGN1(sys32_getgroups, sys_getgroups, %o0)
98SIGN1(sys32_getpgid, sys_getpgid, %o0)
99SIGN2(sys32_getpriority, sys_getpriority, %o0, %o1)
100SIGN1(sys32_getsid, sys_getsid, %o0)
101SIGN2(sys32_kill, sys_kill, %o0, %o1)
102SIGN1(sys32_nice, sys_nice, %o0)
103SIGN1(sys32_lseek, sys_lseek, %o1)
104SIGN2(sys32_open, sparc32_open, %o1, %o2)
105SIGN1(sys32_readlink, sys_readlink, %o2)
106SIGN1(sys32_sched_get_priority_max, sys_sched_get_priority_max, %o0)
107SIGN1(sys32_sched_get_priority_min, sys_sched_get_priority_min, %o0)
108SIGN1(sys32_sched_getparam, sys_sched_getparam, %o0)
109SIGN1(sys32_sched_getscheduler, sys_sched_getscheduler, %o0)
110SIGN1(sys32_sched_setparam, sys_sched_setparam, %o0)
111SIGN2(sys32_sched_setscheduler, sys_sched_setscheduler, %o0, %o1)
112SIGN1(sys32_getdomainname, sys_getdomainname, %o1)
113SIGN1(sys32_setdomainname, sys_setdomainname, %o1)
114SIGN1(sys32_setgroups, sys_setgroups, %o0)
115SIGN2(sys32_setpgid, sys_setpgid, %o0, %o1)
116SIGN3(sys32_setpriority, sys_setpriority, %o0, %o1, %o2)
117SIGN1(sys32_ssetmask, sys_ssetmask, %o0)
118SIGN2(sys32_syslog, sys_syslog, %o0, %o2)
119SIGN1(sys32_umask, sys_umask, %o0)
120SIGN3(sys32_tgkill, sys_tgkill, %o0, %o1, %o2)
121SIGN1(sys32_sendto, sys_sendto, %o0)
122SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) 50SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
123SIGN3(sys32_socket, sys_socket, %o0, %o1, %o2)
124SIGN2(sys32_connect, sys_connect, %o0, %o2)
125SIGN2(sys32_bind, sys_bind, %o0, %o2)
126SIGN2(sys32_listen, sys_listen, %o0, %o1)
127SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) 51SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
128SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) 52SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
129SIGN2(sys32_shutdown, sys_shutdown, %o0, %o1)
130SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2)
131SIGN1(sys32_getpeername, sys_getpeername, %o0)
132SIGN1(sys32_getsockname, sys_getsockname, %o0)
133SIGN2(sys32_ioprio_get, sys_ioprio_get, %o0, %o1)
134SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2)
135SIGN2(sys32_splice, sys_splice, %o0, %o2)
136SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) 53SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5)
137SIGN2(sys32_tee, sys_tee, %o0, %o1)
138SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0) 54SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0)
139SIGN1(sys32_truncate, sys_truncate, %o1)
140SIGN1(sys32_ftruncate, sys_ftruncate, %o1)
141 55
142 .globl sys32_mmap2 56 .globl sys32_mmap2
143sys32_mmap2: 57sys32_mmap2:
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 4a4cdc633f6b..f38f2280fade 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -206,133 +206,19 @@ asmlinkage long compat_sys_fstatat64(unsigned int dfd,
206 return cp_compat_stat64(&stat, statbuf); 206 return cp_compat_stat64(&stat, statbuf);
207} 207}
208 208
209asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2) 209COMPAT_SYSCALL_DEFINE3(sparc_sigaction, int, sig,
210 struct compat_old_sigaction __user *,act,
211 struct compat_old_sigaction __user *,oact)
210{ 212{
211 return sys_sysfs(option, arg1, arg2);
212}
213
214asmlinkage long compat_sys_rt_sigprocmask(int how,
215 compat_sigset_t __user *set,
216 compat_sigset_t __user *oset,
217 compat_size_t sigsetsize)
218{
219 sigset_t s;
220 compat_sigset_t s32;
221 int ret;
222 mm_segment_t old_fs = get_fs();
223
224 if (set) {
225 if (copy_from_user (&s32, set, sizeof(compat_sigset_t)))
226 return -EFAULT;
227 switch (_NSIG_WORDS) {
228 case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32);
229 case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32);
230 case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
231 case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
232 }
233 }
234 set_fs (KERNEL_DS);
235 ret = sys_rt_sigprocmask(how,
236 set ? (sigset_t __user *) &s : NULL,
237 oset ? (sigset_t __user *) &s : NULL,
238 sigsetsize);
239 set_fs (old_fs);
240 if (ret) return ret;
241 if (oset) {
242 switch (_NSIG_WORDS) {
243 case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
244 case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
245 case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
246 case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
247 }
248 if (copy_to_user (oset, &s32, sizeof(compat_sigset_t)))
249 return -EFAULT;
250 }
251 return 0;
252}
253
254asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
255 compat_size_t sigsetsize)
256{
257 sigset_t s;
258 compat_sigset_t s32;
259 int ret;
260 mm_segment_t old_fs = get_fs();
261
262 set_fs (KERNEL_DS);
263 ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
264 set_fs (old_fs);
265 if (!ret) {
266 switch (_NSIG_WORDS) {
267 case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
268 case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
269 case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
270 case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
271 }
272 if (copy_to_user (set, &s32, sizeof(compat_sigset_t)))
273 return -EFAULT;
274 }
275 return ret;
276}
277
278asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
279 struct compat_siginfo __user *uinfo)
280{
281 siginfo_t info;
282 int ret;
283 mm_segment_t old_fs = get_fs();
284
285 if (copy_siginfo_from_user32(&info, uinfo))
286 return -EFAULT;
287
288 set_fs (KERNEL_DS);
289 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
290 set_fs (old_fs);
291 return ret;
292}
293
294asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act,
295 struct old_sigaction32 __user *oact)
296{
297 struct k_sigaction new_ka, old_ka;
298 int ret;
299
300 WARN_ON_ONCE(sig >= 0); 213 WARN_ON_ONCE(sig >= 0);
301 sig = -sig; 214 return compat_sys_sigaction(-sig, act, oact);
302
303 if (act) {
304 compat_old_sigset_t mask;
305 u32 u_handler, u_restorer;
306
307 ret = get_user(u_handler, &act->sa_handler);
308 new_ka.sa.sa_handler = compat_ptr(u_handler);
309 ret |= __get_user(u_restorer, &act->sa_restorer);
310 new_ka.sa.sa_restorer = compat_ptr(u_restorer);
311 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
312 ret |= __get_user(mask, &act->sa_mask);
313 if (ret)
314 return ret;
315 new_ka.ka_restorer = NULL;
316 siginitset(&new_ka.sa.sa_mask, mask);
317 }
318
319 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
320
321 if (!ret && oact) {
322 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), &oact->sa_handler);
323 ret |= __put_user(ptr_to_compat(old_ka.sa.sa_restorer), &oact->sa_restorer);
324 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
325 ret |= __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
326 }
327
328 return ret;
329} 215}
330 216
331asmlinkage long compat_sys_rt_sigaction(int sig, 217COMPAT_SYSCALL_DEFINE5(rt_sigaction, int, sig,
332 struct sigaction32 __user *act, 218 struct compat_sigaction __user *,act,
333 struct sigaction32 __user *oact, 219 struct compat_sigaction __user *,oact,
334 void __user *restorer, 220 void __user *,restorer,
335 compat_size_t sigsetsize) 221 compat_size_t,sigsetsize)
336{ 222{
337 struct k_sigaction new_ka, old_ka; 223 struct k_sigaction new_ka, old_ka;
338 int ret; 224 int ret;
@@ -349,12 +235,7 @@ asmlinkage long compat_sys_rt_sigaction(int sig,
349 ret = get_user(u_handler, &act->sa_handler); 235 ret = get_user(u_handler, &act->sa_handler);
350 new_ka.sa.sa_handler = compat_ptr(u_handler); 236 new_ka.sa.sa_handler = compat_ptr(u_handler);
351 ret |= __copy_from_user(&set32, &act->sa_mask, sizeof(compat_sigset_t)); 237 ret |= __copy_from_user(&set32, &act->sa_mask, sizeof(compat_sigset_t));
352 switch (_NSIG_WORDS) { 238 sigset_from_compat(&new_ka.sa.sa_mask, &set32);
353 case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] | (((long)set32.sig[7]) << 32);
354 case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4] | (((long)set32.sig[5]) << 32);
355 case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2] | (((long)set32.sig[3]) << 32);
356 case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0] | (((long)set32.sig[1]) << 32);
357 }
358 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); 239 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
359 ret |= __get_user(u_restorer, &act->sa_restorer); 240 ret |= __get_user(u_restorer, &act->sa_restorer);
360 new_ka.sa.sa_restorer = compat_ptr(u_restorer); 241 new_ka.sa.sa_restorer = compat_ptr(u_restorer);
@@ -365,12 +246,7 @@ asmlinkage long compat_sys_rt_sigaction(int sig,
365 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 246 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
366 247
367 if (!ret && oact) { 248 if (!ret && oact) {
368 switch (_NSIG_WORDS) { 249 sigset_to_compat(&set32, &old_ka.sa.sa_mask);
369 case 4: set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32); set32.sig[6] = old_ka.sa.sa_mask.sig[3];
370 case 3: set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32); set32.sig[4] = old_ka.sa.sa_mask.sig[2];
371 case 2: set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32); set32.sig[2] = old_ka.sa.sa_mask.sig[1];
372 case 1: set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); set32.sig[0] = old_ka.sa.sa_mask.sig[0];
373 }
374 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), &oact->sa_handler); 250 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), &oact->sa_handler);
375 ret |= __copy_to_user(&oact->sa_mask, &set32, sizeof(compat_sigset_t)); 251 ret |= __copy_to_user(&oact->sa_mask, &set32, sizeof(compat_sigset_t));
376 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 252 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
@@ -382,35 +258,6 @@ asmlinkage long compat_sys_rt_sigaction(int sig,
382 return ret; 258 return ret;
383} 259}
384 260
385#ifdef CONFIG_MODULES
386
387asmlinkage long sys32_init_module(void __user *umod, u32 len,
388 const char __user *uargs)
389{
390 return sys_init_module(umod, len, uargs);
391}
392
393asmlinkage long sys32_delete_module(const char __user *name_user,
394 unsigned int flags)
395{
396 return sys_delete_module(name_user, flags);
397}
398
399#else /* CONFIG_MODULES */
400
401asmlinkage long sys32_init_module(const char __user *name_user,
402 struct module __user *mod_user)
403{
404 return -ENOSYS;
405}
406
407asmlinkage long sys32_delete_module(const char __user *name_user)
408{
409 return -ENOSYS;
410}
411
412#endif /* CONFIG_MODULES */
413
414asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, 261asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
415 char __user *ubuf, 262 char __user *ubuf,
416 compat_size_t count, 263 compat_size_t count,
@@ -456,16 +303,6 @@ long compat_sys_fadvise64_64(int fd,
456 advice); 303 advice);
457} 304}
458 305
459/* This is just a version for 32-bit applications which does
460 * not force O_LARGEFILE on.
461 */
462
463asmlinkage long sparc32_open(const char __user *filename,
464 int flags, int mode)
465{
466 return do_sys_open(AT_FDCWD, filename, flags, mode);
467}
468
469long sys32_lookup_dcookie(unsigned long cookie_high, 306long sys32_lookup_dcookie(unsigned long cookie_high,
470 unsigned long cookie_low, 307 unsigned long cookie_low,
471 char __user *buf, size_t len) 308 char __user *buf, size_t len)
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 2da0bdcae52f..3a8d1844402e 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -160,49 +160,19 @@ sparc_breakpoint (struct pt_regs *regs)
160#endif 160#endif
161} 161}
162 162
163asmlinkage int 163SYSCALL_DEFINE3(sparc_sigaction, int, sig,
164sparc_sigaction (int sig, const struct old_sigaction __user *act, 164 struct old_sigaction __user *,act,
165 struct old_sigaction __user *oact) 165 struct old_sigaction __user *,oact)
166{ 166{
167 struct k_sigaction new_ka, old_ka;
168 int ret;
169
170 WARN_ON_ONCE(sig >= 0); 167 WARN_ON_ONCE(sig >= 0);
171 sig = -sig; 168 return sys_sigaction(-sig, act, oact);
172
173 if (act) {
174 unsigned long mask;
175
176 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
177 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
178 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
179 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
180 __get_user(mask, &act->sa_mask))
181 return -EFAULT;
182 siginitset(&new_ka.sa.sa_mask, mask);
183 new_ka.ka_restorer = NULL;
184 }
185
186 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
187
188 if (!ret && oact) {
189 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
190 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
191 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
192 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
193 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
194 return -EFAULT;
195 }
196
197 return ret;
198} 169}
199 170
200asmlinkage long 171SYSCALL_DEFINE5(rt_sigaction, int, sig,
201sys_rt_sigaction(int sig, 172 const struct sigaction __user *, act,
202 const struct sigaction __user *act, 173 struct sigaction __user *, oact,
203 struct sigaction __user *oact, 174 void __user *, restorer,
204 void __user *restorer, 175 size_t, sigsetsize)
205 size_t sigsetsize)
206{ 176{
207 struct k_sigaction new_ka, old_ka; 177 struct k_sigaction new_ka, old_ka;
208 int ret; 178 int ret;
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index e0fed7711a94..22a1098961f5 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -25,16 +25,10 @@ sys_nis_syscall:
25sys_memory_ordering: 25sys_memory_ordering:
26 ba,pt %xcc, sparc_memory_ordering 26 ba,pt %xcc, sparc_memory_ordering
27 add %sp, PTREGS_OFF, %o1 27 add %sp, PTREGS_OFF, %o1
28sys_sigaltstack:
29 ba,pt %xcc, do_sigaltstack
30 add %i6, STACK_BIAS, %o2
31#ifdef CONFIG_COMPAT 28#ifdef CONFIG_COMPAT
32sys32_sigstack: 29sys32_sigstack:
33 ba,pt %xcc, do_sys32_sigstack 30 ba,pt %xcc, do_sys32_sigstack
34 mov %i6, %o2 31 mov %i6, %o2
35sys32_sigaltstack:
36 ba,pt %xcc, do_sys32_sigaltstack
37 mov %i6, %o2
38#endif 32#endif
39 .align 32 33 .align 32
40#ifdef CONFIG_COMPAT 34#ifdef CONFIG_COMPAT
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index 118759cd7342..26e6dd72e92a 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -3,8 +3,8 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/signal.h>
6#include <asm/utrap.h> 7#include <asm/utrap.h>
7#include <asm/signal.h>
8 8
9extern asmlinkage unsigned long sys_getpagesize(void); 9extern asmlinkage unsigned long sys_getpagesize(void);
10extern asmlinkage long sparc_pipe(struct pt_regs *regs); 10extern asmlinkage long sparc_pipe(struct pt_regs *regs);
@@ -36,8 +36,6 @@ extern asmlinkage long sys_rt_sigaction(int sig,
36 36
37extern asmlinkage void sparc64_set_context(struct pt_regs *regs); 37extern asmlinkage void sparc64_set_context(struct pt_regs *regs);
38extern asmlinkage void sparc64_get_context(struct pt_regs *regs); 38extern asmlinkage void sparc64_get_context(struct pt_regs *regs);
39extern asmlinkage long sys_sigpause(unsigned int set);
40extern asmlinkage long sys_sigsuspend(old_sigset_t set);
41extern void do_rt_sigreturn(struct pt_regs *regs); 39extern void do_rt_sigreturn(struct pt_regs *regs);
42 40
43#endif /* _SYSTBLS_H */ 41#endif /* _SYSTBLS_H */
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 6ac43c36bbbf..7b87171ecf1e 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -55,7 +55,7 @@ sys_call_table:
55/*180*/ .long sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_sigpending, sys_ni_syscall 55/*180*/ .long sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_sigpending, sys_ni_syscall
56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname 56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl 57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl
58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask 58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_sparc_sigaction, sys_sgetmask
59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir 59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir
60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 1009ecb92678..260ddcd412bf 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -18,63 +18,63 @@
18 18
19 .globl sys_call_table32 19 .globl sys_call_table32
20sys_call_table32: 20sys_call_table32:
21/*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write 21/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
22/*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link 22/*5*/ .word compat_sys_open, sys_close, compat_sys_wait4, sys_creat, sys_link
23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod 23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys32_lseek 24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys_lseek
25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause 26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, compat_sys_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
28 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile 28 .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile
29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid 29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid
30 .word sys32_umount, sys_setgid16, sys_getgid16, sys32_signal, sys_geteuid16 30 .word sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16
31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl 31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
32 .word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve 32 .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
33/*60*/ .word sys32_umask, sys_chroot, compat_sys_newfstat, compat_sys_fstat64, sys_getpagesize 33/*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, compat_sys_fstat64, sys_getpagesize
34 .word sys32_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid 34 .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
35/*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect 35/*70*/ .word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
36 .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys_getgroups16 36 .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys_getgroups16
37/*80*/ .word sys_setgroups16, sys_getpgrp, sys32_setgroups, sys32_setitimer, sys32_ftruncate64 37/*80*/ .word sys_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64
38 .word sys32_swapon, sys32_getitimer, sys_setuid, sys32_sethostname, sys_setgid 38 .word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
39/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid 39/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid
40 .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall 40 .word sys_fsync, sys_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
41/*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending 41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending
42 .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid 42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid
43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall 43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
44 .word sys32_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd 44 .word sys_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod 45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod
46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys32_truncate 46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate
47/*130*/ .word sys32_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall 47/*130*/ .word sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall
48 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 48 .word sys_nis_syscall, sys_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64
49/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit 49/*140*/ .word sys_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
50 .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write 50 .word compat_sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
51/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64 51/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
52 .word compat_sys_fcntl64, sys_inotify_rm_watch, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount 52 .word compat_sys_fcntl64, sys_inotify_rm_watch, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
53/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall 53/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
54 .word sys_quotactl, sys_set_tid_address, compat_sys_mount, compat_sys_ustat, sys32_setxattr 54 .word sys_quotactl, sys_set_tid_address, compat_sys_mount, compat_sys_ustat, sys_setxattr
55/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents 55/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
56 .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr 56 .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
57/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall 57/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
58 .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sys_newuname 58 .word sys_setpgid, sys_fremovexattr, sys_tkill, sparc_exit_group, sys_newuname
59/*190*/ .word sys32_init_module, sys_sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl 59/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
60 .word sys32_epoll_wait, sys32_ioprio_set, sys_getppid, sys32_sigaction, sys_sgetmask 60 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, compat_sys_sparc_sigaction, sys_sgetmask
61/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 61/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
62 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64 62 .word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64
63/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, compat_sys_sysinfo 63/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, compat_sys_sysinfo
64 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, compat_sys_adjtimex 64 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys_ioprio_get, compat_sys_adjtimex
65/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid 65/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
66 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys_setfsuid16, sys_setfsgid16 66 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid16, sys_setfsgid16
67/*230*/ .word sys32_select, compat_sys_time, sys32_splice, compat_sys_stime, compat_sys_statfs64 67/*230*/ .word sys32_select, compat_sys_time, sys_splice, compat_sys_stime, compat_sys_statfs64
68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall 68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler 69/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep 70 .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, compat_sys_sched_rr_get_interval, compat_sys_nanosleep
71/*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys_nis_syscall 71/*250*/ .word sys_mremap, compat_sys_sysctl, sys_getsid, sys_fdatasync, sys_nis_syscall
72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
75/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 75/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
76 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 76 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
77/*280*/ .word sys32_tee, sys_add_key, sys_request_key, compat_sys_keyctl, compat_sys_openat 77/*280*/ .word sys_tee, sys_add_key, sys_request_key, compat_sys_keyctl, compat_sys_openat
78 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64 78 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
79/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 79/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index 88f3c227afd9..001d418a8957 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -272,17 +272,9 @@ extern int compat_setup_rt_frame(int sig, struct k_sigaction *ka,
272 struct pt_regs *regs); 272 struct pt_regs *regs);
273 273
274/* Compat syscalls. */ 274/* Compat syscalls. */
275struct compat_sigaction;
276struct compat_siginfo; 275struct compat_siginfo;
277struct compat_sigaltstack; 276struct compat_sigaltstack;
278long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act,
279 struct compat_sigaction __user *oact,
280 size_t sigsetsize);
281long compat_sys_rt_sigqueueinfo(int pid, int sig,
282 struct compat_siginfo __user *uinfo);
283long compat_sys_rt_sigreturn(void); 277long compat_sys_rt_sigreturn(void);
284long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
285 struct compat_sigaltstack __user *uoss_ptr);
286long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); 278long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high);
287long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); 279long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high);
288long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, 280long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count,
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h
index 4c8462a62cb6..78886e2417a6 100644
--- a/arch/tile/include/asm/syscalls.h
+++ b/arch/tile/include/asm/syscalls.h
@@ -64,9 +64,7 @@ long sys_ftruncate64(unsigned int fd, loff_t length);
64 64
65/* Provide versions of standard syscalls that use current_pt_regs(). */ 65/* Provide versions of standard syscalls that use current_pt_regs(). */
66long sys_rt_sigreturn(void); 66long sys_rt_sigreturn(void);
67long sys_sigaltstack(const stack_t __user *, stack_t __user *);
68#define sys_rt_sigreturn sys_rt_sigreturn 67#define sys_rt_sigreturn sys_rt_sigreturn
69#define sys_sigaltstack sys_sigaltstack
70 68
71/* These are the intvec*.S trampolines. */ 69/* These are the intvec*.S trampolines. */
72long _sys_rt_sigreturn(void); 70long _sys_rt_sigreturn(void);
diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h
index 6ac21034f69a..940831fe9e94 100644
--- a/arch/tile/include/asm/unistd.h
+++ b/arch/tile/include/asm/unistd.h
@@ -14,7 +14,6 @@
14/* In compat mode, we use sys_llseek() for compat_sys_llseek(). */ 14/* In compat mode, we use sys_llseek() for compat_sys_llseek(). */
15#ifdef CONFIG_COMPAT 15#ifdef CONFIG_COMPAT
16#define __ARCH_WANT_SYS_LLSEEK 16#define __ARCH_WANT_SYS_LLSEEK
17#define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL
18#endif 17#endif
19#define __ARCH_WANT_SYS_NEWFSTATAT 18#define __ARCH_WANT_SYS_NEWFSTATAT
20#define __ARCH_WANT_SYS_CLONE 19#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 2e4cc69224a6..d0a052e725be 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -34,19 +34,6 @@
34#include <asm/syscalls.h> 34#include <asm/syscalls.h>
35#include <arch/interrupts.h> 35#include <arch/interrupts.h>
36 36
37struct compat_sigaction {
38 compat_uptr_t sa_handler;
39 compat_ulong_t sa_flags;
40 compat_uptr_t sa_restorer;
41 sigset_t sa_mask __packed;
42};
43
44struct compat_sigaltstack {
45 compat_uptr_t ss_sp;
46 int ss_flags;
47 compat_size_t ss_size;
48};
49
50struct compat_ucontext { 37struct compat_ucontext {
51 compat_ulong_t uc_flags; 38 compat_ulong_t uc_flags;
52 compat_uptr_t uc_link; 39 compat_uptr_t uc_link;
@@ -61,63 +48,6 @@ struct compat_rt_sigframe {
61 struct compat_ucontext uc; 48 struct compat_ucontext uc;
62}; 49};
63 50
64long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act,
65 struct compat_sigaction __user *oact,
66 size_t sigsetsize)
67{
68 struct k_sigaction new_sa, old_sa;
69 int ret = -EINVAL;
70
71 /* XXX: Don't preclude handling different sized sigset_t's. */
72 if (sigsetsize != sizeof(sigset_t))
73 goto out;
74
75 if (act) {
76 compat_uptr_t handler, restorer;
77
78 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
79 __get_user(handler, &act->sa_handler) ||
80 __get_user(new_sa.sa.sa_flags, &act->sa_flags) ||
81 __get_user(restorer, &act->sa_restorer) ||
82 __copy_from_user(&new_sa.sa.sa_mask, &act->sa_mask,
83 sizeof(sigset_t)))
84 return -EFAULT;
85 new_sa.sa.sa_handler = compat_ptr(handler);
86 new_sa.sa.sa_restorer = compat_ptr(restorer);
87 }
88
89 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
90
91 if (!ret && oact) {
92 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
93 __put_user(ptr_to_compat(old_sa.sa.sa_handler),
94 &oact->sa_handler) ||
95 __put_user(ptr_to_compat(old_sa.sa.sa_restorer),
96 &oact->sa_restorer) ||
97 __put_user(old_sa.sa.sa_flags, &oact->sa_flags) ||
98 __copy_to_user(&oact->sa_mask, &old_sa.sa.sa_mask,
99 sizeof(sigset_t)))
100 return -EFAULT;
101 }
102out:
103 return ret;
104}
105
106long compat_sys_rt_sigqueueinfo(int pid, int sig,
107 struct compat_siginfo __user *uinfo)
108{
109 siginfo_t info;
110 int ret;
111 mm_segment_t old_fs = get_fs();
112
113 if (copy_siginfo_from_user32(&info, uinfo))
114 return -EFAULT;
115 set_fs(KERNEL_DS);
116 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __force __user *)&info);
117 set_fs(old_fs);
118 return ret;
119}
120
121int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) 51int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from)
122{ 52{
123 int err; 53 int err;
@@ -196,40 +126,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
196 return err; 126 return err;
197} 127}
198 128
199long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr,
200 struct compat_sigaltstack __user *uoss_ptr)
201{
202 stack_t uss, uoss;
203 int ret;
204 mm_segment_t seg;
205
206 if (uss_ptr) {
207 u32 ptr;
208
209 memset(&uss, 0, sizeof(stack_t));
210 if (!access_ok(VERIFY_READ, uss_ptr, sizeof(*uss_ptr)) ||
211 __get_user(ptr, &uss_ptr->ss_sp) ||
212 __get_user(uss.ss_flags, &uss_ptr->ss_flags) ||
213 __get_user(uss.ss_size, &uss_ptr->ss_size))
214 return -EFAULT;
215 uss.ss_sp = compat_ptr(ptr);
216 }
217 seg = get_fs();
218 set_fs(KERNEL_DS);
219 ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL,
220 (stack_t __user __force *)&uoss,
221 (unsigned long)compat_ptr(current_pt_regs()->sp));
222 set_fs(seg);
223 if (ret >= 0 && uoss_ptr) {
224 if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(*uoss_ptr)) ||
225 __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) ||
226 __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) ||
227 __put_user(uoss.ss_size, &uoss_ptr->ss_size))
228 ret = -EFAULT;
229 }
230 return ret;
231}
232
233/* The assembly shim for this function arranges to ignore the return value. */ 129/* The assembly shim for this function arranges to ignore the return value. */
234long compat_sys_rt_sigreturn(void) 130long compat_sys_rt_sigreturn(void)
235{ 131{
@@ -248,7 +144,7 @@ long compat_sys_rt_sigreturn(void)
248 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 144 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
249 goto badframe; 145 goto badframe;
250 146
251 if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL) == -EFAULT) 147 if (compat_restore_altstack(&frame->uc.uc_stack))
252 goto badframe; 148 goto badframe;
253 149
254 return 0; 150 return 0;
@@ -325,11 +221,7 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
325 err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); 221 err |= __clear_user(&frame->save_area, sizeof(frame->save_area));
326 err |= __put_user(0, &frame->uc.uc_flags); 222 err |= __put_user(0, &frame->uc.uc_flags);
327 err |= __put_user(0, &frame->uc.uc_link); 223 err |= __put_user(0, &frame->uc.uc_link);
328 err |= __put_user(ptr_to_compat((void *)(current->sas_ss_sp)), 224 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp);
329 &frame->uc.uc_stack.ss_sp);
330 err |= __put_user(sas_ss_flags(regs->sp),
331 &frame->uc.uc_stack.ss_flags);
332 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
333 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); 225 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs);
334 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 226 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
335 if (err) 227 if (err)
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c
index 657a7ace4ab4..9531845bf661 100644
--- a/arch/tile/kernel/signal.c
+++ b/arch/tile/kernel/signal.c
@@ -37,13 +37,6 @@
37 37
38#define DEBUG_SIG 0 38#define DEBUG_SIG 0
39 39
40SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
41 stack_t __user *, uoss)
42{
43 return do_sigaltstack(uss, uoss, current_pt_regs()->sp);
44}
45
46
47/* 40/*
48 * Do a signal return; undo the signal stack. 41 * Do a signal return; undo the signal stack.
49 */ 42 */
@@ -100,7 +93,7 @@ SYSCALL_DEFINE0(rt_sigreturn)
100 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 93 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
101 goto badframe; 94 goto badframe;
102 95
103 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT) 96 if (restore_altstack(&frame->uc.uc_stack))
104 goto badframe; 97 goto badframe;
105 98
106 return 0; 99 return 0;
@@ -191,11 +184,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
191 err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); 184 err |= __clear_user(&frame->save_area, sizeof(frame->save_area));
192 err |= __put_user(0, &frame->uc.uc_flags); 185 err |= __put_user(0, &frame->uc.uc_flags);
193 err |= __put_user(NULL, &frame->uc.uc_link); 186 err |= __put_user(NULL, &frame->uc.uc_link);
194 err |= __put_user((void __user *)(current->sas_ss_sp), 187 err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
195 &frame->uc.uc_stack.ss_sp);
196 err |= __put_user(sas_ss_flags(regs->sp),
197 &frame->uc.uc_stack.ss_flags);
198 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
199 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); 188 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs);
200 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 189 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
201 if (err) 190 if (err)
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index 48ccf718e290..3e831b3fd07b 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -122,13 +122,3 @@ int do_signal(void)
122{ 122{
123 return kern_do_signal(&current->thread.regs); 123 return kern_do_signal(&current->thread.regs);
124} 124}
125
126/*
127 * Atomically swap in the new signal mask, and wait for a signal.
128 */
129long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
130{
131 sigset_t blocked;
132 siginitset(&blocked, mask);
133 return sigsuspend(&blocked);
134}
diff --git a/arch/unicore32/kernel/entry.S b/arch/unicore32/kernel/entry.S
index 581630d91444..bcdedd80890e 100644
--- a/arch/unicore32/kernel/entry.S
+++ b/arch/unicore32/kernel/entry.S
@@ -674,11 +674,6 @@ ENTRY(sys_rt_sigreturn)
674 b __sys_rt_sigreturn 674 b __sys_rt_sigreturn
675ENDPROC(sys_rt_sigreturn) 675ENDPROC(sys_rt_sigreturn)
676 676
677ENTRY(sys_sigaltstack)
678 ldw r2, [sp+], #S_OFF + S_SP
679 b do_sigaltstack
680ENDPROC(sys_sigaltstack)
681
682 __INIT 677 __INIT
683 678
684/* 679/*
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c
index b8b2ffd774d6..6905f0ebdc77 100644
--- a/arch/unicore32/kernel/signal.c
+++ b/arch/unicore32/kernel/signal.c
@@ -123,8 +123,7 @@ asmlinkage int __sys_rt_sigreturn(struct pt_regs *regs)
123 if (restore_sigframe(regs, &frame->sig)) 123 if (restore_sigframe(regs, &frame->sig))
124 goto badframe; 124 goto badframe;
125 125
126 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->UCreg_sp) 126 if (restore_altstack(&frame->sig.uc.uc_stack))
127 == -EFAULT)
128 goto badframe; 127 goto badframe;
129 128
130 return regs->UCreg_00; 129 return regs->UCreg_00;
@@ -265,7 +264,6 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
265{ 264{
266 struct rt_sigframe __user *frame = 265 struct rt_sigframe __user *frame =
267 get_sigframe(ka, regs, sizeof(*frame)); 266 get_sigframe(ka, regs, sizeof(*frame));
268 stack_t stack;
269 int err = 0; 267 int err = 0;
270 268
271 if (!frame) 269 if (!frame)
@@ -275,13 +273,7 @@ static int setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
275 273
276 err |= __put_user(0, &frame->sig.uc.uc_flags); 274 err |= __put_user(0, &frame->sig.uc.uc_flags);
277 err |= __put_user(NULL, &frame->sig.uc.uc_link); 275 err |= __put_user(NULL, &frame->sig.uc.uc_link);
278 276 err |= __save_altstack(&frame->sig.uc.uc_stack, regs->UCreg_sp);
279 memset(&stack, 0, sizeof(stack));
280 stack.ss_sp = (void __user *)current->sas_ss_sp;
281 stack.ss_flags = sas_ss_flags(regs->UCreg_sp);
282 stack.ss_size = current->sas_ss_size;
283 err |= __copy_to_user(&frame->sig.uc.uc_stack, &stack, sizeof(stack));
284
285 err |= setup_sigframe(&frame->sig, regs, set); 277 err |= setup_sigframe(&frame->sig, regs, set);
286 if (err == 0) 278 if (err == 0)
287 err |= setup_return(regs, ka, frame->sig.retcode, frame, usig); 279 err |= setup_return(regs, ka, frame->sig.retcode, frame, usig);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 4ebc7a6e6724..6a9383370311 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -115,8 +115,10 @@ config X86
115 select MODULES_USE_ELF_REL if X86_32 115 select MODULES_USE_ELF_REL if X86_32
116 select MODULES_USE_ELF_RELA if X86_64 116 select MODULES_USE_ELF_RELA if X86_64
117 select CLONE_BACKWARDS if X86_32 117 select CLONE_BACKWARDS if X86_32
118 select GENERIC_SIGALTSTACK
119 select ARCH_USE_BUILTIN_BSWAP 118 select ARCH_USE_BUILTIN_BSWAP
119 select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION
120 select OLD_SIGACTION if X86_32
121 select COMPAT_OLD_SIGACTION if IA32_EMULATION
120 122
121config INSTRUCTION_DECODER 123config INSTRUCTION_DECODER
122 def_bool y 124 def_bool y
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index a1daf4a65009..cf1a471a18a2 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -129,13 +129,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
129 return err; 129 return err;
130} 130}
131 131
132asmlinkage long sys32_sigsuspend(int history0, int history1, old_sigset_t mask)
133{
134 sigset_t blocked;
135 siginitset(&blocked, mask);
136 return sigsuspend(&blocked);
137}
138
139/* 132/*
140 * Do a signal return; undo the signal stack. 133 * Do a signal return; undo the signal stack.
141 */ 134 */
@@ -215,8 +208,9 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
215 return err; 208 return err;
216} 209}
217 210
218asmlinkage long sys32_sigreturn(struct pt_regs *regs) 211asmlinkage long sys32_sigreturn(void)
219{ 212{
213 struct pt_regs *regs = current_pt_regs();
220 struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(regs->sp-8); 214 struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(regs->sp-8);
221 sigset_t set; 215 sigset_t set;
222 unsigned int ax; 216 unsigned int ax;
@@ -241,8 +235,9 @@ badframe:
241 return 0; 235 return 0;
242} 236}
243 237
244asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) 238asmlinkage long sys32_rt_sigreturn(void)
245{ 239{
240 struct pt_regs *regs = current_pt_regs();
246 struct rt_sigframe_ia32 __user *frame; 241 struct rt_sigframe_ia32 __user *frame;
247 sigset_t set; 242 sigset_t set;
248 unsigned int ax; 243 unsigned int ax;
@@ -314,7 +309,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
314/* 309/*
315 * Determine which stack to use.. 310 * Determine which stack to use..
316 */ 311 */
317static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 312static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
318 size_t frame_size, 313 size_t frame_size,
319 void __user **fpstate) 314 void __user **fpstate)
320{ 315{
@@ -324,16 +319,13 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
324 sp = regs->sp; 319 sp = regs->sp;
325 320
326 /* This is the X/Open sanctioned signal stack switching. */ 321 /* This is the X/Open sanctioned signal stack switching. */
327 if (ka->sa.sa_flags & SA_ONSTACK) { 322 if (ksig->ka.sa.sa_flags & SA_ONSTACK)
328 if (sas_ss_flags(sp) == 0) 323 sp = sigsp(sp, ksig);
329 sp = current->sas_ss_sp + current->sas_ss_size;
330 }
331
332 /* This is the legacy signal stack switching. */ 324 /* This is the legacy signal stack switching. */
333 else if ((regs->ss & 0xffff) != __USER32_DS && 325 else if ((regs->ss & 0xffff) != __USER32_DS &&
334 !(ka->sa.sa_flags & SA_RESTORER) && 326 !(ksig->ka.sa.sa_flags & SA_RESTORER) &&
335 ka->sa.sa_restorer) 327 ksig->ka.sa.sa_restorer)
336 sp = (unsigned long) ka->sa.sa_restorer; 328 sp = (unsigned long) ksig->ka.sa.sa_restorer;
337 329
338 if (used_math()) { 330 if (used_math()) {
339 unsigned long fx_aligned, math_size; 331 unsigned long fx_aligned, math_size;
@@ -352,7 +344,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
352 return (void __user *) sp; 344 return (void __user *) sp;
353} 345}
354 346
355int ia32_setup_frame(int sig, struct k_sigaction *ka, 347int ia32_setup_frame(int sig, struct ksignal *ksig,
356 compat_sigset_t *set, struct pt_regs *regs) 348 compat_sigset_t *set, struct pt_regs *regs)
357{ 349{
358 struct sigframe_ia32 __user *frame; 350 struct sigframe_ia32 __user *frame;
@@ -371,7 +363,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
371 0x80cd, /* int $0x80 */ 363 0x80cd, /* int $0x80 */
372 }; 364 };
373 365
374 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 366 frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
375 367
376 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 368 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
377 return -EFAULT; 369 return -EFAULT;
@@ -388,8 +380,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
388 return -EFAULT; 380 return -EFAULT;
389 } 381 }
390 382
391 if (ka->sa.sa_flags & SA_RESTORER) { 383 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
392 restorer = ka->sa.sa_restorer; 384 restorer = ksig->ka.sa.sa_restorer;
393 } else { 385 } else {
394 /* Return stub is in 32bit vsyscall page */ 386 /* Return stub is in 32bit vsyscall page */
395 if (current->mm->context.vdso) 387 if (current->mm->context.vdso)
@@ -414,7 +406,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
414 406
415 /* Set up registers for signal handler */ 407 /* Set up registers for signal handler */
416 regs->sp = (unsigned long) frame; 408 regs->sp = (unsigned long) frame;
417 regs->ip = (unsigned long) ka->sa.sa_handler; 409 regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
418 410
419 /* Make -mregparm=3 work */ 411 /* Make -mregparm=3 work */
420 regs->ax = sig; 412 regs->ax = sig;
@@ -430,7 +422,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
430 return 0; 422 return 0;
431} 423}
432 424
433int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 425int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
434 compat_sigset_t *set, struct pt_regs *regs) 426 compat_sigset_t *set, struct pt_regs *regs)
435{ 427{
436 struct rt_sigframe_ia32 __user *frame; 428 struct rt_sigframe_ia32 __user *frame;
@@ -451,7 +443,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
451 0, 443 0,
452 }; 444 };
453 445
454 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 446 frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
455 447
456 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 448 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
457 return -EFAULT; 449 return -EFAULT;
@@ -469,8 +461,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
469 put_user_ex(0, &frame->uc.uc_link); 461 put_user_ex(0, &frame->uc.uc_link);
470 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); 462 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp);
471 463
472 if (ka->sa.sa_flags & SA_RESTORER) 464 if (ksig->ka.sa.sa_flags & SA_RESTORER)
473 restorer = ka->sa.sa_restorer; 465 restorer = ksig->ka.sa.sa_restorer;
474 else 466 else
475 restorer = VDSO32_SYMBOL(current->mm->context.vdso, 467 restorer = VDSO32_SYMBOL(current->mm->context.vdso,
476 rt_sigreturn); 468 rt_sigreturn);
@@ -483,7 +475,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
483 put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode); 475 put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
484 } put_user_catch(err); 476 } put_user_catch(err);
485 477
486 err |= copy_siginfo_to_user32(&frame->info, info); 478 err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
487 err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, 479 err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
488 regs, set->sig[0]); 480 regs, set->sig[0]);
489 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 481 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
@@ -493,7 +485,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
493 485
494 /* Set up registers for signal handler */ 486 /* Set up registers for signal handler */
495 regs->sp = (unsigned long) frame; 487 regs->sp = (unsigned long) frame;
496 regs->ip = (unsigned long) ka->sa.sa_handler; 488 regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
497 489
498 /* Make -mregparm=3 work */ 490 /* Make -mregparm=3 work */
499 regs->ax = sig; 491 regs->ax = sig;
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 142c4ceff112..474dc1b59f72 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -456,18 +456,16 @@ ia32_badsys:
456 ALIGN 456 ALIGN
457GLOBAL(\label) 457GLOBAL(\label)
458 leaq \func(%rip),%rax 458 leaq \func(%rip),%rax
459 leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
460 jmp ia32_ptregs_common 459 jmp ia32_ptregs_common
461 .endm 460 .endm
462 461
463 CFI_STARTPROC32 462 CFI_STARTPROC32
464 463
465 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi 464 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn
466 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi 465 PTREGSCALL stub32_sigreturn, sys32_sigreturn
467 PTREGSCALL stub32_execve, compat_sys_execve, %rcx 466 PTREGSCALL stub32_execve, compat_sys_execve
468 PTREGSCALL stub32_fork, sys_fork, %rdi 467 PTREGSCALL stub32_fork, sys_fork
469 PTREGSCALL stub32_vfork, sys_vfork, %rdi 468 PTREGSCALL stub32_vfork, sys_vfork
470 PTREGSCALL stub32_iopl, sys_iopl, %rsi
471 469
472 ALIGN 470 ALIGN
473GLOBAL(stub32_clone) 471GLOBAL(stub32_clone)
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index d0b689ba7be2..592f5a9a9c0e 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -172,183 +172,12 @@ asmlinkage long sys32_mprotect(unsigned long start, size_t len,
172 return sys_mprotect(start, len, prot); 172 return sys_mprotect(start, len, prot);
173} 173}
174 174
175asmlinkage long sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
176 struct sigaction32 __user *oact,
177 unsigned int sigsetsize)
178{
179 struct k_sigaction new_ka, old_ka;
180 int ret;
181 compat_sigset_t set32;
182
183 /* XXX: Don't preclude handling different sized sigset_t's. */
184 if (sigsetsize != sizeof(compat_sigset_t))
185 return -EINVAL;
186
187 if (act) {
188 compat_uptr_t handler, restorer;
189
190 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
191 __get_user(handler, &act->sa_handler) ||
192 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
193 __get_user(restorer, &act->sa_restorer) ||
194 __copy_from_user(&set32, &act->sa_mask,
195 sizeof(compat_sigset_t)))
196 return -EFAULT;
197 new_ka.sa.sa_handler = compat_ptr(handler);
198 new_ka.sa.sa_restorer = compat_ptr(restorer);
199
200 /*
201 * FIXME: here we rely on _COMPAT_NSIG_WORS to be >=
202 * than _NSIG_WORDS << 1
203 */
204 switch (_NSIG_WORDS) {
205 case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6]
206 | (((long)set32.sig[7]) << 32);
207 case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4]
208 | (((long)set32.sig[5]) << 32);
209 case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2]
210 | (((long)set32.sig[3]) << 32);
211 case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0]
212 | (((long)set32.sig[1]) << 32);
213 }
214 }
215
216 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
217
218 if (!ret && oact) {
219 /*
220 * FIXME: here we rely on _COMPAT_NSIG_WORS to be >=
221 * than _NSIG_WORDS << 1
222 */
223 switch (_NSIG_WORDS) {
224 case 4:
225 set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32);
226 set32.sig[6] = old_ka.sa.sa_mask.sig[3];
227 case 3:
228 set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32);
229 set32.sig[4] = old_ka.sa.sa_mask.sig[2];
230 case 2:
231 set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32);
232 set32.sig[2] = old_ka.sa.sa_mask.sig[1];
233 case 1:
234 set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32);
235 set32.sig[0] = old_ka.sa.sa_mask.sig[0];
236 }
237 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
238 __put_user(ptr_to_compat(old_ka.sa.sa_handler),
239 &oact->sa_handler) ||
240 __put_user(ptr_to_compat(old_ka.sa.sa_restorer),
241 &oact->sa_restorer) ||
242 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
243 __copy_to_user(&oact->sa_mask, &set32,
244 sizeof(compat_sigset_t)))
245 return -EFAULT;
246 }
247
248 return ret;
249}
250
251asmlinkage long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
252 struct old_sigaction32 __user *oact)
253{
254 struct k_sigaction new_ka, old_ka;
255 int ret;
256
257 if (act) {
258 compat_old_sigset_t mask;
259 compat_uptr_t handler, restorer;
260
261 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
262 __get_user(handler, &act->sa_handler) ||
263 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
264 __get_user(restorer, &act->sa_restorer) ||
265 __get_user(mask, &act->sa_mask))
266 return -EFAULT;
267
268 new_ka.sa.sa_handler = compat_ptr(handler);
269 new_ka.sa.sa_restorer = compat_ptr(restorer);
270
271 siginitset(&new_ka.sa.sa_mask, mask);
272 }
273
274 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
275
276 if (!ret && oact) {
277 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
278 __put_user(ptr_to_compat(old_ka.sa.sa_handler),
279 &oact->sa_handler) ||
280 __put_user(ptr_to_compat(old_ka.sa.sa_restorer),
281 &oact->sa_restorer) ||
282 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
283 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
284 return -EFAULT;
285 }
286
287 return ret;
288}
289
290asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr, 175asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr,
291 int options) 176 int options)
292{ 177{
293 return compat_sys_wait4(pid, stat_addr, options, NULL); 178 return compat_sys_wait4(pid, stat_addr, options, NULL);
294} 179}
295 180
296/* 32-bit timeval and related flotsam. */
297
298asmlinkage long sys32_sched_rr_get_interval(compat_pid_t pid,
299 struct compat_timespec __user *interval)
300{
301 struct timespec t;
302 int ret;
303 mm_segment_t old_fs = get_fs();
304
305 set_fs(KERNEL_DS);
306 ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
307 set_fs(old_fs);
308 if (put_compat_timespec(&t, interval))
309 return -EFAULT;
310 return ret;
311}
312
313asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
314 compat_size_t sigsetsize)
315{
316 sigset_t s;
317 compat_sigset_t s32;
318 int ret;
319 mm_segment_t old_fs = get_fs();
320
321 set_fs(KERNEL_DS);
322 ret = sys_rt_sigpending((sigset_t __user *)&s, sigsetsize);
323 set_fs(old_fs);
324 if (!ret) {
325 switch (_NSIG_WORDS) {
326 case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
327 case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
328 case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
329 case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
330 }
331 if (copy_to_user(set, &s32, sizeof(compat_sigset_t)))
332 return -EFAULT;
333 }
334 return ret;
335}
336
337asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig,
338 compat_siginfo_t __user *uinfo)
339{
340 siginfo_t info;
341 int ret;
342 mm_segment_t old_fs = get_fs();
343
344 if (copy_siginfo_from_user32(&info, uinfo))
345 return -EFAULT;
346 set_fs(KERNEL_DS);
347 ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info);
348 set_fs(old_fs);
349 return ret;
350}
351
352/* warning: next two assume little endian */ 181/* warning: next two assume little endian */
353asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count, 182asmlinkage long sys32_pread(unsigned int fd, char __user *ubuf, u32 count,
354 u32 poslo, u32 poshi) 183 u32 poslo, u32 poshi)
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 41ab26ea6564..e25cc33ec54d 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -26,9 +26,10 @@
26#ifdef CONFIG_X86_64 26#ifdef CONFIG_X86_64
27# include <asm/sigcontext32.h> 27# include <asm/sigcontext32.h>
28# include <asm/user32.h> 28# include <asm/user32.h>
29int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 29struct ksignal;
30int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
30 compat_sigset_t *set, struct pt_regs *regs); 31 compat_sigset_t *set, struct pt_regs *regs);
31int ia32_setup_frame(int sig, struct k_sigaction *ka, 32int ia32_setup_frame(int sig, struct ksignal *ksig,
32 compat_sigset_t *set, struct pt_regs *regs); 33 compat_sigset_t *set, struct pt_regs *regs);
33#else 34#else
34# define user_i387_ia32_struct user_i387_struct 35# define user_i387_ia32_struct user_i387_struct
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index 4c6da2e4bb1d..d0e8e0141041 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -13,21 +13,6 @@
13#include <asm/sigcontext32.h> 13#include <asm/sigcontext32.h>
14 14
15/* signal.h */ 15/* signal.h */
16struct sigaction32 {
17 unsigned int sa_handler; /* Really a pointer, but need to deal
18 with 32 bits */
19 unsigned int sa_flags;
20 unsigned int sa_restorer; /* Another 32 bit pointer */
21 compat_sigset_t sa_mask; /* A 32 bit mask */
22};
23
24struct old_sigaction32 {
25 unsigned int sa_handler; /* Really a pointer, but need to deal
26 with 32 bits */
27 compat_old_sigset_t sa_mask; /* A 32 bit mask */
28 unsigned int sa_flags;
29 unsigned int sa_restorer; /* Another 32 bit pointer */
30};
31 16
32struct ucontext_ia32 { 17struct ucontext_ia32 {
33 unsigned int uc_flags; 18 unsigned int uc_flags;
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 216bf364a7e7..35e67a457182 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -31,27 +31,9 @@ typedef sigset_t compat_sigset_t;
31#include <uapi/asm/signal.h> 31#include <uapi/asm/signal.h>
32#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
33extern void do_notify_resume(struct pt_regs *, void *, __u32); 33extern void do_notify_resume(struct pt_regs *, void *, __u32);
34#ifdef __i386__
35struct old_sigaction {
36 __sighandler_t sa_handler;
37 old_sigset_t sa_mask;
38 unsigned long sa_flags;
39 __sigrestore_t sa_restorer;
40};
41
42struct sigaction {
43 __sighandler_t sa_handler;
44 unsigned long sa_flags;
45 __sigrestore_t sa_restorer;
46 sigset_t sa_mask; /* mask last for extensibility */
47};
48
49struct k_sigaction {
50 struct sigaction sa;
51};
52 34
53#else /* __i386__ */ 35#define __ARCH_HAS_SA_RESTORER
54#endif /* !__i386__ */ 36
55#include <asm/sigcontext.h> 37#include <asm/sigcontext.h>
56 38
57#ifdef __i386__ 39#ifdef __i386__
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 31f61f96e0fb..0218d917f509 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -32,22 +32,11 @@ struct mmap_arg_struct32;
32asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); 32asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *);
33asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long); 33asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long);
34 34
35struct sigaction32;
36struct old_sigaction32;
37asmlinkage long sys32_rt_sigaction(int, struct sigaction32 __user *,
38 struct sigaction32 __user *, unsigned int);
39asmlinkage long sys32_sigaction(int, struct old_sigaction32 __user *,
40 struct old_sigaction32 __user *);
41asmlinkage long sys32_alarm(unsigned int); 35asmlinkage long sys32_alarm(unsigned int);
42 36
43asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int); 37asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int);
44asmlinkage long sys32_sysfs(int, u32, u32); 38asmlinkage long sys32_sysfs(int, u32, u32);
45 39
46asmlinkage long sys32_sched_rr_get_interval(compat_pid_t,
47 struct compat_timespec __user *);
48asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *, compat_size_t);
49asmlinkage long sys32_rt_sigqueueinfo(int, int, compat_siginfo_t __user *);
50
51asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); 40asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
52asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32); 41asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32);
53 42
@@ -68,9 +57,8 @@ asmlinkage long sys32_fallocate(int, int, unsigned,
68 unsigned, unsigned, unsigned); 57 unsigned, unsigned, unsigned);
69 58
70/* ia32/ia32_signal.c */ 59/* ia32/ia32_signal.c */
71asmlinkage long sys32_sigsuspend(int, int, old_sigset_t); 60asmlinkage long sys32_sigreturn(void);
72asmlinkage long sys32_sigreturn(struct pt_regs *); 61asmlinkage long sys32_rt_sigreturn(void);
73asmlinkage long sys32_rt_sigreturn(struct pt_regs *);
74 62
75/* ia32/ipc32.c */ 63/* ia32/ipc32.c */
76asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32); 64asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32);
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 58b7e3eac0ae..6cf0a9cc60cd 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -18,13 +18,13 @@
18/* Common in X86_32 and X86_64 */ 18/* Common in X86_32 and X86_64 */
19/* kernel/ioport.c */ 19/* kernel/ioport.c */
20asmlinkage long sys_ioperm(unsigned long, unsigned long, int); 20asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
21long sys_iopl(unsigned int, struct pt_regs *); 21asmlinkage long sys_iopl(unsigned int);
22 22
23/* kernel/ldt.c */ 23/* kernel/ldt.c */
24asmlinkage int sys_modify_ldt(int, void __user *, unsigned long); 24asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
25 25
26/* kernel/signal.c */ 26/* kernel/signal.c */
27long sys_rt_sigreturn(struct pt_regs *); 27long sys_rt_sigreturn(void);
28 28
29/* kernel/tls.c */ 29/* kernel/tls.c */
30asmlinkage int sys_set_thread_area(struct user_desc __user *); 30asmlinkage int sys_set_thread_area(struct user_desc __user *);
@@ -34,14 +34,11 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *);
34#ifdef CONFIG_X86_32 34#ifdef CONFIG_X86_32
35 35
36/* kernel/signal.c */ 36/* kernel/signal.c */
37asmlinkage int sys_sigsuspend(int, int, old_sigset_t); 37unsigned long sys_sigreturn(void);
38asmlinkage int sys_sigaction(int, const struct old_sigaction __user *,
39 struct old_sigaction __user *);
40unsigned long sys_sigreturn(struct pt_regs *);
41 38
42/* kernel/vm86_32.c */ 39/* kernel/vm86_32.c */
43int sys_vm86old(struct vm86_struct __user *, struct pt_regs *); 40int sys_vm86old(struct vm86_struct __user *);
44int sys_vm86(unsigned long, unsigned long, struct pt_regs *); 41int sys_vm86(unsigned long, unsigned long);
45 42
46#else /* CONFIG_X86_32 */ 43#else /* CONFIG_X86_32 */
47 44
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index a0790e07ba65..3d5df1c4447f 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -38,8 +38,6 @@
38# define __ARCH_WANT_SYS_OLD_GETRLIMIT 38# define __ARCH_WANT_SYS_OLD_GETRLIMIT
39# define __ARCH_WANT_SYS_OLD_UNAME 39# define __ARCH_WANT_SYS_OLD_UNAME
40# define __ARCH_WANT_SYS_PAUSE 40# define __ARCH_WANT_SYS_PAUSE
41# define __ARCH_WANT_SYS_RT_SIGACTION
42# define __ARCH_WANT_SYS_RT_SIGSUSPEND
43# define __ARCH_WANT_SYS_SGETMASK 41# define __ARCH_WANT_SYS_SGETMASK
44# define __ARCH_WANT_SYS_SIGNAL 42# define __ARCH_WANT_SYS_SIGNAL
45# define __ARCH_WANT_SYS_SIGPENDING 43# define __ARCH_WANT_SYS_SIGPENDING
diff --git a/arch/x86/include/uapi/asm/signal.h b/arch/x86/include/uapi/asm/signal.h
index aa7d6ae39e0e..8264f47cf53e 100644
--- a/arch/x86/include/uapi/asm/signal.h
+++ b/arch/x86/include/uapi/asm/signal.h
@@ -95,9 +95,9 @@ typedef unsigned long sigset_t;
95#ifndef __ASSEMBLY__ 95#ifndef __ASSEMBLY__
96 96
97 97
98#ifdef __i386__
99# ifndef __KERNEL__ 98# ifndef __KERNEL__
100/* Here we must cater to libcs that poke about in kernel headers. */ 99/* Here we must cater to libcs that poke about in kernel headers. */
100#ifdef __i386__
101 101
102struct sigaction { 102struct sigaction {
103 union { 103 union {
@@ -112,7 +112,6 @@ struct sigaction {
112#define sa_handler _u._sa_handler 112#define sa_handler _u._sa_handler
113#define sa_sigaction _u._sa_sigaction 113#define sa_sigaction _u._sa_sigaction
114 114
115# endif /* ! __KERNEL__ */
116#else /* __i386__ */ 115#else /* __i386__ */
117 116
118struct sigaction { 117struct sigaction {
@@ -122,11 +121,8 @@ struct sigaction {
122 sigset_t sa_mask; /* mask last for extensibility */ 121 sigset_t sa_mask; /* mask last for extensibility */
123}; 122};
124 123
125struct k_sigaction {
126 struct sigaction sa;
127};
128
129#endif /* !__i386__ */ 124#endif /* !__i386__ */
125# endif /* ! __KERNEL__ */
130 126
131typedef struct sigaltstack { 127typedef struct sigaltstack {
132 void __user *ss_sp; 128 void __user *ss_sp;
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 8831176aa5ef..8f3e2dec1df3 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -699,51 +699,6 @@ END(syscall_badsys)
699 */ 699 */
700 .popsection 700 .popsection
701 701
702/*
703 * System calls that need a pt_regs pointer.
704 */
705#define PTREGSCALL0(name) \
706ENTRY(ptregs_##name) ; \
707 leal 4(%esp),%eax; \
708 jmp sys_##name; \
709ENDPROC(ptregs_##name)
710
711#define PTREGSCALL1(name) \
712ENTRY(ptregs_##name) ; \
713 leal 4(%esp),%edx; \
714 movl (PT_EBX+4)(%esp),%eax; \
715 jmp sys_##name; \
716ENDPROC(ptregs_##name)
717
718#define PTREGSCALL2(name) \
719ENTRY(ptregs_##name) ; \
720 leal 4(%esp),%ecx; \
721 movl (PT_ECX+4)(%esp),%edx; \
722 movl (PT_EBX+4)(%esp),%eax; \
723 jmp sys_##name; \
724ENDPROC(ptregs_##name)
725
726#define PTREGSCALL3(name) \
727ENTRY(ptregs_##name) ; \
728 CFI_STARTPROC; \
729 leal 4(%esp),%eax; \
730 pushl_cfi %eax; \
731 movl PT_EDX(%eax),%ecx; \
732 movl PT_ECX(%eax),%edx; \
733 movl PT_EBX(%eax),%eax; \
734 call sys_##name; \
735 addl $4,%esp; \
736 CFI_ADJUST_CFA_OFFSET -4; \
737 ret; \
738 CFI_ENDPROC; \
739ENDPROC(ptregs_##name)
740
741PTREGSCALL1(iopl)
742PTREGSCALL0(sigreturn)
743PTREGSCALL0(rt_sigreturn)
744PTREGSCALL2(vm86)
745PTREGSCALL1(vm86old)
746
747.macro FIXUP_ESPFIX_STACK 702.macro FIXUP_ESPFIX_STACK
748/* 703/*
749 * Switch back for ESPFIX stack to the normal zerobased stack 704 * Switch back for ESPFIX stack to the normal zerobased stack
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 048f2240f8e6..c1d01e6ca790 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -828,23 +828,6 @@ int_restore_rest:
828 CFI_ENDPROC 828 CFI_ENDPROC
829END(system_call) 829END(system_call)
830 830
831/*
832 * Certain special system calls that need to save a complete full stack frame.
833 */
834 .macro PTREGSCALL label,func,arg
835ENTRY(\label)
836 PARTIAL_FRAME 1 8 /* offset 8: return address */
837 subq $REST_SKIP, %rsp
838 CFI_ADJUST_CFA_OFFSET REST_SKIP
839 call save_rest
840 DEFAULT_FRAME 0 8 /* offset 8: return address */
841 leaq 8(%rsp), \arg /* pt_regs pointer */
842 call \func
843 jmp ptregscall_common
844 CFI_ENDPROC
845END(\label)
846 .endm
847
848 .macro FORK_LIKE func 831 .macro FORK_LIKE func
849ENTRY(stub_\func) 832ENTRY(stub_\func)
850 CFI_STARTPROC 833 CFI_STARTPROC
@@ -861,10 +844,22 @@ ENTRY(stub_\func)
861END(stub_\func) 844END(stub_\func)
862 .endm 845 .endm
863 846
847 .macro FIXED_FRAME label,func
848ENTRY(\label)
849 CFI_STARTPROC
850 PARTIAL_FRAME 0 8 /* offset 8: return address */
851 FIXUP_TOP_OF_STACK %r11, 8-ARGOFFSET
852 call \func
853 RESTORE_TOP_OF_STACK %r11, 8-ARGOFFSET
854 ret
855 CFI_ENDPROC
856END(\label)
857 .endm
858
864 FORK_LIKE clone 859 FORK_LIKE clone
865 FORK_LIKE fork 860 FORK_LIKE fork
866 FORK_LIKE vfork 861 FORK_LIKE vfork
867 PTREGSCALL stub_iopl, sys_iopl, %rsi 862 FIXED_FRAME stub_iopl, sys_iopl
868 863
869ENTRY(ptregscall_common) 864ENTRY(ptregscall_common)
870 DEFAULT_FRAME 1 8 /* offset 8: return address */ 865 DEFAULT_FRAME 1 8 /* offset 8: return address */
@@ -886,7 +881,6 @@ ENTRY(stub_execve)
886 SAVE_REST 881 SAVE_REST
887 FIXUP_TOP_OF_STACK %r11 882 FIXUP_TOP_OF_STACK %r11
888 call sys_execve 883 call sys_execve
889 RESTORE_TOP_OF_STACK %r11
890 movq %rax,RAX(%rsp) 884 movq %rax,RAX(%rsp)
891 RESTORE_REST 885 RESTORE_REST
892 jmp int_ret_from_sys_call 886 jmp int_ret_from_sys_call
@@ -902,7 +896,6 @@ ENTRY(stub_rt_sigreturn)
902 addq $8, %rsp 896 addq $8, %rsp
903 PARTIAL_FRAME 0 897 PARTIAL_FRAME 0
904 SAVE_REST 898 SAVE_REST
905 movq %rsp,%rdi
906 FIXUP_TOP_OF_STACK %r11 899 FIXUP_TOP_OF_STACK %r11
907 call sys_rt_sigreturn 900 call sys_rt_sigreturn
908 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer 901 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
@@ -917,7 +910,6 @@ ENTRY(stub_x32_rt_sigreturn)
917 addq $8, %rsp 910 addq $8, %rsp
918 PARTIAL_FRAME 0 911 PARTIAL_FRAME 0
919 SAVE_REST 912 SAVE_REST
920 movq %rsp,%rdi
921 FIXUP_TOP_OF_STACK %r11 913 FIXUP_TOP_OF_STACK %r11
922 call sys32_x32_rt_sigreturn 914 call sys32_x32_rt_sigreturn
923 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer 915 movq %rax,RAX(%rsp) # fixme, this could be done at the higher layer
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 8c968974253d..4ddaf66ea35f 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -93,8 +93,9 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
93 * on system-call entry - see also fork() and the signal handling 93 * on system-call entry - see also fork() and the signal handling
94 * code. 94 * code.
95 */ 95 */
96long sys_iopl(unsigned int level, struct pt_regs *regs) 96SYSCALL_DEFINE1(iopl, unsigned int, level)
97{ 97{
98 struct pt_regs *regs = current_pt_regs();
98 unsigned int old = (regs->flags >> 12) & 3; 99 unsigned int old = (regs->flags >> 12) & 3;
99 struct thread_struct *t = &current->thread; 100 struct thread_struct *t = &current->thread;
100 101
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index d6bf1f34a6e9..69562992e457 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -278,7 +278,7 @@ static const struct {
278}; 278};
279 279
280static int 280static int
281__setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, 281__setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
282 struct pt_regs *regs) 282 struct pt_regs *regs)
283{ 283{
284 struct sigframe __user *frame; 284 struct sigframe __user *frame;
@@ -286,7 +286,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
286 int err = 0; 286 int err = 0;
287 void __user *fpstate = NULL; 287 void __user *fpstate = NULL;
288 288
289 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 289 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fpstate);
290 290
291 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 291 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
292 return -EFAULT; 292 return -EFAULT;
@@ -307,8 +307,8 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
307 restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn); 307 restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn);
308 else 308 else
309 restorer = &frame->retcode; 309 restorer = &frame->retcode;
310 if (ka->sa.sa_flags & SA_RESTORER) 310 if (ksig->ka.sa.sa_flags & SA_RESTORER)
311 restorer = ka->sa.sa_restorer; 311 restorer = ksig->ka.sa.sa_restorer;
312 312
313 /* Set up to return from userspace. */ 313 /* Set up to return from userspace. */
314 err |= __put_user(restorer, &frame->pretcode); 314 err |= __put_user(restorer, &frame->pretcode);
@@ -327,7 +327,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
327 327
328 /* Set up registers for signal handler */ 328 /* Set up registers for signal handler */
329 regs->sp = (unsigned long)frame; 329 regs->sp = (unsigned long)frame;
330 regs->ip = (unsigned long)ka->sa.sa_handler; 330 regs->ip = (unsigned long)ksig->ka.sa.sa_handler;
331 regs->ax = (unsigned long)sig; 331 regs->ax = (unsigned long)sig;
332 regs->dx = 0; 332 regs->dx = 0;
333 regs->cx = 0; 333 regs->cx = 0;
@@ -340,7 +340,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
340 return 0; 340 return 0;
341} 341}
342 342
343static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 343static int __setup_rt_frame(int sig, struct ksignal *ksig,
344 sigset_t *set, struct pt_regs *regs) 344 sigset_t *set, struct pt_regs *regs)
345{ 345{
346 struct rt_sigframe __user *frame; 346 struct rt_sigframe __user *frame;
@@ -348,7 +348,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
348 int err = 0; 348 int err = 0;
349 void __user *fpstate = NULL; 349 void __user *fpstate = NULL;
350 350
351 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 351 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fpstate);
352 352
353 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 353 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
354 return -EFAULT; 354 return -EFAULT;
@@ -368,8 +368,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
368 368
369 /* Set up to return from userspace. */ 369 /* Set up to return from userspace. */
370 restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); 370 restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn);
371 if (ka->sa.sa_flags & SA_RESTORER) 371 if (ksig->ka.sa.sa_flags & SA_RESTORER)
372 restorer = ka->sa.sa_restorer; 372 restorer = ksig->ka.sa.sa_restorer;
373 put_user_ex(restorer, &frame->pretcode); 373 put_user_ex(restorer, &frame->pretcode);
374 374
375 /* 375 /*
@@ -382,7 +382,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
382 put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode); 382 put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode);
383 } put_user_catch(err); 383 } put_user_catch(err);
384 384
385 err |= copy_siginfo_to_user(&frame->info, info); 385 err |= copy_siginfo_to_user(&frame->info, &ksig->info);
386 err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, 386 err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
387 regs, set->sig[0]); 387 regs, set->sig[0]);
388 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 388 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
@@ -392,7 +392,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
392 392
393 /* Set up registers for signal handler */ 393 /* Set up registers for signal handler */
394 regs->sp = (unsigned long)frame; 394 regs->sp = (unsigned long)frame;
395 regs->ip = (unsigned long)ka->sa.sa_handler; 395 regs->ip = (unsigned long)ksig->ka.sa.sa_handler;
396 regs->ax = (unsigned long)sig; 396 regs->ax = (unsigned long)sig;
397 regs->dx = (unsigned long)&frame->info; 397 regs->dx = (unsigned long)&frame->info;
398 regs->cx = (unsigned long)&frame->uc; 398 regs->cx = (unsigned long)&frame->uc;
@@ -405,20 +405,20 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
405 return 0; 405 return 0;
406} 406}
407#else /* !CONFIG_X86_32 */ 407#else /* !CONFIG_X86_32 */
408static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 408static int __setup_rt_frame(int sig, struct ksignal *ksig,
409 sigset_t *set, struct pt_regs *regs) 409 sigset_t *set, struct pt_regs *regs)
410{ 410{
411 struct rt_sigframe __user *frame; 411 struct rt_sigframe __user *frame;
412 void __user *fp = NULL; 412 void __user *fp = NULL;
413 int err = 0; 413 int err = 0;
414 414
415 frame = get_sigframe(ka, regs, sizeof(struct rt_sigframe), &fp); 415 frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp);
416 416
417 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 417 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
418 return -EFAULT; 418 return -EFAULT;
419 419
420 if (ka->sa.sa_flags & SA_SIGINFO) { 420 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
421 if (copy_siginfo_to_user(&frame->info, info)) 421 if (copy_siginfo_to_user(&frame->info, &ksig->info))
422 return -EFAULT; 422 return -EFAULT;
423 } 423 }
424 424
@@ -434,8 +434,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
434 /* Set up to return from userspace. If provided, use a stub 434 /* Set up to return from userspace. If provided, use a stub
435 already in userspace. */ 435 already in userspace. */
436 /* x86-64 should always use SA_RESTORER. */ 436 /* x86-64 should always use SA_RESTORER. */
437 if (ka->sa.sa_flags & SA_RESTORER) { 437 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
438 put_user_ex(ka->sa.sa_restorer, &frame->pretcode); 438 put_user_ex(ksig->ka.sa.sa_restorer, &frame->pretcode);
439 } else { 439 } else {
440 /* could use a vstub here */ 440 /* could use a vstub here */
441 err |= -EFAULT; 441 err |= -EFAULT;
@@ -457,7 +457,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
457 next argument after the signal number on the stack. */ 457 next argument after the signal number on the stack. */
458 regs->si = (unsigned long)&frame->info; 458 regs->si = (unsigned long)&frame->info;
459 regs->dx = (unsigned long)&frame->uc; 459 regs->dx = (unsigned long)&frame->uc;
460 regs->ip = (unsigned long) ka->sa.sa_handler; 460 regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
461 461
462 regs->sp = (unsigned long)frame; 462 regs->sp = (unsigned long)frame;
463 463
@@ -469,8 +469,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
469} 469}
470#endif /* CONFIG_X86_32 */ 470#endif /* CONFIG_X86_32 */
471 471
472static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, 472static int x32_setup_rt_frame(struct ksignal *ksig,
473 siginfo_t *info, compat_sigset_t *set, 473 compat_sigset_t *set,
474 struct pt_regs *regs) 474 struct pt_regs *regs)
475{ 475{
476#ifdef CONFIG_X86_X32_ABI 476#ifdef CONFIG_X86_X32_ABI
@@ -479,13 +479,13 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
479 int err = 0; 479 int err = 0;
480 void __user *fpstate = NULL; 480 void __user *fpstate = NULL;
481 481
482 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 482 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fpstate);
483 483
484 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 484 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
485 return -EFAULT; 485 return -EFAULT;
486 486
487 if (ka->sa.sa_flags & SA_SIGINFO) { 487 if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
488 if (copy_siginfo_to_user32(&frame->info, info)) 488 if (copy_siginfo_to_user32(&frame->info, &ksig->info))
489 return -EFAULT; 489 return -EFAULT;
490 } 490 }
491 491
@@ -499,8 +499,8 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
499 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); 499 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp);
500 put_user_ex(0, &frame->uc.uc__pad0); 500 put_user_ex(0, &frame->uc.uc__pad0);
501 501
502 if (ka->sa.sa_flags & SA_RESTORER) { 502 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
503 restorer = ka->sa.sa_restorer; 503 restorer = ksig->ka.sa.sa_restorer;
504 } else { 504 } else {
505 /* could use a vstub here */ 505 /* could use a vstub here */
506 restorer = NULL; 506 restorer = NULL;
@@ -518,10 +518,10 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
518 518
519 /* Set up registers for signal handler */ 519 /* Set up registers for signal handler */
520 regs->sp = (unsigned long) frame; 520 regs->sp = (unsigned long) frame;
521 regs->ip = (unsigned long) ka->sa.sa_handler; 521 regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
522 522
523 /* We use the x32 calling convention here... */ 523 /* We use the x32 calling convention here... */
524 regs->di = sig; 524 regs->di = ksig->sig;
525 regs->si = (unsigned long) &frame->info; 525 regs->si = (unsigned long) &frame->info;
526 regs->dx = (unsigned long) &frame->uc; 526 regs->dx = (unsigned long) &frame->uc;
527 527
@@ -535,70 +535,13 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
535 return 0; 535 return 0;
536} 536}
537 537
538#ifdef CONFIG_X86_32
539/*
540 * Atomically swap in the new signal mask, and wait for a signal.
541 */
542asmlinkage int
543sys_sigsuspend(int history0, int history1, old_sigset_t mask)
544{
545 sigset_t blocked;
546 siginitset(&blocked, mask);
547 return sigsuspend(&blocked);
548}
549
550asmlinkage int
551sys_sigaction(int sig, const struct old_sigaction __user *act,
552 struct old_sigaction __user *oact)
553{
554 struct k_sigaction new_ka, old_ka;
555 int ret = 0;
556
557 if (act) {
558 old_sigset_t mask;
559
560 if (!access_ok(VERIFY_READ, act, sizeof(*act)))
561 return -EFAULT;
562
563 get_user_try {
564 get_user_ex(new_ka.sa.sa_handler, &act->sa_handler);
565 get_user_ex(new_ka.sa.sa_flags, &act->sa_flags);
566 get_user_ex(mask, &act->sa_mask);
567 get_user_ex(new_ka.sa.sa_restorer, &act->sa_restorer);
568 } get_user_catch(ret);
569
570 if (ret)
571 return -EFAULT;
572 siginitset(&new_ka.sa.sa_mask, mask);
573 }
574
575 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
576
577 if (!ret && oact) {
578 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
579 return -EFAULT;
580
581 put_user_try {
582 put_user_ex(old_ka.sa.sa_handler, &oact->sa_handler);
583 put_user_ex(old_ka.sa.sa_flags, &oact->sa_flags);
584 put_user_ex(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
585 put_user_ex(old_ka.sa.sa_restorer, &oact->sa_restorer);
586 } put_user_catch(ret);
587
588 if (ret)
589 return -EFAULT;
590 }
591
592 return ret;
593}
594#endif /* CONFIG_X86_32 */
595
596/* 538/*
597 * Do a signal return; undo the signal stack. 539 * Do a signal return; undo the signal stack.
598 */ 540 */
599#ifdef CONFIG_X86_32 541#ifdef CONFIG_X86_32
600unsigned long sys_sigreturn(struct pt_regs *regs) 542unsigned long sys_sigreturn(void)
601{ 543{
544 struct pt_regs *regs = current_pt_regs();
602 struct sigframe __user *frame; 545 struct sigframe __user *frame;
603 unsigned long ax; 546 unsigned long ax;
604 sigset_t set; 547 sigset_t set;
@@ -625,8 +568,9 @@ badframe:
625} 568}
626#endif /* CONFIG_X86_32 */ 569#endif /* CONFIG_X86_32 */
627 570
628long sys_rt_sigreturn(struct pt_regs *regs) 571long sys_rt_sigreturn(void)
629{ 572{
573 struct pt_regs *regs = current_pt_regs();
630 struct rt_sigframe __user *frame; 574 struct rt_sigframe __user *frame;
631 unsigned long ax; 575 unsigned long ax;
632 sigset_t set; 576 sigset_t set;
@@ -667,30 +611,29 @@ static int signr_convert(int sig)
667} 611}
668 612
669static int 613static int
670setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 614setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
671 struct pt_regs *regs)
672{ 615{
673 int usig = signr_convert(sig); 616 int usig = signr_convert(ksig->sig);
674 sigset_t *set = sigmask_to_save(); 617 sigset_t *set = sigmask_to_save();
675 compat_sigset_t *cset = (compat_sigset_t *) set; 618 compat_sigset_t *cset = (compat_sigset_t *) set;
676 619
677 /* Set up the stack frame */ 620 /* Set up the stack frame */
678 if (is_ia32_frame()) { 621 if (is_ia32_frame()) {
679 if (ka->sa.sa_flags & SA_SIGINFO) 622 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
680 return ia32_setup_rt_frame(usig, ka, info, cset, regs); 623 return ia32_setup_rt_frame(usig, ksig, cset, regs);
681 else 624 else
682 return ia32_setup_frame(usig, ka, cset, regs); 625 return ia32_setup_frame(usig, ksig, cset, regs);
683 } else if (is_x32_frame()) { 626 } else if (is_x32_frame()) {
684 return x32_setup_rt_frame(usig, ka, info, cset, regs); 627 return x32_setup_rt_frame(ksig, cset, regs);
685 } else { 628 } else {
686 return __setup_rt_frame(sig, ka, info, set, regs); 629 return __setup_rt_frame(ksig->sig, ksig, set, regs);
687 } 630 }
688} 631}
689 632
690static void 633static void
691handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 634handle_signal(struct ksignal *ksig, struct pt_regs *regs)
692 struct pt_regs *regs)
693{ 635{
636 bool failed;
694 /* Are we from a system call? */ 637 /* Are we from a system call? */
695 if (syscall_get_nr(current, regs) >= 0) { 638 if (syscall_get_nr(current, regs) >= 0) {
696 /* If so, check system call restarting.. */ 639 /* If so, check system call restarting.. */
@@ -701,7 +644,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
701 break; 644 break;
702 645
703 case -ERESTARTSYS: 646 case -ERESTARTSYS:
704 if (!(ka->sa.sa_flags & SA_RESTART)) { 647 if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
705 regs->ax = -EINTR; 648 regs->ax = -EINTR;
706 break; 649 break;
707 } 650 }
@@ -721,26 +664,21 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
721 likely(test_and_clear_thread_flag(TIF_FORCED_TF))) 664 likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
722 regs->flags &= ~X86_EFLAGS_TF; 665 regs->flags &= ~X86_EFLAGS_TF;
723 666
724 if (setup_rt_frame(sig, ka, info, regs) < 0) { 667 failed = (setup_rt_frame(ksig, regs) < 0);
725 force_sigsegv(sig, current); 668 if (!failed) {
726 return; 669 /*
670 * Clear the direction flag as per the ABI for function entry.
671 */
672 regs->flags &= ~X86_EFLAGS_DF;
673 /*
674 * Clear TF when entering the signal handler, but
675 * notify any tracer that was single-stepping it.
676 * The tracer may want to single-step inside the
677 * handler too.
678 */
679 regs->flags &= ~X86_EFLAGS_TF;
727 } 680 }
728 681 signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
729 /*
730 * Clear the direction flag as per the ABI for function entry.
731 */
732 regs->flags &= ~X86_EFLAGS_DF;
733
734 /*
735 * Clear TF when entering the signal handler, but
736 * notify any tracer that was single-stepping it.
737 * The tracer may want to single-step inside the
738 * handler too.
739 */
740 regs->flags &= ~X86_EFLAGS_TF;
741
742 signal_delivered(sig, info, ka, regs,
743 test_thread_flag(TIF_SINGLESTEP));
744} 682}
745 683
746#ifdef CONFIG_X86_32 684#ifdef CONFIG_X86_32
@@ -757,14 +695,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
757 */ 695 */
758static void do_signal(struct pt_regs *regs) 696static void do_signal(struct pt_regs *regs)
759{ 697{
760 struct k_sigaction ka; 698 struct ksignal ksig;
761 siginfo_t info;
762 int signr;
763 699
764 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 700 if (get_signal(&ksig)) {
765 if (signr > 0) {
766 /* Whee! Actually deliver the signal. */ 701 /* Whee! Actually deliver the signal. */
767 handle_signal(signr, &info, &ka, regs); 702 handle_signal(&ksig, regs);
768 return; 703 return;
769 } 704 }
770 705
@@ -843,8 +778,9 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
843} 778}
844 779
845#ifdef CONFIG_X86_X32_ABI 780#ifdef CONFIG_X86_X32_ABI
846asmlinkage long sys32_x32_rt_sigreturn(struct pt_regs *regs) 781asmlinkage long sys32_x32_rt_sigreturn(void)
847{ 782{
783 struct pt_regs *regs = current_pt_regs();
848 struct rt_sigframe_x32 __user *frame; 784 struct rt_sigframe_x32 __user *frame;
849 sigset_t set; 785 sigset_t set;
850 unsigned long ax; 786 unsigned long ax;
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index 1dfe69cc78a8..1cf5766dde16 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -202,7 +202,7 @@ out:
202static int do_vm86_irq_handling(int subfunction, int irqnumber); 202static int do_vm86_irq_handling(int subfunction, int irqnumber);
203static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk); 203static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk);
204 204
205int sys_vm86old(struct vm86_struct __user *v86, struct pt_regs *regs) 205int sys_vm86old(struct vm86_struct __user *v86)
206{ 206{
207 struct kernel_vm86_struct info; /* declare this _on top_, 207 struct kernel_vm86_struct info; /* declare this _on top_,
208 * this avoids wasting of stack space. 208 * this avoids wasting of stack space.
@@ -222,7 +222,7 @@ int sys_vm86old(struct vm86_struct __user *v86, struct pt_regs *regs)
222 if (tmp) 222 if (tmp)
223 goto out; 223 goto out;
224 memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus); 224 memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus);
225 info.regs32 = regs; 225 info.regs32 = current_pt_regs();
226 tsk->thread.vm86_info = v86; 226 tsk->thread.vm86_info = v86;
227 do_sys_vm86(&info, tsk); 227 do_sys_vm86(&info, tsk);
228 ret = 0; /* we never return here */ 228 ret = 0; /* we never return here */
@@ -231,7 +231,7 @@ out:
231} 231}
232 232
233 233
234int sys_vm86(unsigned long cmd, unsigned long arg, struct pt_regs *regs) 234int sys_vm86(unsigned long cmd, unsigned long arg)
235{ 235{
236 struct kernel_vm86_struct info; /* declare this _on top_, 236 struct kernel_vm86_struct info; /* declare this _on top_,
237 * this avoids wasting of stack space. 237 * this avoids wasting of stack space.
@@ -272,7 +272,7 @@ int sys_vm86(unsigned long cmd, unsigned long arg, struct pt_regs *regs)
272 ret = -EFAULT; 272 ret = -EFAULT;
273 if (tmp) 273 if (tmp)
274 goto out; 274 goto out;
275 info.regs32 = regs; 275 info.regs32 = current_pt_regs();
276 info.vm86plus.is_vm86pus = 1; 276 info.vm86plus.is_vm86pus = 1;
277 tsk->thread.vm86_info = (struct vm86_struct __user *)v86; 277 tsk->thread.vm86_info = (struct vm86_struct __user *)v86;
278 do_sys_vm86(&info, tsk); 278 do_sys_vm86(&info, tsk);
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index 28e3fa9056ea..f2fe78ff22cc 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -73,12 +73,12 @@
7364 i386 getppid sys_getppid 7364 i386 getppid sys_getppid
7465 i386 getpgrp sys_getpgrp 7465 i386 getpgrp sys_getpgrp
7566 i386 setsid sys_setsid 7566 i386 setsid sys_setsid
7667 i386 sigaction sys_sigaction sys32_sigaction 7667 i386 sigaction sys_sigaction compat_sys_sigaction
7768 i386 sgetmask sys_sgetmask 7768 i386 sgetmask sys_sgetmask
7869 i386 ssetmask sys_ssetmask 7869 i386 ssetmask sys_ssetmask
7970 i386 setreuid sys_setreuid16 7970 i386 setreuid sys_setreuid16
8071 i386 setregid sys_setregid16 8071 i386 setregid sys_setregid16
8172 i386 sigsuspend sys_sigsuspend sys32_sigsuspend 8172 i386 sigsuspend sys_sigsuspend sys_sigsuspend
8273 i386 sigpending sys_sigpending compat_sys_sigpending 8273 i386 sigpending sys_sigpending compat_sys_sigpending
8374 i386 sethostname sys_sethostname 8374 i386 sethostname sys_sethostname
8475 i386 setrlimit sys_setrlimit compat_sys_setrlimit 8475 i386 setrlimit sys_setrlimit compat_sys_setrlimit
@@ -116,16 +116,16 @@
116107 i386 lstat sys_newlstat compat_sys_newlstat 116107 i386 lstat sys_newlstat compat_sys_newlstat
117108 i386 fstat sys_newfstat compat_sys_newfstat 117108 i386 fstat sys_newfstat compat_sys_newfstat
118109 i386 olduname sys_uname 118109 i386 olduname sys_uname
119110 i386 iopl ptregs_iopl stub32_iopl 119110 i386 iopl sys_iopl
120111 i386 vhangup sys_vhangup 120111 i386 vhangup sys_vhangup
121112 i386 idle 121112 i386 idle
122113 i386 vm86old ptregs_vm86old sys32_vm86_warning 122113 i386 vm86old sys_vm86old sys32_vm86_warning
123114 i386 wait4 sys_wait4 compat_sys_wait4 123114 i386 wait4 sys_wait4 compat_sys_wait4
124115 i386 swapoff sys_swapoff 124115 i386 swapoff sys_swapoff
125116 i386 sysinfo sys_sysinfo compat_sys_sysinfo 125116 i386 sysinfo sys_sysinfo compat_sys_sysinfo
126117 i386 ipc sys_ipc sys32_ipc 126117 i386 ipc sys_ipc sys32_ipc
127118 i386 fsync sys_fsync 127118 i386 fsync sys_fsync
128119 i386 sigreturn ptregs_sigreturn stub32_sigreturn 128119 i386 sigreturn sys_sigreturn stub32_sigreturn
129120 i386 clone sys_clone stub32_clone 129120 i386 clone sys_clone stub32_clone
130121 i386 setdomainname sys_setdomainname 130121 i386 setdomainname sys_setdomainname
131122 i386 uname sys_newuname 131122 i386 uname sys_newuname
@@ -167,24 +167,24 @@
167158 i386 sched_yield sys_sched_yield 167158 i386 sched_yield sys_sched_yield
168159 i386 sched_get_priority_max sys_sched_get_priority_max 168159 i386 sched_get_priority_max sys_sched_get_priority_max
169160 i386 sched_get_priority_min sys_sched_get_priority_min 169160 i386 sched_get_priority_min sys_sched_get_priority_min
170161 i386 sched_rr_get_interval sys_sched_rr_get_interval sys32_sched_rr_get_interval 170161 i386 sched_rr_get_interval sys_sched_rr_get_interval compat_sys_sched_rr_get_interval
171162 i386 nanosleep sys_nanosleep compat_sys_nanosleep 171162 i386 nanosleep sys_nanosleep compat_sys_nanosleep
172163 i386 mremap sys_mremap 172163 i386 mremap sys_mremap
173164 i386 setresuid sys_setresuid16 173164 i386 setresuid sys_setresuid16
174165 i386 getresuid sys_getresuid16 174165 i386 getresuid sys_getresuid16
175166 i386 vm86 ptregs_vm86 sys32_vm86_warning 175166 i386 vm86 sys_vm86 sys32_vm86_warning
176167 i386 query_module 176167 i386 query_module
177168 i386 poll sys_poll 177168 i386 poll sys_poll
178169 i386 nfsservctl 178169 i386 nfsservctl
179170 i386 setresgid sys_setresgid16 179170 i386 setresgid sys_setresgid16
180171 i386 getresgid sys_getresgid16 180171 i386 getresgid sys_getresgid16
181172 i386 prctl sys_prctl 181172 i386 prctl sys_prctl
182173 i386 rt_sigreturn ptregs_rt_sigreturn stub32_rt_sigreturn 182173 i386 rt_sigreturn sys_rt_sigreturn stub32_rt_sigreturn
183174 i386 rt_sigaction sys_rt_sigaction sys32_rt_sigaction 183174 i386 rt_sigaction sys_rt_sigaction compat_sys_rt_sigaction
184175 i386 rt_sigprocmask sys_rt_sigprocmask 184175 i386 rt_sigprocmask sys_rt_sigprocmask
185176 i386 rt_sigpending sys_rt_sigpending sys32_rt_sigpending 185176 i386 rt_sigpending sys_rt_sigpending compat_sys_rt_sigpending
186177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait 186177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait
187178 i386 rt_sigqueueinfo sys_rt_sigqueueinfo sys32_rt_sigqueueinfo 187178 i386 rt_sigqueueinfo sys_rt_sigqueueinfo compat_sys_rt_sigqueueinfo
188179 i386 rt_sigsuspend sys_rt_sigsuspend 188179 i386 rt_sigsuspend sys_rt_sigsuspend
189180 i386 pread64 sys_pread64 sys32_pread 189180 i386 pread64 sys_pread64 sys32_pread
190181 i386 pwrite64 sys_pwrite64 sys32_pwrite 190181 i386 pwrite64 sys_pwrite64 sys32_pwrite
diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl
index dc97328bd90a..38ae65dfd14f 100644
--- a/arch/x86/syscalls/syscall_64.tbl
+++ b/arch/x86/syscalls/syscall_64.tbl
@@ -325,7 +325,7 @@
325# x32-specific system call numbers start at 512 to avoid cache impact 325# x32-specific system call numbers start at 512 to avoid cache impact
326# for native 64-bit operation. 326# for native 64-bit operation.
327# 327#
328512 x32 rt_sigaction sys32_rt_sigaction 328512 x32 rt_sigaction compat_sys_rt_sigaction
329513 x32 rt_sigreturn stub_x32_rt_sigreturn 329513 x32 rt_sigreturn stub_x32_rt_sigreturn
330514 x32 ioctl compat_sys_ioctl 330514 x32 ioctl compat_sys_ioctl
331515 x32 readv compat_sys_readv 331515 x32 readv compat_sys_readv
@@ -335,9 +335,9 @@
335519 x32 recvmsg compat_sys_recvmsg 335519 x32 recvmsg compat_sys_recvmsg
336520 x32 execve stub_x32_execve 336520 x32 execve stub_x32_execve
337521 x32 ptrace compat_sys_ptrace 337521 x32 ptrace compat_sys_ptrace
338522 x32 rt_sigpending sys32_rt_sigpending 338522 x32 rt_sigpending compat_sys_rt_sigpending
339523 x32 rt_sigtimedwait compat_sys_rt_sigtimedwait 339523 x32 rt_sigtimedwait compat_sys_rt_sigtimedwait
340524 x32 rt_sigqueueinfo sys32_rt_sigqueueinfo 340524 x32 rt_sigqueueinfo compat_sys_rt_sigqueueinfo
341525 x32 sigaltstack compat_sys_sigaltstack 341525 x32 sigaltstack compat_sys_sigaltstack
342526 x32 timer_create compat_sys_timer_create 342526 x32 timer_create compat_sys_timer_create
343527 x32 mq_notify compat_sys_mq_notify 343527 x32 mq_notify compat_sys_mq_notify
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 21a13ce1d751..14ef8d1dbc33 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -13,7 +13,6 @@ endmenu
13config UML_X86 13config UML_X86
14 def_bool y 14 def_bool y
15 select GENERIC_FIND_FIRST_BIT 15 select GENERIC_FIND_FIRST_BIT
16 select GENERIC_SIGALTSTACK
17 16
18config 64BIT 17config 64BIT
19 bool "64-bit kernel" if SUBARCH = "x86" 18 bool "64-bit kernel" if SUBARCH = "x86"
@@ -25,6 +24,8 @@ config X86_32
25 select ARCH_WANT_IPC_PARSE_VERSION 24 select ARCH_WANT_IPC_PARSE_VERSION
26 select MODULES_USE_ELF_REL 25 select MODULES_USE_ELF_REL
27 select CLONE_BACKWARDS 26 select CLONE_BACKWARDS
27 select OLD_SIGSUSPEND3
28 select OLD_SIGACTION
28 29
29config X86_64 30config X86_64
30 def_bool 64BIT 31 def_bool 64BIT
diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile
index 5d065b2222d3..eafa324eb7a5 100644
--- a/arch/x86/um/Makefile
+++ b/arch/x86/um/Makefile
@@ -10,7 +10,7 @@ endif
10 10
11obj-y = bug.o bugs_$(BITS).o delay.o fault.o ksyms.o ldt.o \ 11obj-y = bug.o bugs_$(BITS).o delay.o fault.o ksyms.o ldt.o \
12 ptrace_$(BITS).o ptrace_user.o setjmp_$(BITS).o signal.o \ 12 ptrace_$(BITS).o ptrace_user.o setjmp_$(BITS).o signal.o \
13 stub_$(BITS).o stub_segv.o syscalls_$(BITS).o \ 13 stub_$(BITS).o stub_segv.o \
14 sys_call_table_$(BITS).o sysrq_$(BITS).o tls_$(BITS).o \ 14 sys_call_table_$(BITS).o sysrq_$(BITS).o tls_$(BITS).o \
15 mem_$(BITS).o subarch.o os-$(OS)/ 15 mem_$(BITS).o subarch.o os-$(OS)/
16 16
@@ -25,7 +25,7 @@ subarch-$(CONFIG_HIGHMEM) += ../mm/highmem_32.o
25 25
26else 26else
27 27
28obj-y += vdso/ 28obj-y += syscalls_64.o vdso/
29 29
30subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../lib/thunk_64.o \ 30subarch-y = ../lib/csum-partial_64.o ../lib/memcpy_64.o ../lib/thunk_64.o \
31 ../lib/rwsem.o 31 ../lib/rwsem.o
diff --git a/arch/x86/um/shared/sysdep/syscalls_32.h b/arch/x86/um/shared/sysdep/syscalls_32.h
index 8436079be914..68fd2cf526fd 100644
--- a/arch/x86/um/shared/sysdep/syscalls_32.h
+++ b/arch/x86/um/shared/sysdep/syscalls_32.h
@@ -8,11 +8,6 @@
8 8
9typedef long syscall_handler_t(struct pt_regs); 9typedef long syscall_handler_t(struct pt_regs);
10 10
11/* Not declared on x86, incompatible declarations on x86_64, so these have
12 * to go here rather than in sys_call_table.c
13 */
14extern syscall_handler_t sys_rt_sigaction;
15
16extern syscall_handler_t *sys_call_table[]; 11extern syscall_handler_t *sys_call_table[];
17 12
18#define EXECUTE_SYSCALL(syscall, regs) \ 13#define EXECUTE_SYSCALL(syscall, regs) \
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index 71cef48ea5cd..ae7319db18ee 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -464,7 +464,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
464 return 0; 464 return 0;
465} 465}
466 466
467long sys_sigreturn(struct pt_regs *regs) 467long sys_sigreturn(void)
468{ 468{
469 unsigned long sp = PT_REGS_SP(&current->thread.regs); 469 unsigned long sp = PT_REGS_SP(&current->thread.regs);
470 struct sigframe __user *frame = (struct sigframe __user *)(sp - 8); 470 struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
@@ -577,7 +577,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
577} 577}
578#endif 578#endif
579 579
580long sys_rt_sigreturn(struct pt_regs *regs) 580long sys_rt_sigreturn(void)
581{ 581{
582 unsigned long sp = PT_REGS_SP(&current->thread.regs); 582 unsigned long sp = PT_REGS_SP(&current->thread.regs);
583 struct rt_sigframe __user *frame = 583 struct rt_sigframe __user *frame =
@@ -601,14 +601,3 @@ long sys_rt_sigreturn(struct pt_regs *regs)
601 force_sig(SIGSEGV, current); 601 force_sig(SIGSEGV, current);
602 return 0; 602 return 0;
603} 603}
604
605#ifdef CONFIG_X86_32
606long ptregs_sigreturn(void)
607{
608 return sys_sigreturn(NULL);
609}
610long ptregs_rt_sigreturn(void)
611{
612 return sys_rt_sigreturn(NULL);
613}
614#endif
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c
index a0c3b0d1a122..531d4269e2e3 100644
--- a/arch/x86/um/sys_call_table_32.c
+++ b/arch/x86/um/sys_call_table_32.c
@@ -24,10 +24,6 @@
24 24
25#define old_mmap sys_old_mmap 25#define old_mmap sys_old_mmap
26 26
27#define ptregs_iopl sys_iopl
28#define ptregs_vm86old sys_vm86old
29#define ptregs_vm86 sys_vm86
30
31#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ; 27#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ;
32#include <asm/syscalls_32.h> 28#include <asm/syscalls_32.h>
33 29
diff --git a/arch/x86/um/syscalls_32.c b/arch/x86/um/syscalls_32.c
deleted file mode 100644
index e8bcea99acdb..000000000000
--- a/arch/x86/um/syscalls_32.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <linux/syscalls.h>
7#include <sysdep/syscalls.h>
8
9long sys_sigaction(int sig, const struct old_sigaction __user *act,
10 struct old_sigaction __user *oact)
11{
12 struct k_sigaction new_ka, old_ka;
13 int ret;
14
15 if (act) {
16 old_sigset_t mask;
17 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
18 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
19 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
20 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
21 __get_user(mask, &act->sa_mask))
22 return -EFAULT;
23 siginitset(&new_ka.sa.sa_mask, mask);
24 }
25
26 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
27
28 if (!ret && oact) {
29 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
30 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
31 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
32 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
33 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
34 return -EFAULT;
35 }
36
37 return ret;
38}
diff --git a/arch/xtensa/include/asm/signal.h b/arch/xtensa/include/asm/signal.h
index 6f586bd90e18..de169b4eaeef 100644
--- a/arch/xtensa/include/asm/signal.h
+++ b/arch/xtensa/include/asm/signal.h
@@ -15,16 +15,7 @@
15#include <uapi/asm/signal.h> 15#include <uapi/asm/signal.h>
16 16
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18struct sigaction { 18#define __ARCH_HAS_SA_RESTORER
19 __sighandler_t sa_handler;
20 unsigned long sa_flags;
21 void (*sa_restorer)(void);
22 sigset_t sa_mask; /* mask last for extensibility */
23};
24
25struct k_sigaction {
26 struct sigaction sa;
27};
28 19
29#include <asm/sigcontext.h> 20#include <asm/sigcontext.h>
30 21
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
index 8d5e47fad095..3673ff1f1bc5 100644
--- a/arch/xtensa/include/asm/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
@@ -9,15 +9,9 @@
9 */ 9 */
10 10
11struct pt_regs; 11struct pt_regs;
12struct sigaction;
13asmlinkage long xtensa_ptrace(long, long, long, long); 12asmlinkage long xtensa_ptrace(long, long, long, long);
14asmlinkage long xtensa_sigreturn(struct pt_regs*); 13asmlinkage long xtensa_sigreturn(struct pt_regs*);
15asmlinkage long xtensa_rt_sigreturn(struct pt_regs*); 14asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
16asmlinkage long xtensa_sigaltstack(struct pt_regs *regs);
17asmlinkage long sys_rt_sigaction(int,
18 const struct sigaction __user *,
19 struct sigaction __user *,
20 size_t);
21asmlinkage long xtensa_shmat(int, char __user *, int); 15asmlinkage long xtensa_shmat(int, char __user *, int);
22asmlinkage long xtensa_fadvise64_64(int, int, 16asmlinkage long xtensa_fadvise64_64(int, int,
23 unsigned long long, unsigned long long); 17 unsigned long long, unsigned long long);
@@ -31,4 +25,3 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
31 struct timespec __user *tsp, 25 struct timespec __user *tsp,
32 const sigset_t __user *sigmask, 26 const sigset_t __user *sigmask,
33 size_t sigsetsize); 27 size_t sigsetsize);
34asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index eb63ea87815c..c38834de9ac7 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -15,8 +15,6 @@
15#define __ARCH_WANT_STAT64 15#define __ARCH_WANT_STAT64
16#define __ARCH_WANT_SYS_UTIME 16#define __ARCH_WANT_SYS_UTIME
17#define __ARCH_WANT_SYS_LLSEEK 17#define __ARCH_WANT_SYS_LLSEEK
18#define __ARCH_WANT_SYS_RT_SIGACTION
19#define __ARCH_WANT_SYS_RT_SIGSUSPEND
20#define __ARCH_WANT_SYS_GETPGRP 18#define __ARCH_WANT_SYS_GETPGRP
21 19
22/* 20/*
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h
index 5162418c5d90..19fac3f543a2 100644
--- a/arch/xtensa/include/uapi/asm/unistd.h
+++ b/arch/xtensa/include/uapi/asm/unistd.h
@@ -483,7 +483,7 @@ __SYSCALL(222, sys_ni_syscall, 0)
483#define __NR_restart_syscall 223 483#define __NR_restart_syscall 223
484__SYSCALL(223, sys_restart_syscall, 0) 484__SYSCALL(223, sys_restart_syscall, 0)
485#define __NR_sigaltstack 224 485#define __NR_sigaltstack 224
486__SYSCALL(224, xtensa_sigaltstack, 2) 486__SYSCALL(224, sys_sigaltstack, 2)
487#define __NR_rt_sigreturn 225 487#define __NR_rt_sigreturn 225
488__SYSCALL(225, xtensa_rt_sigreturn, 1) 488__SYSCALL(225, xtensa_rt_sigreturn, 1)
489#define __NR_rt_sigaction 226 489#define __NR_rt_sigaction 226
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index de34d6be91cd..d7590dddd084 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -265,7 +265,7 @@ asmlinkage long xtensa_rt_sigreturn(long a0, long a1, long a2, long a3,
265 265
266 ret = regs->areg[2]; 266 ret = regs->areg[2];
267 267
268 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->areg[1]) == -EFAULT) 268 if (restore_altstack(&frame->uc.uc_stack))
269 goto badframe; 269 goto badframe;
270 270
271 return ret; 271 return ret;
@@ -368,11 +368,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
368 368
369 err |= __put_user(0, &frame->uc.uc_flags); 369 err |= __put_user(0, &frame->uc.uc_flags);
370 err |= __put_user(0, &frame->uc.uc_link); 370 err |= __put_user(0, &frame->uc.uc_link);
371 err |= __put_user((void *)current->sas_ss_sp, 371 err |= __save_altstack(&frame->uc.uc_stack, regs->areg[1]);
372 &frame->uc.uc_stack.ss_sp);
373 err |= __put_user(sas_ss_flags(regs->areg[1]),
374 &frame->uc.uc_stack.ss_flags);
375 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
376 err |= setup_sigcontext(frame, regs); 372 err |= setup_sigcontext(frame, regs);
377 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 373 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
378 374
@@ -424,16 +420,6 @@ give_sigsegv:
424 return -EFAULT; 420 return -EFAULT;
425} 421}
426 422
427asmlinkage long xtensa_sigaltstack(const stack_t __user *uss,
428 stack_t __user *uoss,
429 long a2, long a3, long a4, long a5,
430 struct pt_regs *regs)
431{
432 return do_sigaltstack(uss, uoss, regs->areg[1]);
433}
434
435
436
437/* 423/*
438 * Note that 'init' is a special process: it doesn't get signals it doesn't 424 * Note that 'init' is a special process: it doesn't get signals it doesn't
439 * want to handle. Thus you cannot kill init even with a SIGKILL even by 425 * want to handle. Thus you cannot kill init even with a SIGKILL even by
diff --git a/fs/compat.c b/fs/compat.c
index 015e1e1f87c6..fe40fde29111 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1278,8 +1278,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
1278 * Exactly like fs/open.c:sys_open(), except that it doesn't set the 1278 * Exactly like fs/open.c:sys_open(), except that it doesn't set the
1279 * O_LARGEFILE flag. 1279 * O_LARGEFILE flag.
1280 */ 1280 */
1281asmlinkage long 1281COMPAT_SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
1282compat_sys_open(const char __user *filename, int flags, umode_t mode)
1283{ 1282{
1284 return do_sys_open(AT_FDCWD, filename, flags, mode); 1283 return do_sys_open(AT_FDCWD, filename, flags, mode);
1285} 1284}
@@ -1288,8 +1287,7 @@ compat_sys_open(const char __user *filename, int flags, umode_t mode)
1288 * Exactly like fs/open.c:sys_openat(), except that it doesn't set the 1287 * Exactly like fs/open.c:sys_openat(), except that it doesn't set the
1289 * O_LARGEFILE flag. 1288 * O_LARGEFILE flag.
1290 */ 1289 */
1291asmlinkage long 1290COMPAT_SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, umode_t, mode)
1292compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, umode_t mode)
1293{ 1291{
1294 return do_sys_open(dfd, filename, flags, mode); 1292 return do_sys_open(dfd, filename, flags, mode);
1295} 1293}
@@ -1739,55 +1737,13 @@ asmlinkage long compat_sys_signalfd(int ufd,
1739} 1737}
1740#endif /* CONFIG_SIGNALFD */ 1738#endif /* CONFIG_SIGNALFD */
1741 1739
1742#ifdef CONFIG_TIMERFD
1743
1744asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
1745 const struct compat_itimerspec __user *utmr,
1746 struct compat_itimerspec __user *otmr)
1747{
1748 int error;
1749 struct itimerspec t;
1750 struct itimerspec __user *ut;
1751
1752 if (get_compat_itimerspec(&t, utmr))
1753 return -EFAULT;
1754 ut = compat_alloc_user_space(2 * sizeof(struct itimerspec));
1755 if (copy_to_user(&ut[0], &t, sizeof(t)))
1756 return -EFAULT;
1757 error = sys_timerfd_settime(ufd, flags, &ut[0], &ut[1]);
1758 if (!error && otmr)
1759 error = (copy_from_user(&t, &ut[1], sizeof(struct itimerspec)) ||
1760 put_compat_itimerspec(otmr, &t)) ? -EFAULT: 0;
1761
1762 return error;
1763}
1764
1765asmlinkage long compat_sys_timerfd_gettime(int ufd,
1766 struct compat_itimerspec __user *otmr)
1767{
1768 int error;
1769 struct itimerspec t;
1770 struct itimerspec __user *ut;
1771
1772 ut = compat_alloc_user_space(sizeof(struct itimerspec));
1773 error = sys_timerfd_gettime(ufd, ut);
1774 if (!error)
1775 error = (copy_from_user(&t, ut, sizeof(struct itimerspec)) ||
1776 put_compat_itimerspec(otmr, &t)) ? -EFAULT: 0;
1777
1778 return error;
1779}
1780
1781#endif /* CONFIG_TIMERFD */
1782
1783#ifdef CONFIG_FHANDLE 1740#ifdef CONFIG_FHANDLE
1784/* 1741/*
1785 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it 1742 * Exactly like fs/open.c:sys_open_by_handle_at(), except that it
1786 * doesn't set the O_LARGEFILE flag. 1743 * doesn't set the O_LARGEFILE flag.
1787 */ 1744 */
1788asmlinkage long 1745COMPAT_SYSCALL_DEFINE3(open_by_handle_at, int, mountdirfd,
1789compat_sys_open_by_handle_at(int mountdirfd, 1746 struct file_handle __user *, handle, int, flags)
1790 struct file_handle __user *handle, int flags)
1791{ 1747{
1792 return do_handle_open(mountdirfd, handle, flags); 1748 return do_handle_open(mountdirfd, handle, flags);
1793} 1749}
diff --git a/fs/timerfd.c b/fs/timerfd.c
index d03822bbf190..0e606b12a59d 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -22,6 +22,7 @@
22#include <linux/anon_inodes.h> 22#include <linux/anon_inodes.h>
23#include <linux/timerfd.h> 23#include <linux/timerfd.h>
24#include <linux/syscalls.h> 24#include <linux/syscalls.h>
25#include <linux/compat.h>
25#include <linux/rcupdate.h> 26#include <linux/rcupdate.h>
26 27
27struct timerfd_ctx { 28struct timerfd_ctx {
@@ -278,21 +279,17 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
278 return ufd; 279 return ufd;
279} 280}
280 281
281SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, 282static int do_timerfd_settime(int ufd, int flags,
282 const struct itimerspec __user *, utmr, 283 const struct itimerspec *new,
283 struct itimerspec __user *, otmr) 284 struct itimerspec *old)
284{ 285{
285 struct fd f; 286 struct fd f;
286 struct timerfd_ctx *ctx; 287 struct timerfd_ctx *ctx;
287 struct itimerspec ktmr, kotmr;
288 int ret; 288 int ret;
289 289
290 if (copy_from_user(&ktmr, utmr, sizeof(ktmr)))
291 return -EFAULT;
292
293 if ((flags & ~TFD_SETTIME_FLAGS) || 290 if ((flags & ~TFD_SETTIME_FLAGS) ||
294 !timespec_valid(&ktmr.it_value) || 291 !timespec_valid(&new->it_value) ||
295 !timespec_valid(&ktmr.it_interval)) 292 !timespec_valid(&new->it_interval))
296 return -EINVAL; 293 return -EINVAL;
297 294
298 ret = timerfd_fget(ufd, &f); 295 ret = timerfd_fget(ufd, &f);
@@ -323,27 +320,23 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
323 if (ctx->expired && ctx->tintv.tv64) 320 if (ctx->expired && ctx->tintv.tv64)
324 hrtimer_forward_now(&ctx->tmr, ctx->tintv); 321 hrtimer_forward_now(&ctx->tmr, ctx->tintv);
325 322
326 kotmr.it_value = ktime_to_timespec(timerfd_get_remaining(ctx)); 323 old->it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
327 kotmr.it_interval = ktime_to_timespec(ctx->tintv); 324 old->it_interval = ktime_to_timespec(ctx->tintv);
328 325
329 /* 326 /*
330 * Re-program the timer to the new value ... 327 * Re-program the timer to the new value ...
331 */ 328 */
332 ret = timerfd_setup(ctx, flags, &ktmr); 329 ret = timerfd_setup(ctx, flags, new);
333 330
334 spin_unlock_irq(&ctx->wqh.lock); 331 spin_unlock_irq(&ctx->wqh.lock);
335 fdput(f); 332 fdput(f);
336 if (otmr && copy_to_user(otmr, &kotmr, sizeof(kotmr)))
337 return -EFAULT;
338
339 return ret; 333 return ret;
340} 334}
341 335
342SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr) 336static int do_timerfd_gettime(int ufd, struct itimerspec *t)
343{ 337{
344 struct fd f; 338 struct fd f;
345 struct timerfd_ctx *ctx; 339 struct timerfd_ctx *ctx;
346 struct itimerspec kotmr;
347 int ret = timerfd_fget(ufd, &f); 340 int ret = timerfd_fget(ufd, &f);
348 if (ret) 341 if (ret)
349 return ret; 342 return ret;
@@ -356,11 +349,65 @@ SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
356 hrtimer_forward_now(&ctx->tmr, ctx->tintv) - 1; 349 hrtimer_forward_now(&ctx->tmr, ctx->tintv) - 1;
357 hrtimer_restart(&ctx->tmr); 350 hrtimer_restart(&ctx->tmr);
358 } 351 }
359 kotmr.it_value = ktime_to_timespec(timerfd_get_remaining(ctx)); 352 t->it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
360 kotmr.it_interval = ktime_to_timespec(ctx->tintv); 353 t->it_interval = ktime_to_timespec(ctx->tintv);
361 spin_unlock_irq(&ctx->wqh.lock); 354 spin_unlock_irq(&ctx->wqh.lock);
362 fdput(f); 355 fdput(f);
356 return 0;
357}
358
359SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
360 const struct itimerspec __user *, utmr,
361 struct itimerspec __user *, otmr)
362{
363 struct itimerspec new, old;
364 int ret;
365
366 if (copy_from_user(&new, utmr, sizeof(new)))
367 return -EFAULT;
368 ret = do_timerfd_settime(ufd, flags, &new, &old);
369 if (ret)
370 return ret;
371 if (otmr && copy_to_user(otmr, &old, sizeof(old)))
372 return -EFAULT;
373
374 return ret;
375}
363 376
377SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
378{
379 struct itimerspec kotmr;
380 int ret = do_timerfd_gettime(ufd, &kotmr);
381 if (ret)
382 return ret;
364 return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0; 383 return copy_to_user(otmr, &kotmr, sizeof(kotmr)) ? -EFAULT: 0;
365} 384}
366 385
386#ifdef COMPAT
387COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
388 const struct itimerspec __user *, utmr,
389 struct itimerspec __user *, otmr)
390{
391 struct itimerspec new, old;
392 int ret;
393
394 if (get_compat_itimerspec(&new, utmr))
395 return -EFAULT;
396 ret = do_timerfd_settime(ufd, flags, &new, &old);
397 if (ret)
398 return ret;
399 if (otmr && put_compat_itimerspec(otmr, &old))
400 return -EFAULT;
401 return ret;
402}
403
404COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd,
405 struct itimerspec __user *, otmr)
406{
407 struct itimerspec kotmr;
408 int ret = do_timerfd_gettime(ufd, &kotmr);
409 if (ret)
410 return ret;
411 return put_compat_itimerspec(otmr, &t) ? -EFAULT: 0;
412}
413#endif
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index 1db51b8524e9..1f74be5113b2 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -21,24 +21,8 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
21 unsigned long fd, off_t pgoff); 21 unsigned long fd, off_t pgoff);
22#endif 22#endif
23 23
24#ifndef CONFIG_GENERIC_SIGALTSTACK
25#ifndef sys_sigaltstack
26asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
27 struct pt_regs *);
28#endif
29#endif
30
31#ifndef sys_rt_sigreturn 24#ifndef sys_rt_sigreturn
32asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); 25asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
33#endif 26#endif
34 27
35#ifndef sys_rt_sigsuspend
36asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
37#endif
38
39#ifndef sys_rt_sigaction
40asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
41 struct sigaction __user *oact, size_t sigsetsize);
42#endif
43
44#endif /* __ASM_GENERIC_SYSCALLS_H */ 28#endif /* __ASM_GENERIC_SYSCALLS_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index a36991ab334e..257c55ec4f77 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -9,9 +9,6 @@
9#define __ARCH_WANT_STAT64 9#define __ARCH_WANT_STAT64
10#define __ARCH_WANT_SYS_LLSEEK 10#define __ARCH_WANT_SYS_LLSEEK
11#endif 11#endif
12#define __ARCH_WANT_SYS_RT_SIGACTION
13#define __ARCH_WANT_SYS_RT_SIGSUSPEND
14#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
15 12
16/* 13/*
17 * "Conditional" syscalls 14 * "Conditional" syscalls
diff --git a/include/linux/compat.h b/include/linux/compat.h
index dec7e2d18875..de095b0462a7 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -68,7 +68,6 @@
68#ifndef compat_user_stack_pointer 68#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer() 69#define compat_user_stack_pointer() current_user_stack_pointer()
70#endif 70#endif
71#ifdef CONFIG_GENERIC_SIGALTSTACK
72#ifndef compat_sigaltstack /* we'll need that for MIPS */ 71#ifndef compat_sigaltstack /* we'll need that for MIPS */
73typedef struct compat_sigaltstack { 72typedef struct compat_sigaltstack {
74 compat_uptr_t ss_sp; 73 compat_uptr_t ss_sp;
@@ -76,7 +75,6 @@ typedef struct compat_sigaltstack {
76 compat_size_t ss_size; 75 compat_size_t ss_size;
77} compat_stack_t; 76} compat_stack_t;
78#endif 77#endif
79#endif
80 78
81#define compat_jiffies_to_clock_t(x) \ 79#define compat_jiffies_to_clock_t(x) \
82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 80 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
@@ -142,6 +140,20 @@ typedef struct {
142 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 140 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
143} compat_sigset_t; 141} compat_sigset_t;
144 142
143struct compat_sigaction {
144#ifndef __ARCH_HAS_ODD_SIGACTION
145 compat_uptr_t sa_handler;
146 compat_ulong_t sa_flags;
147#else
148 compat_ulong_t sa_flags;
149 compat_uptr_t sa_handler;
150#endif
151#ifdef __ARCH_HAS_SA_RESTORER
152 compat_uptr_t sa_restorer;
153#endif
154 compat_sigset_t sa_mask __packed;
155};
156
145/* 157/*
146 * These functions operate strictly on struct compat_time* 158 * These functions operate strictly on struct compat_time*
147 */ 159 */
@@ -283,6 +295,15 @@ struct compat_robust_list_head {
283 compat_uptr_t list_op_pending; 295 compat_uptr_t list_op_pending;
284}; 296};
285 297
298#ifdef CONFIG_COMPAT_OLD_SIGACTION
299struct compat_old_sigaction {
300 compat_uptr_t sa_handler;
301 compat_old_sigset_t sa_mask;
302 compat_ulong_t sa_flags;
303 compat_uptr_t sa_restorer;
304};
305#endif
306
286struct compat_statfs; 307struct compat_statfs;
287struct compat_statfs64; 308struct compat_statfs64;
288struct compat_old_linux_dirent; 309struct compat_old_linux_dirent;
@@ -367,6 +388,11 @@ int get_compat_sigevent(struct sigevent *event,
367 const struct compat_sigevent __user *u_event); 388 const struct compat_sigevent __user *u_event);
368long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, 389long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
369 struct compat_siginfo __user *uinfo); 390 struct compat_siginfo __user *uinfo);
391#ifdef CONFIG_COMPAT_OLD_SIGACTION
392asmlinkage long compat_sys_sigaction(int sig,
393 const struct compat_old_sigaction __user *act,
394 struct compat_old_sigaction __user *oact);
395#endif
370 396
371static inline int compat_timeval_compare(struct compat_timeval *lhs, 397static inline int compat_timeval_compare(struct compat_timeval *lhs,
372 struct compat_timeval *rhs) 398 struct compat_timeval *rhs)
@@ -401,7 +427,8 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
401asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 427asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
402 428
403extern int compat_printk(const char *fmt, ...); 429extern int compat_printk(const char *fmt, ...);
404extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); 430extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat);
431extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set);
405 432
406asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, 433asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
407 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 434 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
@@ -503,7 +530,7 @@ asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
503 unsigned int nr_segs, unsigned int flags); 530 unsigned int nr_segs, unsigned int flags);
504asmlinkage long compat_sys_open(const char __user *filename, int flags, 531asmlinkage long compat_sys_open(const char __user *filename, int flags,
505 umode_t mode); 532 umode_t mode);
506asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 533asmlinkage long compat_sys_openat(int dfd, const char __user *filename,
507 int flags, umode_t mode); 534 int flags, umode_t mode);
508asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 535asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
509 struct file_handle __user *handle, 536 struct file_handle __user *handle,
@@ -592,6 +619,19 @@ asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
592 struct compat_timespec __user *uts, compat_size_t sigsetsize); 619 struct compat_timespec __user *uts, compat_size_t sigsetsize);
593asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, 620asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
594 compat_size_t sigsetsize); 621 compat_size_t sigsetsize);
622asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
623 compat_sigset_t __user *oset,
624 compat_size_t sigsetsize);
625asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
626 compat_size_t sigsetsize);
627#ifndef CONFIG_ODD_RT_SIGACTION
628asmlinkage long compat_sys_rt_sigaction(int,
629 const struct compat_sigaction __user *,
630 struct compat_sigaction __user *,
631 compat_size_t);
632#endif
633asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
634 struct compat_siginfo __user *uinfo);
595asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); 635asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
596asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 636asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
597 unsigned long arg); 637 unsigned long arg);
@@ -642,13 +682,11 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
642 682
643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 683asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
644 compat_off_t __user *offset, compat_size_t count); 684 compat_off_t __user *offset, compat_size_t count);
645#ifdef CONFIG_GENERIC_SIGALTSTACK
646asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 685asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
647 compat_stack_t __user *uoss_ptr); 686 compat_stack_t __user *uoss_ptr);
648 687
649int compat_restore_altstack(const compat_stack_t __user *uss); 688int compat_restore_altstack(const compat_stack_t __user *uss);
650int __compat_save_altstack(compat_stack_t __user *, unsigned long); 689int __compat_save_altstack(compat_stack_t __user *, unsigned long);
651#endif
652 690
653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 691asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
654 struct compat_timespec __user *interval); 692 struct compat_timespec __user *interval);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c2182b53dace..0655570c67eb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2182,7 +2182,6 @@ extern struct sigqueue *sigqueue_alloc(void);
2182extern void sigqueue_free(struct sigqueue *); 2182extern void sigqueue_free(struct sigqueue *);
2183extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 2183extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
2184extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 2184extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
2185extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
2186 2185
2187static inline void restore_saved_sigmask(void) 2186static inline void restore_saved_sigmask(void)
2188{ 2187{
@@ -2228,6 +2227,17 @@ static inline int sas_ss_flags(unsigned long sp)
2228 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2227 : on_sig_stack(sp) ? SS_ONSTACK : 0);
2229} 2228}
2230 2229
2230static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
2231{
2232 if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp))
2233#ifdef CONFIG_STACK_GROWSUP
2234 return current->sas_ss_sp;
2235#else
2236 return current->sas_ss_sp + current->sas_ss_size;
2237#endif
2238 return sp;
2239}
2240
2231/* 2241/*
2232 * Routines for handling mm_structs 2242 * Routines for handling mm_structs
2233 */ 2243 */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 0a89ffc48466..a2dcb94ea49d 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -241,9 +241,6 @@ extern int do_send_sig_info(int sig, struct siginfo *info,
241 struct task_struct *p, bool group); 241 struct task_struct *p, bool group);
242extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 242extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
243extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 243extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
244extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
245 siginfo_t *info);
246extern long do_sigpending(void __user *, unsigned long);
247extern int do_sigtimedwait(const sigset_t *, siginfo_t *, 244extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
248 const struct timespec *); 245 const struct timespec *);
249extern int sigprocmask(int, sigset_t *, sigset_t *); 246extern int sigprocmask(int, sigset_t *, sigset_t *);
@@ -252,10 +249,59 @@ extern void __set_current_blocked(const sigset_t *);
252extern int show_unhandled_signals; 249extern int show_unhandled_signals;
253extern int sigsuspend(sigset_t *); 250extern int sigsuspend(sigset_t *);
254 251
252struct sigaction {
253#ifndef __ARCH_HAS_ODD_SIGACTION
254 __sighandler_t sa_handler;
255 unsigned long sa_flags;
256#else
257 unsigned long sa_flags;
258 __sighandler_t sa_handler;
259#endif
260#ifdef __ARCH_HAS_SA_RESTORER
261 __sigrestore_t sa_restorer;
262#endif
263 sigset_t sa_mask; /* mask last for extensibility */
264};
265
266struct k_sigaction {
267 struct sigaction sa;
268#ifdef __ARCH_HAS_KA_RESTORER
269 __sigrestore_t ka_restorer;
270#endif
271};
272
273#ifdef CONFIG_OLD_SIGACTION
274struct old_sigaction {
275 __sighandler_t sa_handler;
276 old_sigset_t sa_mask;
277 unsigned long sa_flags;
278 __sigrestore_t sa_restorer;
279};
280#endif
281
282struct ksignal {
283 struct k_sigaction ka;
284 siginfo_t info;
285 int sig;
286};
287
255extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 288extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
289extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
256extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); 290extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
257extern void exit_signals(struct task_struct *tsk); 291extern void exit_signals(struct task_struct *tsk);
258 292
293/*
294 * Eventually that'll replace get_signal_to_deliver(); macro for now,
295 * to avoid nastiness with include order.
296 */
297#define get_signal(ksig) \
298({ \
299 struct ksignal *p = (ksig); \
300 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
301 signal_pt_regs(), NULL);\
302 p->sig > 0; \
303})
304
259extern struct kmem_cache *sighand_cachep; 305extern struct kmem_cache *sighand_cachep;
260 306
261int unhandled_signal(struct task_struct *tsk, int sig); 307int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 45e2db270255..313a8e0a6553 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -68,11 +68,11 @@ struct sigaltstack;
68#include <linux/types.h> 68#include <linux/types.h>
69#include <linux/aio_abi.h> 69#include <linux/aio_abi.h>
70#include <linux/capability.h> 70#include <linux/capability.h>
71#include <linux/signal.h>
71#include <linux/list.h> 72#include <linux/list.h>
72#include <linux/bug.h> 73#include <linux/bug.h>
73#include <linux/sem.h> 74#include <linux/sem.h>
74#include <asm/siginfo.h> 75#include <asm/siginfo.h>
75#include <asm/signal.h>
76#include <linux/unistd.h> 76#include <linux/unistd.h>
77#include <linux/quota.h> 77#include <linux/quota.h>
78#include <linux/key.h> 78#include <linux/key.h>
@@ -300,10 +300,8 @@ asmlinkage long sys_personality(unsigned int personality);
300asmlinkage long sys_sigpending(old_sigset_t __user *set); 300asmlinkage long sys_sigpending(old_sigset_t __user *set);
301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
302 old_sigset_t __user *oset); 302 old_sigset_t __user *oset);
303#ifdef CONFIG_GENERIC_SIGALTSTACK
304asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss, 303asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
305 struct sigaltstack __user *uoss); 304 struct sigaltstack __user *uoss);
306#endif
307 305
308asmlinkage long sys_getitimer(int which, struct itimerval __user *value); 306asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
309asmlinkage long sys_setitimer(int which, 307asmlinkage long sys_setitimer(int which,
@@ -377,6 +375,27 @@ asmlinkage long sys_init_module(void __user *umod, unsigned long len,
377asmlinkage long sys_delete_module(const char __user *name_user, 375asmlinkage long sys_delete_module(const char __user *name_user,
378 unsigned int flags); 376 unsigned int flags);
379 377
378#ifdef CONFIG_OLD_SIGSUSPEND
379asmlinkage long sys_sigsuspend(old_sigset_t mask);
380#endif
381
382#ifdef CONFIG_OLD_SIGSUSPEND3
383asmlinkage long sys_sigsuspend(int unused1, int unused2, old_sigset_t mask);
384#endif
385
386asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
387
388#ifdef CONFIG_OLD_SIGACTION
389asmlinkage long sys_sigaction(int, const struct old_sigaction __user *,
390 struct old_sigaction __user *);
391#endif
392
393#ifndef CONFIG_ODD_RT_SIGACTION
394asmlinkage long sys_rt_sigaction(int,
395 const struct sigaction __user *,
396 struct sigaction __user *,
397 size_t);
398#endif
380asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set, 399asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
381 sigset_t __user *oset, size_t sigsetsize); 400 sigset_t __user *oset, size_t sigsetsize);
382asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); 401asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
index 6fae30fd16ab..9df61f1edb0f 100644
--- a/include/uapi/asm-generic/signal.h
+++ b/include/uapi/asm-generic/signal.h
@@ -93,6 +93,11 @@ typedef unsigned long old_sigset_t;
93 93
94#include <asm-generic/signal-defs.h> 94#include <asm-generic/signal-defs.h>
95 95
96#ifdef SA_RESTORER
97#define __ARCH_HAS_SA_RESTORER
98#endif
99
100#ifndef __KERNEL__
96struct sigaction { 101struct sigaction {
97 __sighandler_t sa_handler; 102 __sighandler_t sa_handler;
98 unsigned long sa_flags; 103 unsigned long sa_flags;
@@ -101,10 +106,7 @@ struct sigaction {
101#endif 106#endif
102 sigset_t sa_mask; /* mask last for extensibility */ 107 sigset_t sa_mask; /* mask last for extensibility */
103}; 108};
104 109#endif
105struct k_sigaction {
106 struct sigaction sa;
107};
108 110
109typedef struct sigaltstack { 111typedef struct sigaltstack {
110 void __user *ss_sp; 112 void __user *ss_sp;
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 2c531f478410..0cc74c4403e4 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -402,9 +402,9 @@ __SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
402#define __NR_rt_sigaction 134 402#define __NR_rt_sigaction 134
403__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction) 403__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
404#define __NR_rt_sigprocmask 135 404#define __NR_rt_sigprocmask 135
405__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) 405__SC_COMP(__NR_rt_sigprocmask, sys_rt_sigprocmask, compat_sys_rt_sigprocmask)
406#define __NR_rt_sigpending 136 406#define __NR_rt_sigpending 136
407__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) 407__SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending)
408#define __NR_rt_sigtimedwait 137 408#define __NR_rt_sigtimedwait 137
409__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \ 409__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
410 compat_sys_rt_sigtimedwait) 410 compat_sys_rt_sigtimedwait)
diff --git a/kernel/compat.c b/kernel/compat.c
index f4bddb900186..19971d8c7299 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -290,8 +290,8 @@ static inline long put_compat_itimerval(struct compat_itimerval __user *o,
290 __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); 290 __put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));
291} 291}
292 292
293asmlinkage long compat_sys_getitimer(int which, 293COMPAT_SYSCALL_DEFINE2(getitimer, int, which,
294 struct compat_itimerval __user *it) 294 struct compat_itimerval __user *, it)
295{ 295{
296 struct itimerval kit; 296 struct itimerval kit;
297 int error; 297 int error;
@@ -302,9 +302,9 @@ asmlinkage long compat_sys_getitimer(int which,
302 return error; 302 return error;
303} 303}
304 304
305asmlinkage long compat_sys_setitimer(int which, 305COMPAT_SYSCALL_DEFINE3(setitimer, int, which,
306 struct compat_itimerval __user *in, 306 struct compat_itimerval __user *, in,
307 struct compat_itimerval __user *out) 307 struct compat_itimerval __user *, out)
308{ 308{
309 struct itimerval kin, kout; 309 struct itimerval kin, kout;
310 int error; 310 int error;
@@ -381,9 +381,9 @@ static inline void compat_sig_setmask(sigset_t *blocked, compat_sigset_word set)
381 memcpy(blocked->sig, &set, sizeof(set)); 381 memcpy(blocked->sig, &set, sizeof(set));
382} 382}
383 383
384asmlinkage long compat_sys_sigprocmask(int how, 384COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how,
385 compat_old_sigset_t __user *nset, 385 compat_old_sigset_t __user *, nset,
386 compat_old_sigset_t __user *oset) 386 compat_old_sigset_t __user *, oset)
387{ 387{
388 old_sigset_t old_set, new_set; 388 old_sigset_t old_set, new_set;
389 sigset_t new_blocked; 389 sigset_t new_blocked;
@@ -971,7 +971,7 @@ long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
971} 971}
972 972
973void 973void
974sigset_from_compat (sigset_t *set, compat_sigset_t *compat) 974sigset_from_compat(sigset_t *set, const compat_sigset_t *compat)
975{ 975{
976 switch (_NSIG_WORDS) { 976 switch (_NSIG_WORDS) {
977 case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 ); 977 case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 );
@@ -982,10 +982,20 @@ sigset_from_compat (sigset_t *set, compat_sigset_t *compat)
982} 982}
983EXPORT_SYMBOL_GPL(sigset_from_compat); 983EXPORT_SYMBOL_GPL(sigset_from_compat);
984 984
985asmlinkage long 985void
986compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, 986sigset_to_compat(compat_sigset_t *compat, const sigset_t *set)
987 struct compat_siginfo __user *uinfo, 987{
988 struct compat_timespec __user *uts, compat_size_t sigsetsize) 988 switch (_NSIG_WORDS) {
989 case 4: compat->sig[7] = (set->sig[3] >> 32); compat->sig[6] = set->sig[3];
990 case 3: compat->sig[5] = (set->sig[2] >> 32); compat->sig[4] = set->sig[2];
991 case 2: compat->sig[3] = (set->sig[1] >> 32); compat->sig[2] = set->sig[1];
992 case 1: compat->sig[1] = (set->sig[0] >> 32); compat->sig[0] = set->sig[0];
993 }
994}
995
996COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
997 struct compat_siginfo __user *, uinfo,
998 struct compat_timespec __user *, uts, compat_size_t, sigsetsize)
989{ 999{
990 compat_sigset_t s32; 1000 compat_sigset_t s32;
991 sigset_t s; 1001 sigset_t s;
@@ -1013,18 +1023,6 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
1013 } 1023 }
1014 1024
1015 return ret; 1025 return ret;
1016
1017}
1018
1019asmlinkage long
1020compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
1021 struct compat_siginfo __user *uinfo)
1022{
1023 siginfo_t info;
1024
1025 if (copy_siginfo_from_user32(&info, uinfo))
1026 return -EFAULT;
1027 return do_rt_tgsigqueueinfo(tgid, pid, sig, &info);
1028} 1026}
1029 1027
1030#ifdef __ARCH_WANT_COMPAT_SYS_TIME 1028#ifdef __ARCH_WANT_COMPAT_SYS_TIME
@@ -1067,23 +1065,6 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr)
1067 1065
1068#endif /* __ARCH_WANT_COMPAT_SYS_TIME */ 1066#endif /* __ARCH_WANT_COMPAT_SYS_TIME */
1069 1067
1070#ifdef __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
1071asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat_size_t sigsetsize)
1072{
1073 sigset_t newset;
1074 compat_sigset_t newset32;
1075
1076 /* XXX: Don't preclude handling different sized sigset_t's. */
1077 if (sigsetsize != sizeof(sigset_t))
1078 return -EINVAL;
1079
1080 if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t)))
1081 return -EFAULT;
1082 sigset_from_compat(&newset, &newset32);
1083 return sigsuspend(&newset);
1084}
1085#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
1086
1087asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) 1068asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
1088{ 1069{
1089 struct timex txc; 1070 struct timex txc;
@@ -1222,9 +1203,9 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
1222 return 0; 1203 return 0;
1223} 1204}
1224 1205
1225#ifdef __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL 1206COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval,
1226asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 1207 compat_pid_t, pid,
1227 struct compat_timespec __user *interval) 1208 struct compat_timespec __user *, interval)
1228{ 1209{
1229 struct timespec t; 1210 struct timespec t;
1230 int ret; 1211 int ret;
@@ -1237,7 +1218,6 @@ asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
1237 return -EFAULT; 1218 return -EFAULT;
1238 return ret; 1219 return ret;
1239} 1220}
1240#endif /* __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL */
1241 1221
1242/* 1222/*
1243 * Allocate user-space memory for the duration of a single system call, 1223 * Allocate user-space memory for the duration of a single system call,
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index a9642d528630..f9f44fd4d34d 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -11,6 +11,7 @@
11#include <linux/nsproxy.h> 11#include <linux/nsproxy.h>
12#include <linux/futex.h> 12#include <linux/futex.h>
13#include <linux/ptrace.h> 13#include <linux/ptrace.h>
14#include <linux/syscalls.h>
14 15
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16 17
@@ -116,9 +117,9 @@ void compat_exit_robust_list(struct task_struct *curr)
116 } 117 }
117} 118}
118 119
119asmlinkage long 120COMPAT_SYSCALL_DEFINE2(set_robust_list,
120compat_sys_set_robust_list(struct compat_robust_list_head __user *head, 121 struct compat_robust_list_head __user *, head,
121 compat_size_t len) 122 compat_size_t, len)
122{ 123{
123 if (!futex_cmpxchg_enabled) 124 if (!futex_cmpxchg_enabled)
124 return -ENOSYS; 125 return -ENOSYS;
@@ -131,9 +132,9 @@ compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
131 return 0; 132 return 0;
132} 133}
133 134
134asmlinkage long 135COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid,
135compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, 136 compat_uptr_t __user *, head_ptr,
136 compat_size_t __user *len_ptr) 137 compat_size_t __user *, len_ptr)
137{ 138{
138 struct compat_robust_list_head __user *head; 139 struct compat_robust_list_head __user *head;
139 unsigned long ret; 140 unsigned long ret;
@@ -170,9 +171,9 @@ err_unlock:
170 return ret; 171 return ret;
171} 172}
172 173
173asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, 174COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
174 struct compat_timespec __user *utime, u32 __user *uaddr2, 175 struct compat_timespec __user *, utime, u32 __user *, uaddr2,
175 u32 val3) 176 u32, val3)
176{ 177{
177 struct timespec ts; 178 struct timespec ts;
178 ktime_t t, *tp = NULL; 179 ktime_t t, *tp = NULL;
diff --git a/kernel/signal.c b/kernel/signal.c
index 7f82adbad480..2a7ae2963185 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2399,6 +2399,15 @@ void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka,
2399 tracehook_signal_handler(sig, info, ka, regs, stepping); 2399 tracehook_signal_handler(sig, info, ka, regs, stepping);
2400} 2400}
2401 2401
2402void signal_setup_done(int failed, struct ksignal *ksig, int stepping)
2403{
2404 if (failed)
2405 force_sigsegv(ksig->sig, current);
2406 else
2407 signal_delivered(ksig->sig, &ksig->info, &ksig->ka,
2408 signal_pt_regs(), stepping);
2409}
2410
2402/* 2411/*
2403 * It could be that complete_signal() picked us to notify about the 2412 * It could be that complete_signal() picked us to notify about the
2404 * group-wide signal. Other threads should be notified now to take 2413 * group-wide signal. Other threads should be notified now to take
@@ -2616,28 +2625,58 @@ SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, nset,
2616 return 0; 2625 return 0;
2617} 2626}
2618 2627
2619long do_sigpending(void __user *set, unsigned long sigsetsize) 2628#ifdef CONFIG_COMPAT
2629COMPAT_SYSCALL_DEFINE4(rt_sigprocmask, int, how, compat_sigset_t __user *, nset,
2630 compat_sigset_t __user *, oset, compat_size_t, sigsetsize)
2620{ 2631{
2621 long error = -EINVAL; 2632#ifdef __BIG_ENDIAN
2622 sigset_t pending; 2633 sigset_t old_set = current->blocked;
2634
2635 /* XXX: Don't preclude handling different sized sigset_t's. */
2636 if (sigsetsize != sizeof(sigset_t))
2637 return -EINVAL;
2638
2639 if (nset) {
2640 compat_sigset_t new32;
2641 sigset_t new_set;
2642 int error;
2643 if (copy_from_user(&new32, nset, sizeof(compat_sigset_t)))
2644 return -EFAULT;
2645
2646 sigset_from_compat(&new_set, &new32);
2647 sigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP));
2648
2649 error = sigprocmask(how, &new_set, NULL);
2650 if (error)
2651 return error;
2652 }
2653 if (oset) {
2654 compat_sigset_t old32;
2655 sigset_to_compat(&old32, &old_set);
2656 if (copy_to_user(oset, &old_set, sizeof(sigset_t)))
2657 return -EFAULT;
2658 }
2659 return 0;
2660#else
2661 return sys_rt_sigprocmask(how, (sigset_t __user *)nset,
2662 (sigset_t __user *)oset, sigsetsize);
2663#endif
2664}
2665#endif
2623 2666
2667static int do_sigpending(void *set, unsigned long sigsetsize)
2668{
2624 if (sigsetsize > sizeof(sigset_t)) 2669 if (sigsetsize > sizeof(sigset_t))
2625 goto out; 2670 return -EINVAL;
2626 2671
2627 spin_lock_irq(&current->sighand->siglock); 2672 spin_lock_irq(&current->sighand->siglock);
2628 sigorsets(&pending, &current->pending.signal, 2673 sigorsets(set, &current->pending.signal,
2629 &current->signal->shared_pending.signal); 2674 &current->signal->shared_pending.signal);
2630 spin_unlock_irq(&current->sighand->siglock); 2675 spin_unlock_irq(&current->sighand->siglock);
2631 2676
2632 /* Outside the lock because only this thread touches it. */ 2677 /* Outside the lock because only this thread touches it. */
2633 sigandsets(&pending, &current->blocked, &pending); 2678 sigandsets(set, &current->blocked, set);
2634 2679 return 0;
2635 error = -EFAULT;
2636 if (!copy_to_user(set, &pending, sigsetsize))
2637 error = 0;
2638
2639out:
2640 return error;
2641} 2680}
2642 2681
2643/** 2682/**
@@ -2646,10 +2685,35 @@ out:
2646 * @set: stores pending signals 2685 * @set: stores pending signals
2647 * @sigsetsize: size of sigset_t type or larger 2686 * @sigsetsize: size of sigset_t type or larger
2648 */ 2687 */
2649SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize) 2688SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize)
2650{ 2689{
2651 return do_sigpending(set, sigsetsize); 2690 sigset_t set;
2691 int err = do_sigpending(&set, sigsetsize);
2692 if (!err && copy_to_user(uset, &set, sigsetsize))
2693 err = -EFAULT;
2694 return err;
2695}
2696
2697#ifdef CONFIG_COMPAT
2698COMPAT_SYSCALL_DEFINE2(rt_sigpending, compat_sigset_t __user *, uset,
2699 compat_size_t, sigsetsize)
2700{
2701#ifdef __BIG_ENDIAN
2702 sigset_t set;
2703 int err = do_sigpending(&set, sigsetsize);
2704 if (!err) {
2705 compat_sigset_t set32;
2706 sigset_to_compat(&set32, &set);
2707 /* we can get here only if sigsetsize <= sizeof(set) */
2708 if (copy_to_user(uset, &set32, sigsetsize))
2709 err = -EFAULT;
2710 }
2711 return err;
2712#else
2713 return sys_rt_sigpending((sigset_t __user *)uset, sigsetsize);
2714#endif
2652} 2715}
2716#endif
2653 2717
2654#ifndef HAVE_ARCH_COPY_SIGINFO_TO_USER 2718#ifndef HAVE_ARCH_COPY_SIGINFO_TO_USER
2655 2719
@@ -2927,6 +2991,22 @@ SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
2927 return do_tkill(0, pid, sig); 2991 return do_tkill(0, pid, sig);
2928} 2992}
2929 2993
2994static int do_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t *info)
2995{
2996 /* Not even root can pretend to send signals from the kernel.
2997 * Nor can they impersonate a kill()/tgkill(), which adds source info.
2998 */
2999 if (info->si_code >= 0 || info->si_code == SI_TKILL) {
3000 /* We used to allow any < 0 si_code */
3001 WARN_ON_ONCE(info->si_code < 0);
3002 return -EPERM;
3003 }
3004 info->si_signo = sig;
3005
3006 /* POSIX.1b doesn't mention process groups. */
3007 return kill_proc_info(sig, info, pid);
3008}
3009
2930/** 3010/**
2931 * sys_rt_sigqueueinfo - send signal information to a signal 3011 * sys_rt_sigqueueinfo - send signal information to a signal
2932 * @pid: the PID of the thread 3012 * @pid: the PID of the thread
@@ -2937,25 +3017,26 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
2937 siginfo_t __user *, uinfo) 3017 siginfo_t __user *, uinfo)
2938{ 3018{
2939 siginfo_t info; 3019 siginfo_t info;
2940
2941 if (copy_from_user(&info, uinfo, sizeof(siginfo_t))) 3020 if (copy_from_user(&info, uinfo, sizeof(siginfo_t)))
2942 return -EFAULT; 3021 return -EFAULT;
3022 return do_rt_sigqueueinfo(pid, sig, &info);
3023}
2943 3024
2944 /* Not even root can pretend to send signals from the kernel. 3025#ifdef CONFIG_COMPAT
2945 * Nor can they impersonate a kill()/tgkill(), which adds source info. 3026COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo,
2946 */ 3027 compat_pid_t, pid,
2947 if (info.si_code >= 0 || info.si_code == SI_TKILL) { 3028 int, sig,
2948 /* We used to allow any < 0 si_code */ 3029 struct compat_siginfo __user *, uinfo)
2949 WARN_ON_ONCE(info.si_code < 0); 3030{
2950 return -EPERM; 3031 siginfo_t info;
2951 } 3032 int ret = copy_siginfo_from_user32(&info, uinfo);
2952 info.si_signo = sig; 3033 if (unlikely(ret))
2953 3034 return ret;
2954 /* POSIX.1b doesn't mention process groups. */ 3035 return do_rt_sigqueueinfo(pid, sig, &info);
2955 return kill_proc_info(sig, &info, pid);
2956} 3036}
3037#endif
2957 3038
2958long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) 3039static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
2959{ 3040{
2960 /* This is only valid for single tasks */ 3041 /* This is only valid for single tasks */
2961 if (pid <= 0 || tgid <= 0) 3042 if (pid <= 0 || tgid <= 0)
@@ -2985,6 +3066,21 @@ SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig,
2985 return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); 3066 return do_rt_tgsigqueueinfo(tgid, pid, sig, &info);
2986} 3067}
2987 3068
3069#ifdef CONFIG_COMPAT
3070COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo,
3071 compat_pid_t, tgid,
3072 compat_pid_t, pid,
3073 int, sig,
3074 struct compat_siginfo __user *, uinfo)
3075{
3076 siginfo_t info;
3077
3078 if (copy_siginfo_from_user32(&info, uinfo))
3079 return -EFAULT;
3080 return do_rt_tgsigqueueinfo(tgid, pid, sig, &info);
3081}
3082#endif
3083
2988int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) 3084int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2989{ 3085{
2990 struct task_struct *t = current; 3086 struct task_struct *t = current;
@@ -3030,7 +3126,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
3030 return 0; 3126 return 0;
3031} 3127}
3032 3128
3033int 3129static int
3034do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long sp) 3130do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)
3035{ 3131{
3036 stack_t oss; 3132 stack_t oss;
@@ -3095,12 +3191,10 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
3095out: 3191out:
3096 return error; 3192 return error;
3097} 3193}
3098#ifdef CONFIG_GENERIC_SIGALTSTACK
3099SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss) 3194SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss)
3100{ 3195{
3101 return do_sigaltstack(uss, uoss, current_user_stack_pointer()); 3196 return do_sigaltstack(uss, uoss, current_user_stack_pointer());
3102} 3197}
3103#endif
3104 3198
3105int restore_altstack(const stack_t __user *uss) 3199int restore_altstack(const stack_t __user *uss)
3106{ 3200{
@@ -3118,7 +3212,6 @@ int __save_altstack(stack_t __user *uss, unsigned long sp)
3118} 3212}
3119 3213
3120#ifdef CONFIG_COMPAT 3214#ifdef CONFIG_COMPAT
3121#ifdef CONFIG_GENERIC_SIGALTSTACK
3122COMPAT_SYSCALL_DEFINE2(sigaltstack, 3215COMPAT_SYSCALL_DEFINE2(sigaltstack,
3123 const compat_stack_t __user *, uss_ptr, 3216 const compat_stack_t __user *, uss_ptr,
3124 compat_stack_t __user *, uoss_ptr) 3217 compat_stack_t __user *, uoss_ptr)
@@ -3168,7 +3261,6 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
3168 __put_user(t->sas_ss_size, &uss->ss_size); 3261 __put_user(t->sas_ss_size, &uss->ss_size);
3169} 3262}
3170#endif 3263#endif
3171#endif
3172 3264
3173#ifdef __ARCH_WANT_SYS_SIGPENDING 3265#ifdef __ARCH_WANT_SYS_SIGPENDING
3174 3266
@@ -3178,7 +3270,7 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
3178 */ 3270 */
3179SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set) 3271SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
3180{ 3272{
3181 return do_sigpending(set, sizeof(*set)); 3273 return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t));
3182} 3274}
3183 3275
3184#endif 3276#endif
@@ -3234,7 +3326,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
3234} 3326}
3235#endif /* __ARCH_WANT_SYS_SIGPROCMASK */ 3327#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
3236 3328
3237#ifdef __ARCH_WANT_SYS_RT_SIGACTION 3329#ifndef CONFIG_ODD_RT_SIGACTION
3238/** 3330/**
3239 * sys_rt_sigaction - alter an action taken by a process 3331 * sys_rt_sigaction - alter an action taken by a process
3240 * @sig: signal to be sent 3332 * @sig: signal to be sent
@@ -3268,7 +3360,132 @@ SYSCALL_DEFINE4(rt_sigaction, int, sig,
3268out: 3360out:
3269 return ret; 3361 return ret;
3270} 3362}
3271#endif /* __ARCH_WANT_SYS_RT_SIGACTION */ 3363#ifdef CONFIG_COMPAT
3364COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
3365 const struct compat_sigaction __user *, act,
3366 struct compat_sigaction __user *, oact,
3367 compat_size_t, sigsetsize)
3368{
3369 struct k_sigaction new_ka, old_ka;
3370 compat_sigset_t mask;
3371#ifdef __ARCH_HAS_SA_RESTORER
3372 compat_uptr_t restorer;
3373#endif
3374 int ret;
3375
3376 /* XXX: Don't preclude handling different sized sigset_t's. */
3377 if (sigsetsize != sizeof(compat_sigset_t))
3378 return -EINVAL;
3379
3380 if (act) {
3381 compat_uptr_t handler;
3382 ret = get_user(handler, &act->sa_handler);
3383 new_ka.sa.sa_handler = compat_ptr(handler);
3384#ifdef __ARCH_HAS_SA_RESTORER
3385 ret |= get_user(restorer, &act->sa_restorer);
3386 new_ka.sa.sa_restorer = compat_ptr(restorer);
3387#endif
3388 ret |= copy_from_user(&mask, &act->sa_mask, sizeof(mask));
3389 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
3390 if (ret)
3391 return -EFAULT;
3392 sigset_from_compat(&new_ka.sa.sa_mask, &mask);
3393 }
3394
3395 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
3396 if (!ret && oact) {
3397 sigset_to_compat(&mask, &old_ka.sa.sa_mask);
3398 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler),
3399 &oact->sa_handler);
3400 ret |= copy_to_user(&oact->sa_mask, &mask, sizeof(mask));
3401 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
3402#ifdef __ARCH_HAS_SA_RESTORER
3403 ret |= put_user(ptr_to_compat(old_ka.sa.sa_restorer),
3404 &oact->sa_restorer);
3405#endif
3406 }
3407 return ret;
3408}
3409#endif
3410#endif /* !CONFIG_ODD_RT_SIGACTION */
3411
3412#ifdef CONFIG_OLD_SIGACTION
3413SYSCALL_DEFINE3(sigaction, int, sig,
3414 const struct old_sigaction __user *, act,
3415 struct old_sigaction __user *, oact)
3416{
3417 struct k_sigaction new_ka, old_ka;
3418 int ret;
3419
3420 if (act) {
3421 old_sigset_t mask;
3422 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
3423 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
3424 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
3425 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
3426 __get_user(mask, &act->sa_mask))
3427 return -EFAULT;
3428#ifdef __ARCH_HAS_KA_RESTORER
3429 new_ka.ka_restorer = NULL;
3430#endif
3431 siginitset(&new_ka.sa.sa_mask, mask);
3432 }
3433
3434 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
3435
3436 if (!ret && oact) {
3437 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
3438 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
3439 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
3440 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
3441 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
3442 return -EFAULT;
3443 }
3444
3445 return ret;
3446}
3447#endif
3448#ifdef CONFIG_COMPAT_OLD_SIGACTION
3449COMPAT_SYSCALL_DEFINE3(sigaction, int, sig,
3450 const struct compat_old_sigaction __user *, act,
3451 struct compat_old_sigaction __user *, oact)
3452{
3453 struct k_sigaction new_ka, old_ka;
3454 int ret;
3455 compat_old_sigset_t mask;
3456 compat_uptr_t handler, restorer;
3457
3458 if (act) {
3459 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
3460 __get_user(handler, &act->sa_handler) ||
3461 __get_user(restorer, &act->sa_restorer) ||
3462 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
3463 __get_user(mask, &act->sa_mask))
3464 return -EFAULT;
3465
3466#ifdef __ARCH_HAS_KA_RESTORER
3467 new_ka.ka_restorer = NULL;
3468#endif
3469 new_ka.sa.sa_handler = compat_ptr(handler);
3470 new_ka.sa.sa_restorer = compat_ptr(restorer);
3471 siginitset(&new_ka.sa.sa_mask, mask);
3472 }
3473
3474 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
3475
3476 if (!ret && oact) {
3477 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
3478 __put_user(ptr_to_compat(old_ka.sa.sa_handler),
3479 &oact->sa_handler) ||
3480 __put_user(ptr_to_compat(old_ka.sa.sa_restorer),
3481 &oact->sa_restorer) ||
3482 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
3483 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
3484 return -EFAULT;
3485 }
3486 return ret;
3487}
3488#endif
3272 3489
3273#ifdef __ARCH_WANT_SYS_SGETMASK 3490#ifdef __ARCH_WANT_SYS_SGETMASK
3274 3491
@@ -3336,7 +3553,6 @@ int sigsuspend(sigset_t *set)
3336 return -ERESTARTNOHAND; 3553 return -ERESTARTNOHAND;
3337} 3554}
3338 3555
3339#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND
3340/** 3556/**
3341 * sys_rt_sigsuspend - replace the signal mask for a value with the 3557 * sys_rt_sigsuspend - replace the signal mask for a value with the
3342 * @unewset value until a signal is received 3558 * @unewset value until a signal is received
@@ -3355,7 +3571,45 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
3355 return -EFAULT; 3571 return -EFAULT;
3356 return sigsuspend(&newset); 3572 return sigsuspend(&newset);
3357} 3573}
3358#endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ 3574
3575#ifdef CONFIG_COMPAT
3576COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_size_t, sigsetsize)
3577{
3578#ifdef __BIG_ENDIAN
3579 sigset_t newset;
3580 compat_sigset_t newset32;
3581
3582 /* XXX: Don't preclude handling different sized sigset_t's. */
3583 if (sigsetsize != sizeof(sigset_t))
3584 return -EINVAL;
3585
3586 if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t)))
3587 return -EFAULT;
3588 sigset_from_compat(&newset, &newset32);
3589 return sigsuspend(&newset);
3590#else
3591 /* on little-endian bitmaps don't care about granularity */
3592 return sys_rt_sigsuspend((sigset_t __user *)unewset, sigsetsize);
3593#endif
3594}
3595#endif
3596
3597#ifdef CONFIG_OLD_SIGSUSPEND
3598SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)
3599{
3600 sigset_t blocked;
3601 siginitset(&blocked, mask);
3602 return sigsuspend(&blocked);
3603}
3604#endif
3605#ifdef CONFIG_OLD_SIGSUSPEND3
3606SYSCALL_DEFINE3(sigsuspend, int, unused1, int, unused2, old_sigset_t, mask)
3607{
3608 sigset_t blocked;
3609 siginitset(&blocked, mask);
3610 return sigsuspend(&blocked);
3611}
3612#endif
3359 3613
3360__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma) 3614__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma)
3361{ 3615{