aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/kernel/process.c1
-rw-r--r--arch/alpha/kernel/signal.c10
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/include/asm/signal.h7
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/entry-common.S5
-rw-r--r--arch/arm/kernel/signal.c52
-rw-r--r--arch/arm64/Kconfig7
-rw-r--r--arch/arm64/include/asm/syscalls.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/Kconfig1
-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/Kconfig1
-rw-r--r--arch/blackfin/kernel/signal.c12
-rw-r--r--arch/c6x/Kconfig1
-rw-r--r--arch/c6x/kernel/entry.S12
-rw-r--r--arch/cris/Kconfig3
-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.h7
-rw-r--r--arch/frv/Kconfig3
-rw-r--r--arch/frv/include/asm/signal.h7
-rw-r--r--arch/frv/kernel/signal.c55
-rw-r--r--arch/h8300/Kconfig3
-rw-r--r--arch/h8300/include/asm/signal.h7
-rw-r--r--arch/h8300/kernel/signal.c72
-rw-r--r--arch/h8300/kernel/syscalls.S15
-rw-r--r--arch/hexagon/Kconfig1
-rw-r--r--arch/hexagon/kernel/signal.c16
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/kernel/signal.c19
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/m32r/kernel/signal.c16
-rw-r--r--arch/m68k/Kconfig3
-rw-r--r--arch/m68k/include/asm/signal.h7
-rw-r--r--arch/m68k/kernel/signal.c59
-rw-r--r--arch/microblaze/Kconfig1
-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/Kconfig6
-rw-r--r--arch/mips/include/asm/compat.h8
-rw-r--r--arch/mips/include/asm/sim.h24
-rw-r--r--arch/mips/include/asm/unistd.h2
-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.c44
-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/Kconfig3
-rw-r--r--arch/mn10300/include/asm/signal.h7
-rw-r--r--arch/mn10300/kernel/signal.c60
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/openrisc/kernel/entry.S4
-rw-r--r--arch/openrisc/kernel/signal.c15
-rw-r--r--arch/parisc/Kconfig5
-rw-r--r--arch/parisc/kernel/entry.S38
-rw-r--r--arch/parisc/kernel/signal.c19
-rw-r--r--arch/parisc/kernel/signal32.c142
-rw-r--r--arch/parisc/kernel/signal32.h23
-rw-r--r--arch/parisc/kernel/sys32.h12
-rw-r--r--arch/parisc/kernel/sys_parisc32.c12
-rw-r--r--arch/parisc/kernel/syscall_table.S10
-rw-r--r--arch/powerpc/Kconfig8
-rw-r--r--arch/powerpc/include/asm/syscalls.h9
-rw-r--r--arch/powerpc/include/asm/systbl.h63
-rw-r--r--arch/powerpc/include/uapi/asm/signal.h2
-rw-r--r--arch/powerpc/kernel/ppc32.h26
-rw-r--r--arch/powerpc/kernel/signal.c7
-rw-r--r--arch/powerpc/kernel/signal_32.c252
-rw-r--r--arch/powerpc/kernel/signal_64.c11
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c301
-rw-r--r--arch/s390/Kconfig8
-rw-r--r--arch/s390/include/asm/signal.h7
-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/Kconfig1
-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/Kconfig3
-rw-r--r--arch/sh/include/asm/syscalls_32.h6
-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/Kconfig8
-rw-r--r--arch/sparc/include/asm/compat_signal.h6
-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.c48
-rw-r--r--arch/sparc/kernel/signal_32.c29
-rw-r--r--arch/sparc/kernel/signal_64.c24
-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.c37
-rw-r--r--arch/sparc/kernel/syscalls.S6
-rw-r--r--arch/sparc/kernel/systbls.h2
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S84
-rw-r--r--arch/um/kernel/signal.c10
-rw-r--r--arch/unicore32/Kconfig1
-rw-r--r--arch/unicore32/kernel/entry.S5
-rw-r--r--arch/unicore32/kernel/signal.c12
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/ia32/ia32_signal.c13
-rw-r--r--arch/x86/ia32/ia32entry.S12
-rw-r--r--arch/x86/ia32/sys_ia32.c171
-rw-r--r--arch/x86/include/asm/ia32.h15
-rw-r--r--arch/x86/include/asm/signal.h9
-rw-r--r--arch/x86/include/asm/sys_ia32.h16
-rw-r--r--arch/x86/include/asm/syscalls.h13
-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.c67
-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/Kconfig2
-rw-r--r--arch/x86/um/Makefile4
-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/Kconfig1
-rw-r--r--arch/xtensa/include/asm/syscall.h1
-rw-r--r--arch/xtensa/include/uapi/asm/unistd.h2
-rw-r--r--arch/xtensa/kernel/signal.c18
-rw-r--r--kernel/signal.c2
147 files changed, 486 insertions, 3806 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 8696c03a9d73..15740cf29bd4 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -24,6 +24,7 @@ config ALPHA
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select GENERIC_SIGALTSTACK 25 select GENERIC_SIGALTSTACK
26 select ODD_RT_SIGACTION 26 select ODD_RT_SIGACTION
27 select OLD_SIGSUSPEND
27 help 28 help
28 The Alpha is a 64-bit general-purpose processor designed and 29 The Alpha is a 64-bit general-purpose processor designed and
29 marketed by the Digital Equipment Corporation of blessed memory, 30 marketed by the Digital Equipment Corporation of blessed memory,
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..b5f385055244 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
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 67874b82a4ed..db3152d6dd88 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -56,6 +56,9 @@ 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 GENERIC_SIGALTSTACK
60 select OLD_SIGSUSPEND3
61 select OLD_SIGACTION
59 help 62 help
60 The ARM series is a line of low-power-consumption RISC chip designs 63 The ARM series is a line of low-power-consumption RISC chip designs
61 licensed by ARM Ltd and targeted at embedded applications and 64 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 a5076b9bd463..c0eb412aff04 100644
--- a/arch/arm/include/asm/signal.h
+++ b/arch/arm/include/asm/signal.h
@@ -16,13 +16,6 @@ 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 {
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 __sigrestore_t sa_restorer;
24};
25
26#define __ARCH_HAS_SA_RESTORER 19#define __ARCH_HAS_SA_RESTORER
27 20
28#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
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..07429a23c720 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;
@@ -486,7 +444,6 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
486 sigset_t *set, struct pt_regs *regs) 444 sigset_t *set, struct pt_regs *regs)
487{ 445{
488 struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame)); 446 struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
489 stack_t stack;
490 int err = 0; 447 int err = 0;
491 448
492 if (!frame) 449 if (!frame)
@@ -497,12 +454,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
497 __put_user_error(0, &frame->sig.uc.uc_flags, err); 454 __put_user_error(0, &frame->sig.uc.uc_flags, err);
498 __put_user_error(NULL, &frame->sig.uc.uc_link, err); 455 __put_user_error(NULL, &frame->sig.uc.uc_link, err);
499 456
500 memset(&stack, 0, sizeof(stack)); 457 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); 458 err |= setup_sigframe(&frame->sig, regs, set);
507 if (err == 0) 459 if (err == 0)
508 err = setup_return(regs, ka, frame->sig.retcode, frame, usig); 460 err = setup_return(regs, ka, frame->sig.retcode, frame, usig);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index f8f362aafee9..1f27c58f44ad 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -6,10 +6,15 @@ config ARM64
6 select CLONE_BACKWARDS 6 select CLONE_BACKWARDS
7 select COMMON_CLK 7 select COMMON_CLK
8 select GENERIC_CLOCKEVENTS 8 select GENERIC_CLOCKEVENTS
9 select GENERIC_COMPAT_RT_SIGACTION
10 select GENERIC_COMPAT_RT_SIGPENDING
11 select GENERIC_COMPAT_RT_SIGPROCMASK
12 select GENERIC_COMPAT_RT_SIGQUEUEINFO
9 select GENERIC_HARDIRQS_NO_DEPRECATED 13 select GENERIC_HARDIRQS_NO_DEPRECATED
10 select GENERIC_IOMAP 14 select GENERIC_IOMAP
11 select GENERIC_IRQ_PROBE 15 select GENERIC_IRQ_PROBE
12 select GENERIC_IRQ_SHOW 16 select GENERIC_IRQ_SHOW
17 select GENERIC_SIGALTSTACK
13 select GENERIC_SMP_IDLE_THREAD 18 select GENERIC_SMP_IDLE_THREAD
14 select GENERIC_TIME_VSYSCALL 19 select GENERIC_TIME_VSYSCALL
15 select HARDIRQS_SW_RESEND 20 select HARDIRQS_SW_RESEND
@@ -204,6 +209,8 @@ config COMPAT
204 depends on !ARM64_64K_PAGES 209 depends on !ARM64_64K_PAGES
205 select COMPAT_BINFMT_ELF 210 select COMPAT_BINFMT_ELF
206 select HAVE_UID16 211 select HAVE_UID16
212 select OLD_SIGSUSPEND3
213 select COMPAT_OLD_SIGACTION
207 help 214 help
208 This option enables support for a 32-bit EL0 running under a 64-bit 215 This option enables support for a 32-bit EL0 running under a 64-bit
209 kernel at EL1. AArch32-specific components such as system calls, 216 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/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 a4db3d22aac4..92ada01f4cd8 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(NULL, &frame->sig.uc.uc_link, err); 563 __put_user_error(NULL, &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/Kconfig b/arch/avr32/Kconfig
index 2ae6591b3a55..e888b72b6e10 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -17,6 +17,7 @@ config AVR32
17 select GENERIC_CLOCKEVENTS 17 select GENERIC_CLOCKEVENTS
18 select HAVE_MOD_ARCH_SPECIFIC 18 select HAVE_MOD_ARCH_SPECIFIC
19 select MODULES_USE_ELF_RELA 19 select MODULES_USE_ELF_RELA
20 select GENERIC_SIGALTSTACK
20 help 21 help
21 AVR32 is a high-performance 32-bit RISC microprocessor core, 22 AVR32 is a high-performance 32-bit RISC microprocessor core,
22 designed for cost-sensitive embedded applications, with particular 23 designed for cost-sensitive embedded applications, with particular
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/Kconfig b/arch/blackfin/Kconfig
index b6f3ad5441c5..a8a9ca7d40f3 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -45,6 +45,7 @@ config BLACKFIN
45 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 45 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
46 select HAVE_MOD_ARCH_SPECIFIC 46 select HAVE_MOD_ARCH_SPECIFIC
47 select MODULES_USE_ELF_RELA 47 select MODULES_USE_ELF_RELA
48 select GENERIC_SIGALTSTACK
48 49
49config GENERIC_CSUM 50config GENERIC_CSUM
50 def_bool y 51 def_bool y
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/Kconfig b/arch/c6x/Kconfig
index f6a3648f5ec3..12d97b7ef0dc 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -18,6 +18,7 @@ config C6X
18 select OF_EARLY_FLATTREE 18 select OF_EARLY_FLATTREE
19 select GENERIC_CLOCKEVENTS 19 select GENERIC_CLOCKEVENTS
20 select MODULES_USE_ELF_RELA 20 select MODULES_USE_ELF_RELA
21 select GENERIC_SIGALTSTACK
21 22
22config MMU 23config MMU
23 def_bool n 24 def_bool n
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..c2a1d0a8924c 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -50,6 +50,9 @@ 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 GENERIC_SIGALTSTACK
54 select OLD_SIGSUSPEND
55 select OLD_SIGACTION
53 56
54config HZ 57config HZ
55 int 58 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 b3650ab2c320..c11b8745cece 100644
--- a/arch/cris/include/asm/signal.h
+++ b/arch/cris/include/asm/signal.h
@@ -16,13 +16,6 @@ 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 {
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 void (*sa_restorer)(void);
24};
25
26#define __ARCH_HAS_SA_RESTORER 19#define __ARCH_HAS_SA_RESTORER
27 20
28#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 9d262645f667..e3f8ffdd4e7b 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -12,6 +12,9 @@ config FRV
12 select ARCH_HAVE_NMI_SAFE_CMPXCHG 12 select ARCH_HAVE_NMI_SAFE_CMPXCHG
13 select GENERIC_CPU_DEVICES 13 select GENERIC_CPU_DEVICES
14 select ARCH_WANT_IPC_PARSE_VERSION 14 select ARCH_WANT_IPC_PARSE_VERSION
15 select GENERIC_SIGALTSTACK
16 select OLD_SIGSUSPEND3
17 select OLD_SIGACTION
15 18
16config ZONE_DMA 19config ZONE_DMA
17 bool 20 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/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..0b0176ce2c35 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -9,6 +9,9 @@ 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 GENERIC_SIGALTSTACK
13 select OLD_SIGSUSPEND3
14 select OLD_SIGACTION
12 15
13config SYMBOL_PREFIX 16config SYMBOL_PREFIX
14 string 17 string
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h
index 9b18a0959461..6341e36386f8 100644
--- a/arch/h8300/include/asm/signal.h
+++ b/arch/h8300/include/asm/signal.h
@@ -16,13 +16,6 @@ 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 {
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 void (*sa_restorer)(void);
24};
25
26#define __ARCH_HAS_SA_RESTORER 19#define __ARCH_HAS_SA_RESTORER
27 20
28#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
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/Kconfig b/arch/hexagon/Kconfig
index 0744f7d7b1fd..3e6e27c11f93 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -31,6 +31,7 @@ config HEXAGON
31 select GENERIC_CLOCKEVENTS 31 select GENERIC_CLOCKEVENTS
32 select GENERIC_CLOCKEVENTS_BROADCAST 32 select GENERIC_CLOCKEVENTS_BROADCAST
33 select MODULES_USE_ELF_RELA 33 select MODULES_USE_ELF_RELA
34 select GENERIC_SIGALTSTACK
34 ---help--- 35 ---help---
35 Qualcomm Hexagon is a processor architecture designed for high 36 Qualcomm Hexagon is a processor architecture designed for high
36 performance and low power across a wide variety of applications. 37 performance and low power across a wide variety of applications.
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/Kconfig b/arch/ia64/Kconfig
index 3279646120e3..98482d1cbc5b 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -42,6 +42,7 @@ config IA64
42 select GENERIC_TIME_VSYSCALL_OLD 42 select GENERIC_TIME_VSYSCALL_OLD
43 select HAVE_MOD_ARCH_SPECIFIC 43 select HAVE_MOD_ARCH_SPECIFIC
44 select MODULES_USE_ELF_RELA 44 select MODULES_USE_ELF_RELA
45 select GENERIC_SIGALTSTACK
45 default y 46 default y
46 help 47 help
47 The Itanium Processor Family is Intel's 64-bit successor to 48 The Itanium Processor Family is Intel's 64-bit successor to
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/Kconfig b/arch/m32r/Kconfig
index f807721e19a5..1f550d4dd5d0 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -15,6 +15,7 @@ config M32R
15 select GENERIC_ATOMIC64 15 select GENERIC_ATOMIC64
16 select ARCH_USES_GETTIMEOFFSET 16 select ARCH_USES_GETTIMEOFFSET
17 select MODULES_USE_ELF_RELA 17 select MODULES_USE_ELF_RELA
18 select GENERIC_SIGALTSTACK
18 19
19config SBUS 20config SBUS
20 bool 21 bool
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..a358bf63defe 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -18,6 +18,9 @@ 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 GENERIC_SIGALTSTACK
22 select OLD_SIGSUSPEND3
23 select OLD_SIGACTION
21 24
22config RWSEM_GENERIC_SPINLOCK 25config RWSEM_GENERIC_SPINLOCK
23 bool 26 bool
diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h
index c7b4fb1fa14d..214320b50384 100644
--- a/arch/m68k/include/asm/signal.h
+++ b/arch/m68k/include/asm/signal.h
@@ -16,13 +16,6 @@ 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 {
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 __sigrestore_t sa_restorer;
24};
25
26#define __ARCH_HAS_SA_RESTORER 19#define __ARCH_HAS_SA_RESTORER
27 20
28#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
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/Kconfig b/arch/microblaze/Kconfig
index ba3b7c8c04b8..5e30d75c74ed 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -27,6 +27,7 @@ config MICROBLAZE
27 select GENERIC_CLOCKEVENTS 27 select GENERIC_CLOCKEVENTS
28 select MODULES_USE_ELF_RELA 28 select MODULES_USE_ELF_RELA
29 select CLONE_BACKWARDS 29 select CLONE_BACKWARDS
30 select GENERIC_SIGALTSTACK
30 31
31config SWAP 32config SWAP
32 def_bool n 33 def_bool n
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 2ac626ab9d43..0772b5c5bc72 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -41,6 +41,12 @@ config MIPS
41 select HAVE_MOD_ARCH_SPECIFIC 41 select HAVE_MOD_ARCH_SPECIFIC
42 select MODULES_USE_ELF_REL if MODULES 42 select MODULES_USE_ELF_REL if MODULES
43 select MODULES_USE_ELF_RELA if MODULES && 64BIT 43 select MODULES_USE_ELF_RELA if MODULES && 64BIT
44 select CLONE_BACKWARDS
45 select GENERIC_SIGALTSTACK
46 select GENERIC_COMPAT_RT_SIGACTION
47 select GENERIC_COMPAT_RT_SIGQUEUEINFO
48 select GENERIC_COMPAT_RT_SIGPROCMASK
49 select GENERIC_COMPAT_RT_SIGPENDING
44 50
45menu "Machine selection" 51menu "Machine selection"
46 52
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/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..06f6463c24ad 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -43,6 +43,8 @@
43# ifdef CONFIG_MIPS32_O32 43# ifdef CONFIG_MIPS32_O32
44# define __ARCH_WANT_COMPAT_SYS_TIME 44# define __ARCH_WANT_COMPAT_SYS_TIME
45# endif 45# endif
46#define __ARCH_WANT_SYS_FORK
47#define __ARCH_WANT_SYS_CLONE
46 48
47/* whitelists for checksyscalls */ 49/* whitelists for checksyscalls */
48#define __IGNORE_select 50#define __IGNORE_select
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 4d790d1f03d6..95b019d92f50 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -247,31 +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
262SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *,unewset, size_t, sigsetsize)
263{
264 sigset_t newset;
265
266 /* XXX Don't preclude handling different sized sigset_t's. */
267 if (sigsetsize != sizeof(sigset_t))
268 return -EINVAL;
269
270 if (copy_from_user(&newset, unewset, sizeof(newset)))
271 return -EFAULT;
272 return sigsuspend(&newset);
273}
274
275#ifdef CONFIG_TRAD_SIGNALS 256#ifdef CONFIG_TRAD_SIGNALS
276SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act, 257SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
277 struct sigaction __user *, oact) 258 struct sigaction __user *, oact)
@@ -313,15 +294,6 @@ SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
313} 294}
314#endif 295#endif
315 296
316asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
317{
318 const stack_t __user *uss = (const stack_t __user *) regs.regs[4];
319 stack_t __user *uoss = (stack_t __user *) regs.regs[5];
320 unsigned long usp = regs.regs[29];
321
322 return do_sigaltstack(uss, uoss, usp);
323}
324
325#ifdef CONFIG_TRAD_SIGNALS 297#ifdef CONFIG_TRAD_SIGNALS
326asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) 298asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
327{ 299{
@@ -378,9 +350,8 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
378 else if (sig) 350 else if (sig)
379 force_sig(sig, current); 351 force_sig(sig, current);
380 352
381 /* It is more difficult to avoid calling this function than to 353 if (restore_altstack(&frame->rs_uc.uc_stack))
382 call it and ignore errors. */ 354 goto badframe;
383 do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]);
384 355
385 /* 356 /*
386 * Don't let your children do this ... 357 * Don't let your children do this ...
@@ -457,12 +428,7 @@ static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
457 /* Create the ucontext. */ 428 /* Create the ucontext. */
458 err |= __put_user(0, &frame->rs_uc.uc_flags); 429 err |= __put_user(0, &frame->rs_uc.uc_flags);
459 err |= __put_user(NULL, &frame->rs_uc.uc_link); 430 err |= __put_user(NULL, &frame->rs_uc.uc_link);
460 err |= __put_user((void __user *)current->sas_ss_sp, 431 err |= __save_altstack(&frame->rs_uc.uc_stack, regs->regs[29]);
461 &frame->rs_uc.uc_stack.ss_sp);
462 err |= __put_user(sas_ss_flags(regs->regs[29]),
463 &frame->rs_uc.uc_stack.ss_flags);
464 err |= __put_user(current->sas_ss_size,
465 &frame->rs_uc.uc_stack.ss_size);
466 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext); 432 err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
467 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));
468 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..12bf06f9abe5 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -10,6 +10,9 @@ 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 GENERIC_SIGALTSTACK
14 select OLD_SIGSUSPEND3
15 select OLD_SIGACTION
13 16
14config AM33_2 17config AM33_2
15 def_bool n 18 def_bool n
diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h
index 288ade5ec94e..214ff5e9fe60 100644
--- a/arch/mn10300/include/asm/signal.h
+++ b/arch/mn10300/include/asm/signal.h
@@ -26,13 +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 old_sigaction {
30 __sighandler_t sa_handler;
31 old_sigset_t sa_mask;
32 unsigned long sa_flags;
33 __sigrestore_t sa_restorer;
34};
35
36#define __ARCH_HAS_SA_RESTORER 29#define __ARCH_HAS_SA_RESTORER
37 30
38#include <asm/sigcontext.h> 31#include <asm/sigcontext.h>
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/Kconfig b/arch/openrisc/Kconfig
index 0ac66f67521f..d3632eb98a1c 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -22,6 +22,7 @@ config OPENRISC
22 select GENERIC_STRNCPY_FROM_USER 22 select GENERIC_STRNCPY_FROM_USER
23 select GENERIC_STRNLEN_USER 23 select GENERIC_STRNLEN_USER
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select GENERIC_SIGALTSTACK
25 26
26config MMU 27config MMU
27 def_bool y 28 def_bool y
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/Kconfig b/arch/parisc/Kconfig
index b77feffbadea..2bd407ffaebf 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -23,6 +23,11 @@ config PARISC
23 select HAVE_MOD_ARCH_SPECIFIC 23 select HAVE_MOD_ARCH_SPECIFIC
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select CLONE_BACKWARDS 25 select CLONE_BACKWARDS
26 select GENERIC_SIGALTSTACK
27 select GENERIC_COMPAT_RT_SIGACTION
28 select GENERIC_COMPAT_RT_SIGQUEUEINFO
29 select GENERIC_COMPAT_RT_SIGPROCMASK
30 select GENERIC_COMPAT_RT_SIGPENDING
26 31
27 help 32 help
28 The PA-RISC microprocessor is designed by Hewlett-Packard and used 33 The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index bfb44247d7a7..240d153daec3 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 537996955998..64d315f6d2a4 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
@@ -260,15 +260,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
260 if (is_compat_task()) { 260 if (is_compat_task()) {
261 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info); 261 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
262 err |= copy_siginfo_to_user32(&compat_frame->info, info); 262 err |= copy_siginfo_to_user32(&compat_frame->info, info);
263 DBG(1,"SETUP_RT_FRAME: 1\n"); 263 err |= __compat_save_altstack( &compat_frame->uc.uc_stack, regs->gr[30]);
264 compat_val = (compat_int_t)current->sas_ss_sp;
265 err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_sp);
266 DBG(1,"SETUP_RT_FRAME: 2\n");
267 compat_val = (compat_int_t)current->sas_ss_size;
268 err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_size);
269 DBG(1,"SETUP_RT_FRAME: 3\n");
270 compat_val = sas_ss_flags(regs->gr[30]);
271 err |= __put_user(compat_val, &compat_frame->uc.uc_stack.ss_flags);
272 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc); 264 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &compat_frame->uc);
273 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext); 265 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &compat_frame->uc.uc_mcontext);
274 err |= setup_sigcontext32(&compat_frame->uc.uc_mcontext, 266 err |= setup_sigcontext32(&compat_frame->uc.uc_mcontext,
@@ -280,10 +272,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
280 { 272 {
281 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info); 273 DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &frame->info);
282 err |= copy_siginfo_to_user(&frame->info, info); 274 err |= copy_siginfo_to_user(&frame->info, info);
283 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 275 err |= __save_altstack(&frame->uc.uc_stack, regs->gr[30]);
284 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
285 err |= __put_user(sas_ss_flags(regs->gr[30]),
286 &frame->uc.uc_stack.ss_flags);
287 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc); 276 DBG(1,"setup_rt_frame: frame->uc = 0x%p\n", &frame->uc);
288 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext); 277 DBG(1,"setup_rt_frame: frame->uc.uc_mcontext = 0x%p\n", &frame->uc.uc_mcontext);
289 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, in_syscall); 278 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 5dede04f2f3e..33eca1b04926 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -60,129 +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 *set)
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 *set)
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 && get_sigset32(set, &new_set, sigsetsize))
98 return -EFAULT;
99
100 KERNEL_SYSCALL(ret, sys_rt_sigprocmask, how, set ? (sigset_t __user *)&new_set : NULL,
101 oset ? (sigset_t __user *)&old_set : NULL, sigsetsize);
102
103 if (!ret && oset && put_sigset32(oset, &old_set, sigsetsize))
104 return -EFAULT;
105
106 return ret;
107}
108
109
110int sys32_rt_sigpending(compat_sigset_t __user *uset, unsigned int sigsetsize)
111{
112 int ret;
113 sigset_t set;
114
115 KERNEL_SYSCALL(ret, sys_rt_sigpending, (sigset_t __user *)&set, sigsetsize);
116
117 if (!ret && put_sigset32(uset, &set, sigsetsize))
118 return -EFAULT;
119
120 return ret;
121}
122
123long
124sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, struct sigaction32 __user *oact,
125 size_t sigsetsize)
126{
127 struct k_sigaction32 new_sa32, old_sa32;
128 struct k_sigaction new_sa, old_sa;
129 int ret = -EINVAL;
130
131 if (act) {
132 if (copy_from_user(&new_sa32.sa, act, sizeof new_sa32.sa))
133 return -EFAULT;
134 new_sa.sa.sa_handler = (__sighandler_t)(unsigned long)new_sa32.sa.sa_handler;
135 new_sa.sa.sa_flags = new_sa32.sa.sa_flags;
136 sigset_32to64(&new_sa.sa.sa_mask, &new_sa32.sa.sa_mask);
137 }
138
139 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
140
141 if (!ret && oact) {
142 sigset_64to32(&old_sa32.sa.sa_mask, &old_sa.sa.sa_mask);
143 old_sa32.sa.sa_flags = old_sa.sa.sa_flags;
144 old_sa32.sa.sa_handler = (__sighandler_t32)(unsigned long)old_sa.sa.sa_handler;
145 if (copy_to_user(oact, &old_sa32.sa, sizeof old_sa32.sa))
146 return -EFAULT;
147 }
148 return ret;
149}
150
151int
152do_sigaltstack32 (const compat_stack_t __user *uss32, compat_stack_t __user *uoss32, unsigned long sp)
153{
154 compat_stack_t ss32, oss32;
155 stack_t ss, oss;
156 stack_t *ssp = NULL, *ossp = NULL;
157 int ret;
158
159 if (uss32) {
160 if (copy_from_user(&ss32, uss32, sizeof ss32))
161 return -EFAULT;
162
163 ss.ss_sp = (void __user *)(unsigned long)ss32.ss_sp;
164 ss.ss_flags = ss32.ss_flags;
165 ss.ss_size = ss32.ss_size;
166
167 ssp = &ss;
168 }
169
170 if (uoss32)
171 ossp = &oss;
172
173 KERNEL_SYSCALL(ret, do_sigaltstack, (const stack_t __user *)ssp, (stack_t __user *)ossp, sp);
174
175 if (!ret && uoss32) {
176 oss32.ss_sp = (unsigned int)(unsigned long)oss.ss_sp;
177 oss32.ss_flags = oss.ss_flags;
178 oss32.ss_size = oss.ss_size;
179 if (copy_to_user(uoss32, &oss32, sizeof *uoss32))
180 return -EFAULT;
181 }
182
183 return ret;
184}
185
186long 63long
187restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf, 64restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf,
188 struct pt_regs *regs) 65 struct pt_regs *regs)
@@ -499,22 +376,3 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
499 } 376 }
500 return err; 377 return err;
501} 378}
502
503asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
504 struct compat_siginfo __user *uinfo)
505{
506 siginfo_t info;
507
508 if (copy_siginfo_from_user32(&info, uinfo))
509 return -EFAULT;
510
511 /* Not even root can pretend to send signals from the kernel.
512 Nor can they impersonate a kill(), which adds source info. */
513 if (info.si_code >= 0)
514 return -EPERM;
515 info.si_signo = sig;
516
517 /* POSIX.1b doesn't mention process groups. */
518 return kill_proc_info(sig, &info, pid);
519}
520
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/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 9cfdaa19ab63..9b6a376cb12b 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -61,18 +61,6 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
61 return -ENOSYS; 61 return -ENOSYS;
62} 62}
63 63
64asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
65 struct compat_timespec __user *interval)
66{
67 struct timespec t;
68 int ret;
69
70 KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, (struct timespec __user *)&t);
71 if (put_compat_timespec(&t, interval))
72 return -EFAULT;
73 return ret;
74}
75
76struct msgbuf32 { 64struct msgbuf32 {
77 int mtype; 65 int mtype;
78 char mtext[1]; 66 char mtext[1];
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 54d950b067b7..dd52c23c0dcd 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -250,12 +250,12 @@
250 /* These 2 would've worked if someone had defined struct timespec 250 /* These 2 would've worked if someone had defined struct timespec
251 * carefully, like timeval for example (which is about the same). 251 * carefully, like timeval for example (which is about the same).
252 * Unfortunately it contains a long :-( */ 252 * Unfortunately it contains a long :-( */
253 ENTRY_DIFF(sched_rr_get_interval) 253 ENTRY_COMP(sched_rr_get_interval)
254 ENTRY_COMP(nanosleep) 254 ENTRY_COMP(nanosleep)
255 ENTRY_SAME(mremap) 255 ENTRY_SAME(mremap)
256 ENTRY_SAME(setresuid) 256 ENTRY_SAME(setresuid)
257 ENTRY_SAME(getresuid) /* 165 */ 257 ENTRY_SAME(getresuid) /* 165 */
258 ENTRY_DIFF(sigaltstack_wrapper) 258 ENTRY_COMP(sigaltstack)
259 ENTRY_SAME(ni_syscall) /* query_module */ 259 ENTRY_SAME(ni_syscall) /* query_module */
260 ENTRY_SAME(poll) 260 ENTRY_SAME(poll)
261 /* structs contain pointers and an in_addr... */ 261 /* structs contain pointers and an in_addr... */
@@ -265,9 +265,9 @@
265 ENTRY_SAME(prctl) 265 ENTRY_SAME(prctl)
266 /* signals need a careful review */ 266 /* signals need a careful review */
267 ENTRY_SAME(rt_sigreturn_wrapper) 267 ENTRY_SAME(rt_sigreturn_wrapper)
268 ENTRY_DIFF(rt_sigaction) 268 ENTRY_COMP(rt_sigaction)
269 ENTRY_DIFF(rt_sigprocmask) /* 175 */ 269 ENTRY_COMP(rt_sigprocmask) /* 175 */
270 ENTRY_DIFF(rt_sigpending) 270 ENTRY_COMP(rt_sigpending)
271 ENTRY_COMP(rt_sigtimedwait) 271 ENTRY_COMP(rt_sigtimedwait)
272 /* even though the struct siginfo_t is different, it appears like 272 /* even though the struct siginfo_t is different, it appears like
273 * all the paths use values which should be same wide and narrow. 273 * all the paths use values which should be same wide and narrow.
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 17903f1f356b..ec89a7b11f7b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -144,6 +144,13 @@ config PPC
144 select HAVE_MOD_ARCH_SPECIFIC 144 select HAVE_MOD_ARCH_SPECIFIC
145 select MODULES_USE_ELF_RELA 145 select MODULES_USE_ELF_RELA
146 select CLONE_BACKWARDS 146 select CLONE_BACKWARDS
147 select GENERIC_SIGALTSTACK
148 select GENERIC_COMPAT_RT_SIGACTION
149 select GENERIC_COMPAT_RT_SIGQUEUEINFO
150 select GENERIC_COMPAT_RT_SIGPROCMASK
151 select GENERIC_COMPAT_RT_SIGPENDING
152 select OLD_SIGSUSPEND
153 select OLD_SIGACTION if PPC32
147 154
148config EARLY_PRINTK 155config EARLY_PRINTK
149 bool 156 bool
@@ -154,6 +161,7 @@ config COMPAT
154 default y if PPC64 161 default y if PPC64
155 select COMPAT_BINFMT_ELF 162 select COMPAT_BINFMT_ELF
156 select ARCH_WANT_OLD_COMPAT_IPC 163 select ARCH_WANT_OLD_COMPAT_IPC
164 select COMPAT_OLD_SIGACTION
157 165
158config SYSVIPC_COMPAT 166config SYSVIPC_COMPAT
159 bool 167 bool
diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index 6949c42ffac2..23be8f1e7e64 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -5,9 +5,7 @@
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;
12 10
13asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, 11asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
@@ -16,15 +14,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
16asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, 14asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
17 unsigned long prot, unsigned long flags, 15 unsigned long prot, unsigned long flags,
18 unsigned long fd, unsigned long pgoff); 16 unsigned long fd, unsigned long pgoff);
19asmlinkage long sys_pipe(int __user *fildes);
20asmlinkage long sys_pipe2(int __user *fildes, int flags);
21asmlinkage long ppc64_personality(unsigned long personality); 17asmlinkage long ppc64_personality(unsigned long personality);
22asmlinkage int ppc_rtas(struct rtas_args __user *uargs); 18asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
23asmlinkage time_t sys64_time(time_t __user * tloc);
24
25asmlinkage long sys_sigaltstack(const stack_t __user *uss,
26 stack_t __user *uoss, unsigned long r5, unsigned long r6,
27 unsigned long r7, unsigned long r8, struct pt_regs *regs);
28 19
29#endif /* __KERNEL__ */ 20#endif /* __KERNEL__ */
30#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/uapi/asm/signal.h b/arch/powerpc/include/uapi/asm/signal.h
index 6defdd65594e..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;
@@ -97,7 +98,6 @@ struct old_sigaction {
97 __sigrestore_t sa_restorer; 98 __sigrestore_t sa_restorer;
98}; 99};
99 100
100#ifndef __KERNEL__
101struct sigaction { 101struct sigaction {
102 __sighandler_t sa_handler; 102 __sighandler_t sa_handler;
103 unsigned long sa_flags; 103 unsigned long sa_flags;
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 3b997118df50..fa99dc54965c 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -169,10 +169,3 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
169 tracehook_notify_resume(regs); 169 tracehook_notify_resume(regs);
170 } 170 }
171} 171}
172
173long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
174 unsigned long r5, unsigned long r6, unsigned long r7,
175 unsigned long r8, struct pt_regs *regs)
176{
177 return do_sigaltstack(uss, uoss, regs->gpr[1]);
178}
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 9ec3fed3caac..802ab5ea36cb 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -56,9 +56,7 @@
56#undef DEBUG_SIG 56#undef DEBUG_SIG
57 57
58#ifdef CONFIG_PPC64 58#ifdef CONFIG_PPC64
59#define sys_sigsuspend compat_sys_sigsuspend
60#define sys_rt_sigreturn compat_sys_rt_sigreturn 59#define sys_rt_sigreturn compat_sys_rt_sigreturn
61#define sys_sigaction compat_sys_sigaction
62#define sys_swapcontext compat_sys_swapcontext 60#define sys_swapcontext compat_sys_swapcontext
63#define sys_sigreturn compat_sys_sigreturn 61#define sys_sigreturn compat_sys_sigreturn
64 62
@@ -67,6 +65,8 @@
67#define mcontext mcontext32 65#define mcontext mcontext32
68#define ucontext ucontext32 66#define ucontext ucontext32
69 67
68#define __save_altstack __compat_save_altstack
69
70/* 70/*
71 * Userspace code may pass a ucontext which doesn't include VSX added 71 * Userspace code may pass a ucontext which doesn't include VSX added
72 * at the end. We need to check for this case. 72 * at the end. We need to check for this case.
@@ -129,23 +129,6 @@ static inline int get_sigset_t(sigset_t *set,
129 return 0; 129 return 0;
130} 130}
131 131
132static inline int get_old_sigaction(struct k_sigaction *new_ka,
133 struct old_sigaction __user *act)
134{
135 compat_old_sigset_t mask;
136 compat_uptr_t handler, restorer;
137
138 if (get_user(handler, &act->sa_handler) ||
139 __get_user(restorer, &act->sa_restorer) ||
140 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
141 __get_user(mask, &act->sa_mask))
142 return -EFAULT;
143 new_ka->sa.sa_handler = compat_ptr(handler);
144 new_ka->sa.sa_restorer = compat_ptr(restorer);
145 siginitset(&new_ka->sa.sa_mask, mask);
146 return 0;
147}
148
149#define to_user_ptr(p) ptr_to_compat(p) 132#define to_user_ptr(p) ptr_to_compat(p)
150#define from_user_ptr(p) compat_ptr(p) 133#define from_user_ptr(p) compat_ptr(p)
151 134
@@ -195,21 +178,6 @@ static inline int get_sigset_t(sigset_t *set, const sigset_t __user *uset)
195 return copy_from_user(set, uset, sizeof(*uset)); 178 return copy_from_user(set, uset, sizeof(*uset));
196} 179}
197 180
198static inline int get_old_sigaction(struct k_sigaction *new_ka,
199 struct old_sigaction __user *act)
200{
201 old_sigset_t mask;
202
203 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
204 __get_user(new_ka->sa.sa_handler, &act->sa_handler) ||
205 __get_user(new_ka->sa.sa_restorer, &act->sa_restorer) ||
206 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
207 __get_user(mask, &act->sa_mask))
208 return -EFAULT;
209 siginitset(&new_ka->sa.sa_mask, mask);
210 return 0;
211}
212
213#define to_user_ptr(p) ((unsigned long)(p)) 181#define to_user_ptr(p) ((unsigned long)(p))
214#define from_user_ptr(p) ((void __user *)(p)) 182#define from_user_ptr(p) ((void __user *)(p))
215 183
@@ -233,50 +201,8 @@ static inline int restore_general_regs(struct pt_regs *regs,
233 return -EFAULT; 201 return -EFAULT;
234 return 0; 202 return 0;
235} 203}
236
237#endif /* CONFIG_PPC64 */
238
239/*
240 * Atomically swap in the new signal mask, and wait for a signal.
241 */
242long sys_sigsuspend(old_sigset_t mask)
243{
244 sigset_t blocked;
245 siginitset(&blocked, mask);
246 return sigsuspend(&blocked);
247}
248
249long sys_sigaction(int sig, struct old_sigaction __user *act,
250 struct old_sigaction __user *oact)
251{
252 struct k_sigaction new_ka, old_ka;
253 int ret;
254
255#ifdef CONFIG_PPC64
256 if (sig < 0)
257 sig = -sig;
258#endif 204#endif
259 205
260 if (act) {
261 if (get_old_sigaction(&new_ka, act))
262 return -EFAULT;
263 }
264
265 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
266 if (!ret && oact) {
267 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
268 __put_user(to_user_ptr(old_ka.sa.sa_handler),
269 &oact->sa_handler) ||
270 __put_user(to_user_ptr(old_ka.sa.sa_restorer),
271 &oact->sa_restorer) ||
272 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
273 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
274 return -EFAULT;
275 }
276
277 return ret;
278}
279
280/* 206/*
281 * When we have signals to deliver, we set up on the 207 * When we have signals to deliver, we set up on the
282 * user stack, going down from the original stack pointer: 208 * user stack, going down from the original stack pointer:
@@ -588,89 +514,6 @@ static long restore_user_regs(struct pt_regs *regs,
588} 514}
589 515
590#ifdef CONFIG_PPC64 516#ifdef CONFIG_PPC64
591long compat_sys_rt_sigaction(int sig, const struct sigaction32 __user *act,
592 struct sigaction32 __user *oact, size_t sigsetsize)
593{
594 struct k_sigaction new_ka, old_ka;
595 int ret;
596
597 /* XXX: Don't preclude handling different sized sigset_t's. */
598 if (sigsetsize != sizeof(compat_sigset_t))
599 return -EINVAL;
600
601 if (act) {
602 compat_uptr_t handler;
603
604 ret = get_user(handler, &act->sa_handler);
605 new_ka.sa.sa_handler = compat_ptr(handler);
606 ret |= get_sigset_t(&new_ka.sa.sa_mask, &act->sa_mask);
607 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
608 if (ret)
609 return -EFAULT;
610 }
611
612 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
613 if (!ret && oact) {
614 ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler);
615 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask);
616 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
617 }
618 return ret;
619}
620
621/*
622 * Note: it is necessary to treat how as an unsigned int, with the
623 * corresponding cast to a signed int to insure that the proper
624 * conversion (sign extension) between the register representation
625 * of a signed int (msr in 32-bit mode) and the register representation
626 * of a signed int (msr in 64-bit mode) is performed.
627 */
628long compat_sys_rt_sigprocmask(u32 how, compat_sigset_t __user *set,
629 compat_sigset_t __user *oset, size_t sigsetsize)
630{
631 sigset_t s;
632 sigset_t __user *up;
633 int ret;
634 mm_segment_t old_fs = get_fs();
635
636 if (set) {
637 if (get_sigset_t(&s, set))
638 return -EFAULT;
639 }
640
641 set_fs(KERNEL_DS);
642 /* This is valid because of the set_fs() */
643 up = (sigset_t __user *) &s;
644 ret = sys_rt_sigprocmask((int)how, set ? up : NULL, oset ? up : NULL,
645 sigsetsize);
646 set_fs(old_fs);
647 if (ret)
648 return ret;
649 if (oset) {
650 if (put_sigset_t(oset, &s))
651 return -EFAULT;
652 }
653 return 0;
654}
655
656long compat_sys_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
657{
658 sigset_t s;
659 int ret;
660 mm_segment_t old_fs = get_fs();
661
662 set_fs(KERNEL_DS);
663 /* The __user pointer cast is valid because of the set_fs() */
664 ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
665 set_fs(old_fs);
666 if (!ret) {
667 if (put_sigset_t(set, &s))
668 return -EFAULT;
669 }
670 return ret;
671}
672
673
674int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s) 517int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s)
675{ 518{
676 int err; 519 int err;
@@ -739,79 +582,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
739 582
740 return 0; 583 return 0;
741} 584}
742
743/*
744 * Note: it is necessary to treat pid and sig as unsigned ints, with the
745 * corresponding cast to a signed int to insure that the proper conversion
746 * (sign extension) between the register representation of a signed int
747 * (msr in 32-bit mode) and the register representation of a signed int
748 * (msr in 64-bit mode) is performed.
749 */
750long compat_sys_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo)
751{
752 siginfo_t info;
753 int ret;
754 mm_segment_t old_fs = get_fs();
755
756 ret = copy_siginfo_from_user32(&info, uinfo);
757 if (unlikely(ret))
758 return ret;
759
760 set_fs (KERNEL_DS);
761 /* The __user pointer cast is valid becasuse of the set_fs() */
762 ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info);
763 set_fs (old_fs);
764 return ret;
765}
766/*
767 * Start Alternate signal stack support
768 *
769 * System Calls
770 * sigaltatck compat_sys_sigaltstack
771 */
772
773int compat_sys_sigaltstack(u32 __new, u32 __old, int r5,
774 int r6, int r7, int r8, struct pt_regs *regs)
775{
776 stack_32_t __user * newstack = compat_ptr(__new);
777 stack_32_t __user * oldstack = compat_ptr(__old);
778 stack_t uss, uoss;
779 int ret;
780 mm_segment_t old_fs;
781 unsigned long sp;
782 compat_uptr_t ss_sp;
783
784 /*
785 * set sp to the user stack on entry to the system call
786 * the system call router sets R9 to the saved registers
787 */
788 sp = regs->gpr[1];
789
790 /* Put new stack info in local 64 bit stack struct */
791 if (newstack) {
792 if (get_user(ss_sp, &newstack->ss_sp) ||
793 __get_user(uss.ss_flags, &newstack->ss_flags) ||
794 __get_user(uss.ss_size, &newstack->ss_size))
795 return -EFAULT;
796 uss.ss_sp = compat_ptr(ss_sp);
797 }
798
799 old_fs = get_fs();
800 set_fs(KERNEL_DS);
801 /* The __user pointer casts are valid because of the set_fs() */
802 ret = do_sigaltstack(
803 newstack ? (stack_t __user *) &uss : NULL,
804 oldstack ? (stack_t __user *) &uoss : NULL,
805 sp);
806 set_fs(old_fs);
807 /* Copy the stack information to the user output buffer */
808 if (!ret && oldstack &&
809 (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) ||
810 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
811 __put_user(uoss.ss_size, &oldstack->ss_size)))
812 return -EFAULT;
813 return ret;
814}
815#endif /* CONFIG_PPC64 */ 585#endif /* CONFIG_PPC64 */
816 586
817/* 587/*
@@ -838,10 +608,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
838 if (copy_siginfo_to_user(&rt_sf->info, info) 608 if (copy_siginfo_to_user(&rt_sf->info, info)
839 || __put_user(0, &rt_sf->uc.uc_flags) 609 || __put_user(0, &rt_sf->uc.uc_flags)
840 || __put_user(0, &rt_sf->uc.uc_link) 610 || __put_user(0, &rt_sf->uc.uc_link)
841 || __put_user(current->sas_ss_sp, &rt_sf->uc.uc_stack.ss_sp) 611 || __save_altstack(&rt_sf->uc.uc_stack, regs->gpr[1])
842 || __put_user(sas_ss_flags(regs->gpr[1]),
843 &rt_sf->uc.uc_stack.ss_flags)
844 || __put_user(current->sas_ss_size, &rt_sf->uc.uc_stack.ss_size)
845 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext), 612 || __put_user(to_user_ptr(&rt_sf->uc.uc_mcontext),
846 &rt_sf->uc.uc_regs) 613 &rt_sf->uc.uc_regs)
847 || put_sigset_t(&rt_sf->uc.uc_sigmask, oldset)) 614 || put_sigset_t(&rt_sf->uc.uc_sigmask, oldset))
@@ -1038,14 +805,11 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1038 * change it. -- paulus 805 * change it. -- paulus
1039 */ 806 */
1040#ifdef CONFIG_PPC64 807#ifdef CONFIG_PPC64
1041 /* 808 if (compat_restore_altstack(&rt_sf->uc.uc_stack))
1042 * We use the compat_sys_ version that does the 32/64 bits conversion 809 goto bad;
1043 * and takes userland pointer directly. What about error checking ?
1044 * nobody does any...
1045 */
1046 compat_sys_sigaltstack((u32)(u64)&rt_sf->uc.uc_stack, 0, 0, 0, 0, 0, regs);
1047#else 810#else
1048 do_sigaltstack(&rt_sf->uc.uc_stack, NULL, regs->gpr[1]); 811 if (restore_altstack(&rt_sf->uc.uc_stack))
812 goto bad;
1049#endif 813#endif
1050 set_thread_flag(TIF_RESTOREALL); 814 set_thread_flag(TIF_RESTOREALL);
1051 return 0; 815 return 0;
@@ -1161,7 +925,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1161 * always done it up until now so it is probably better not to 925 * always done it up until now so it is probably better not to
1162 * change it. -- paulus 926 * change it. -- paulus
1163 */ 927 */
1164 do_sigaltstack(&ctx->uc_stack, NULL, regs->gpr[1]); 928 restore_altstack(&ctx->uc_stack);
1165 929
1166 set_thread_flag(TIF_RESTOREALL); 930 set_thread_flag(TIF_RESTOREALL);
1167 out: 931 out:
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 1ca045d44324..807b5b1535e9 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -368,10 +368,8 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
368 if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext)) 368 if (restore_sigcontext(regs, NULL, 1, &uc->uc_mcontext))
369 goto badframe; 369 goto badframe;
370 370
371 /* do_sigaltstack expects a __user pointer and won't modify 371 if (restore_altstack(&uc->uc_stack))
372 * what's in there anyway 372 goto badframe;
373 */
374 do_sigaltstack(&uc->uc_stack, NULL, regs->gpr[1]);
375 373
376 set_thread_flag(TIF_RESTOREALL); 374 set_thread_flag(TIF_RESTOREALL);
377 return 0; 375 return 0;
@@ -416,10 +414,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
416 /* Create the ucontext. */ 414 /* Create the ucontext. */
417 err |= __put_user(0, &frame->uc.uc_flags); 415 err |= __put_user(0, &frame->uc.uc_flags);
418 err |= __put_user(0, &frame->uc.uc_link); 416 err |= __put_user(0, &frame->uc.uc_link);
419 err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 417 err |= __save_altstack(&frame->uc.uc_stack, regs->gpr[1]);
420 err |= __put_user(sas_ss_flags(regs->gpr[1]),
421 &frame->uc.uc_stack.ss_flags);
422 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
423 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, signr, NULL, 418 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, signr, NULL,
424 (unsigned long)ka->sa.sa_handler, 1); 419 (unsigned long)ka->sa.sa_handler, 1);
425 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 420 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
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 b5ea38c25647..bcdcf31fa672 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -140,6 +140,13 @@ config S390
140 select HAVE_MOD_ARCH_SPECIFIC 140 select HAVE_MOD_ARCH_SPECIFIC
141 select MODULES_USE_ELF_RELA 141 select MODULES_USE_ELF_RELA
142 select CLONE_BACKWARDS2 142 select CLONE_BACKWARDS2
143 select GENERIC_SIGALTSTACK
144 select GENERIC_COMPAT_RT_SIGACTION
145 select GENERIC_COMPAT_RT_SIGQUEUEINFO
146 select GENERIC_COMPAT_RT_SIGPROCMASK
147 select GENERIC_COMPAT_RT_SIGPENDING
148 select OLD_SIGSUSPEND3
149 select OLD_SIGACTION
143 150
144config SCHED_OMIT_FRAME_POINTER 151config SCHED_OMIT_FRAME_POINTER
145 def_bool y 152 def_bool y
@@ -249,6 +256,7 @@ config COMPAT
249 depends on 64BIT 256 depends on 64BIT
250 select COMPAT_BINFMT_ELF if BINFMT_ELF 257 select COMPAT_BINFMT_ELF if BINFMT_ELF
251 select ARCH_WANT_OLD_COMPAT_IPC 258 select ARCH_WANT_OLD_COMPAT_IPC
259 select COMPAT_OLD_SIGACTION
252 help 260 help
253 Select this option if you want to enable your system kernel to 261 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 262 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 d26e30e31656..abf9e5735943 100644
--- a/arch/s390/include/asm/signal.h
+++ b/arch/s390/include/asm/signal.h
@@ -21,12 +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 {
25 __sighandler_t sa_handler;
26 old_sigset_t sa_mask;
27 unsigned long sa_flags;
28 void (*sa_restorer)(void);
29};
30
31#define __ARCH_HAS_SA_RESTORER 24#define __ARCH_HAS_SA_RESTORER
32#endif 25#endif
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/Kconfig b/arch/score/Kconfig
index 3b1482e7afac..a125d7207bcc 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -14,6 +14,7 @@ config SCORE
14 select HAVE_MOD_ARCH_SPECIFIC 14 select HAVE_MOD_ARCH_SPECIFIC
15 select MODULES_USE_ELF_REL 15 select MODULES_USE_ELF_REL
16 select CLONE_BACKWARDS 16 select CLONE_BACKWARDS
17 select GENERIC_SIGALTSTACK
17 18
18choice 19choice
19 prompt "System type" 20 prompt "System type"
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 babc2b826c5c..b5fd9f3c9925 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -40,6 +40,9 @@ config SUPERH
40 select GENERIC_STRNLEN_USER 40 select GENERIC_STRNLEN_USER
41 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER 41 select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
42 select MODULES_USE_ELF_RELA 42 select MODULES_USE_ELF_RELA
43 select GENERIC_SIGALTSTACK
44 select OLD_SIGSUSPEND
45 select OLD_SIGACTION
43 help 46 help
44 The SuperH is a RISC processor targeted for use in embedded systems 47 The SuperH is a RISC processor targeted for use in embedded systems
45 and consumer electronics; it was also used in the Sega Dreamcast 48 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/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 89dde2f0653a..e557b0821540 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -42,12 +42,19 @@ config SPARC
42 select GENERIC_STRNLEN_USER 42 select GENERIC_STRNLEN_USER
43 select MODULES_USE_ELF_RELA 43 select MODULES_USE_ELF_RELA
44 select ODD_RT_SIGACTION 44 select ODD_RT_SIGACTION
45 select GENERIC_SIGALTSTACK
46 select GENERIC_COMPAT_RT_SIGQUEUEINFO
47 select GENERIC_COMPAT_RT_SIGPROCMASK
48 select GENERIC_COMPAT_RT_SIGPENDING
49 select GENERIC_COMPAT_RT_SIGACTION
50 select OLD_SIGSUSPEND
45 51
46config SPARC32 52config SPARC32
47 def_bool !64BIT 53 def_bool !64BIT
48 select GENERIC_ATOMIC64 54 select GENERIC_ATOMIC64
49 select CLZ_TAB 55 select CLZ_TAB
50 select HAVE_UID16 56 select HAVE_UID16
57 select OLD_SIGACTION
51 58
52config SPARC64 59config SPARC64
53 def_bool 64BIT 60 def_bool 64BIT
@@ -544,6 +551,7 @@ config COMPAT
544 select COMPAT_BINFMT_ELF 551 select COMPAT_BINFMT_ELF
545 select HAVE_UID16 552 select HAVE_UID16
546 select ARCH_WANT_OLD_COMPAT_IPC 553 select ARCH_WANT_OLD_COMPAT_IPC
554 select COMPAT_OLD_SIGACTION
547 555
548config SYSVIPC_COMPAT 556config SYSVIPC_COMPAT
549 bool 557 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/uapi/asm/signal.h b/arch/sparc/include/uapi/asm/signal.h
index 284836f0b7dc..f387400fcfdf 100644
--- a/arch/sparc/include/uapi/asm/signal.h
+++ b/arch/sparc/include/uapi/asm/signal.h
@@ -160,7 +160,6 @@ struct __new_sigaction {
160 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */ 160 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
161 __new_sigset_t sa_mask; 161 __new_sigset_t sa_mask;
162}; 162};
163#endif
164 163
165struct __old_sigaction { 164struct __old_sigaction {
166 __sighandler_t sa_handler; 165 __sighandler_t sa_handler;
@@ -168,6 +167,7 @@ struct __old_sigaction {
168 unsigned long sa_flags; 167 unsigned long sa_flags;
169 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */ 168 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
170}; 169};
170#endif
171 171
172typedef struct sigaltstack { 172typedef struct sigaltstack {
173 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..9d9eb91d0de1 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)))
@@ -642,9 +630,7 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
642 err |= copy_siginfo_to_user32(&sf->info, info); 630 err |= copy_siginfo_to_user32(&sf->info, info);
643 631
644 /* Setup sigaltstack */ 632 /* Setup sigaltstack */
645 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 633 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 634
649 switch (_NSIG_WORDS) { 635 switch (_NSIG_WORDS) {
650 case 4: seta.sig[7] = (oldset->sig[3] >> 32); 636 case 4: seta.sig[7] = (oldset->sig[3] >> 32);
@@ -856,29 +842,3 @@ asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp)
856out: 842out:
857 return ret; 843 return ret;
858} 844}
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..cd1823487759 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))
@@ -391,9 +368,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)); 368 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t));
392 369
393 /* Setup sigaltstack */ 370 /* Setup sigaltstack */
394 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 371 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 372
398 if (!wsaved) { 373 if (!wsaved) {
399 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 374 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 689e1ba62809..165a897a4133 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);
@@ -403,9 +387,7 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
403 } 387 }
404 388
405 /* Setup sigaltstack */ 389 /* Setup sigaltstack */
406 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 390 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 391
410 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t)); 392 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t));
411 393
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 cdd2d7035930..3a8d1844402e 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -160,41 +160,12 @@ 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
200SYSCALL_DEFINE5(rt_sigaction, int, sig, 171SYSCALL_DEFINE5(rt_sigaction, int, sig,
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 1dd89dbac8d8..26e6dd72e92a 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -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/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/Kconfig b/arch/unicore32/Kconfig
index 60651df5f952..a62786fdcaab 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -16,6 +16,7 @@ config UNICORE32
16 select ARCH_WANT_FRAME_POINTERS 16 select ARCH_WANT_FRAME_POINTERS
17 select GENERIC_IOMAP 17 select GENERIC_IOMAP
18 select MODULES_USE_ELF_REL 18 select MODULES_USE_ELF_REL
19 select GENERIC_SIGALTSTACK
19 help 20 help
20 UniCore-32 is 32-bit Instruction Set Architecture, 21 UniCore-32 is 32-bit Instruction Set Architecture,
21 including a series of low-power-consumption RISC chip 22 including a series of low-power-consumption RISC chip
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 79795af59810..87d09175a0a9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -114,6 +114,12 @@ config X86
114 select MODULES_USE_ELF_RELA if X86_64 114 select MODULES_USE_ELF_RELA if X86_64
115 select CLONE_BACKWARDS if X86_32 115 select CLONE_BACKWARDS if X86_32
116 select GENERIC_SIGALTSTACK 116 select GENERIC_SIGALTSTACK
117 select GENERIC_COMPAT_RT_SIGACTION
118 select GENERIC_COMPAT_RT_SIGQUEUEINFO
119 select GENERIC_COMPAT_RT_SIGPENDING
120 select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION
121 select OLD_SIGACTION if X86_32
122 select COMPAT_OLD_SIGACTION if IA32_EMULATION
117 123
118config INSTRUCTION_DECODER 124config INSTRUCTION_DECODER
119 def_bool y 125 def_bool y
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index a1daf4a65009..b0460cd7de5a 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;
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 102ff7cb3e41..c05e16b4536b 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/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 9bda8224f3d5..35e67a457182 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -34,15 +34,6 @@ extern void do_notify_resume(struct pt_regs *, void *, __u32);
34 34
35#define __ARCH_HAS_SA_RESTORER 35#define __ARCH_HAS_SA_RESTORER
36 36
37#ifdef __i386__
38struct old_sigaction {
39 __sighandler_t sa_handler;
40 old_sigset_t sa_mask;
41 unsigned long sa_flags;
42 __sigrestore_t sa_restorer;
43};
44
45#endif /* !__i386__ */
46#include <asm/sigcontext.h> 37#include <asm/sigcontext.h>
47 38
48#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/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 6ed91d9980e2..352e5a9279ec 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 07a7a04529bc..197512242e3b 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..d5b1f8a912ff 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -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;
@@ -843,8 +787,9 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
843} 787}
844 788
845#ifdef CONFIG_X86_X32_ABI 789#ifdef CONFIG_X86_X32_ABI
846asmlinkage long sys32_x32_rt_sigreturn(struct pt_regs *regs) 790asmlinkage long sys32_x32_rt_sigreturn(void)
847{ 791{
792 struct pt_regs *regs = current_pt_regs();
848 struct rt_sigframe_x32 __user *frame; 793 struct rt_sigframe_x32 __user *frame;
849 sigset_t set; 794 sigset_t set;
850 unsigned long ax; 795 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 53c90fd412d1..cf0f2731484e 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -25,6 +25,8 @@ config X86_32
25 select ARCH_WANT_IPC_PARSE_VERSION 25 select ARCH_WANT_IPC_PARSE_VERSION
26 select MODULES_USE_ELF_REL 26 select MODULES_USE_ELF_REL
27 select CLONE_BACKWARDS 27 select CLONE_BACKWARDS
28 select OLD_SIGSUSPEND3
29 select OLD_SIGACTION
28 30
29config X86_64 31config X86_64
30 def_bool 64BIT 32 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/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/Kconfig b/arch/xtensa/Kconfig
index 5aab1acabf1c..23cc6ae35da0 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -16,6 +16,7 @@ config XTENSA
16 select ARCH_WANT_OPTIONAL_GPIOLIB 16 select ARCH_WANT_OPTIONAL_GPIOLIB
17 select CLONE_BACKWARDS 17 select CLONE_BACKWARDS
18 select IRQ_DOMAIN 18 select IRQ_DOMAIN
19 select GENERIC_SIGALTSTACK
19 help 20 help
20 Xtensa processors are 32-bit RISC machines designed by Tensilica 21 Xtensa processors are 32-bit RISC machines designed by Tensilica
21 primarily for embedded systems. These processors are both 22 primarily for embedded systems. These processors are both
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
index 08a23ddac295..3673ff1f1bc5 100644
--- a/arch/xtensa/include/asm/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
@@ -12,7 +12,6 @@ struct pt_regs;
12asmlinkage long xtensa_ptrace(long, long, long, long); 12asmlinkage long xtensa_ptrace(long, long, long, long);
13asmlinkage long xtensa_sigreturn(struct pt_regs*); 13asmlinkage long xtensa_sigreturn(struct pt_regs*);
14asmlinkage long xtensa_rt_sigreturn(struct pt_regs*); 14asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
15asmlinkage long xtensa_sigaltstack(struct pt_regs *regs);
16asmlinkage long xtensa_shmat(int, char __user *, int); 15asmlinkage long xtensa_shmat(int, char __user *, int);
17asmlinkage long xtensa_fadvise64_64(int, int, 16asmlinkage long xtensa_fadvise64_64(int, int,
18 unsigned long long, unsigned long long); 17 unsigned long long, unsigned long long);
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/kernel/signal.c b/kernel/signal.c
index 775f5552fa0e..87c09e3061d2 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3562,7 +3562,6 @@ int sigsuspend(sigset_t *set)
3562 return -ERESTARTNOHAND; 3562 return -ERESTARTNOHAND;
3563} 3563}
3564 3564
3565#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND
3566/** 3565/**
3567 * sys_rt_sigsuspend - replace the signal mask for a value with the 3566 * sys_rt_sigsuspend - replace the signal mask for a value with the
3568 * @unewset value until a signal is received 3567 * @unewset value until a signal is received
@@ -3603,7 +3602,6 @@ COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_
3603#endif 3602#endif
3604} 3603}
3605#endif 3604#endif
3606#endif
3607 3605
3608#ifdef CONFIG_OLD_SIGSUSPEND 3606#ifdef CONFIG_OLD_SIGSUSPEND
3609SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) 3607SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask)