aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
commit9e2d59ad580d590134285f361a0e80f0e98c0207 (patch)
treef3232be75781484193413f32ec82c21f6d8eb76e /arch/cris
parent5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff)
parent235b80226b986dabcbba844968f7807866bd0bfe (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull signal handling cleanups from Al Viro: "This is the first pile; another one will come a bit later and will contain SYSCALL_DEFINE-related patches. - a bunch of signal-related syscalls (both native and compat) unified. - a bunch of compat syscalls switched to COMPAT_SYSCALL_DEFINE (fixing several potential problems with missing argument validation, while we are at it) - a lot of now-pointless wrappers killed - a couple of architectures (cris and hexagon) forgot to save altstack settings into sigframe, even though they used the (uninitialized) values in sigreturn; fixed. - microblaze fixes for delivery of multiple signals arriving at once - saner set of helpers for signal delivery introduced, several architectures switched to using those." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (143 commits) x86: convert to ksignal sparc: convert to ksignal arm: switch to struct ksignal * passing alpha: pass k_sigaction and siginfo_t using ksignal pointer burying unused conditionals make do_sigaltstack() static arm64: switch to generic old sigaction() (compat-only) arm64: switch to generic compat rt_sigaction() arm64: switch compat to generic old sigsuspend arm64: switch to generic compat rt_sigqueueinfo() arm64: switch to generic compat rt_sigpending() arm64: switch to generic compat rt_sigprocmask() arm64: switch to generic sigaltstack sparc: switch to generic old sigsuspend sparc: COMPAT_SYSCALL_DEFINE does all sign-extension as well as SYSCALL_DEFINE sparc: kill sign-extending wrappers for native syscalls kill sparc32_open() sparc: switch to use of generic old sigaction sparc: switch sys_compat_rt_sigaction() to COMPAT_SYSCALL_DEFINE mips: switch to generic sys_fork() and sys_clone() ...
Diffstat (limited to 'arch/cris')
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/cris/arch-v10/kernel/signal.c65
-rw-r--r--arch/cris/arch-v32/kernel/signal.c68
-rw-r--r--arch/cris/include/asm/signal.h19
-rw-r--r--arch/cris/include/asm/unistd.h2
5 files changed, 17 insertions, 139 deletions
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index c59a01dd9c0c..0e5c187ac7d2 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -50,6 +50,8 @@ config CRIS
50 select GENERIC_CMOS_UPDATE 50 select GENERIC_CMOS_UPDATE
51 select MODULES_USE_ELF_RELA 51 select MODULES_USE_ELF_RELA
52 select CLONE_BACKWARDS2 52 select CLONE_BACKWARDS2
53 select OLD_SIGSUSPEND
54 select OLD_SIGACTION
53 55
54config HZ 56config HZ
55 int 57 int
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 0bb477c13a4e..61ce6273a895 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -42,55 +42,6 @@
42void do_signal(int canrestart, struct pt_regs *regs); 42void do_signal(int canrestart, struct pt_regs *regs);
43 43
44/* 44/*
45 * Atomically swap in the new signal mask, and wait for a signal. Define
46 * dummy arguments to be able to reach the regs argument. (Note that this
47 * arrangement relies on old_sigset_t occupying one register.)
48 */
49int sys_sigsuspend(old_sigset_t mask)
50{
51 sigset_t blocked;
52 siginitset(&blocked, mask);
53 return sigsuspend(&blocked);
54}
55
56int sys_sigaction(int sig, const struct old_sigaction __user *act,
57 struct old_sigaction *oact)
58{
59 struct k_sigaction new_ka, old_ka;
60 int ret;
61
62 if (act) {
63 old_sigset_t mask;
64 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
65 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
66 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
67 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
68 __get_user(mask, &act->sa_mask))
69 return -EFAULT;
70 siginitset(&new_ka.sa.sa_mask, mask);
71 }
72
73 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
74
75 if (!ret && oact) {
76 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
77 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
78 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
79 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
80 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
81 return -EFAULT;
82 }
83
84 return ret;
85}
86
87int sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
88{
89 return do_sigaltstack(uss, uoss, rdusp());
90}
91
92
93/*
94 * Do a signal return; undo the signal stack. 45 * Do a signal return; undo the signal stack.
95 */ 46 */
96 47
@@ -150,11 +101,9 @@ badframe:
150 return 1; 101 return 1;
151} 102}
152 103
153/* Define dummy arguments to be able to reach the regs argument. */ 104asmlinkage int sys_sigreturn(void)
154
155asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
156 long srp, struct pt_regs *regs)
157{ 105{
106 struct pt_regs *regs = current_pt_regs();
158 struct sigframe __user *frame = (struct sigframe *)rdusp(); 107 struct sigframe __user *frame = (struct sigframe *)rdusp();
159 sigset_t set; 108 sigset_t set;
160 109
@@ -188,11 +137,9 @@ badframe:
188 return 0; 137 return 0;
189} 138}
190 139
191/* Define dummy arguments to be able to reach the regs argument. */ 140asmlinkage int sys_rt_sigreturn(void)
192
193asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
194 long mof, long srp, struct pt_regs *regs)
195{ 141{
142 struct pt_regs *regs = current_pt_regs();
196 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp(); 143 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp();
197 sigset_t set; 144 sigset_t set;
198 145
@@ -214,7 +161,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
214 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 161 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
215 goto badframe; 162 goto badframe;
216 163
217 if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT) 164 if (restore_altstack(&frame->uc.uc_stack))
218 goto badframe; 165 goto badframe;
219 166
220 return regs->r10; 167 return regs->r10;
@@ -362,6 +309,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
362 309
363 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 310 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
364 311
312 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
313
365 if (err) 314 if (err)
366 goto give_sigsegv; 315 goto give_sigsegv;
367 316
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index b60d1b65a426..01d1375c9004 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -51,59 +51,6 @@ struct rt_signal_frame {
51void do_signal(int restart, struct pt_regs *regs); 51void do_signal(int restart, struct pt_regs *regs);
52void keep_debug_flags(unsigned long oldccs, unsigned long oldspc, 52void keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
53 struct pt_regs *regs); 53 struct pt_regs *regs);
54/*
55 * Swap in the new signal mask, and wait for a signal. Define some
56 * dummy arguments to be able to reach the regs argument.
57 */
58int
59sys_sigsuspend(old_sigset_t mask)
60{
61 sigset_t blocked;
62 siginitset(&blocked, mask);
63 return sigsuspend(&blocked);
64}
65
66int
67sys_sigaction(int signal, const struct old_sigaction *act,
68 struct old_sigaction *oact)
69{
70 int retval;
71 struct k_sigaction newk;
72 struct k_sigaction oldk;
73
74 if (act) {
75 old_sigset_t mask;
76
77 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
78 __get_user(newk.sa.sa_handler, &act->sa_handler) ||
79 __get_user(newk.sa.sa_restorer, &act->sa_restorer) ||
80 __get_user(newk.sa.sa_flags, &act->sa_flags) ||
81 __get_user(mask, &act->sa_mask))
82 return -EFAULT;
83
84 siginitset(&newk.sa.sa_mask, mask);
85 }
86
87 retval = do_sigaction(signal, act ? &newk : NULL, oact ? &oldk : NULL);
88
89 if (!retval && oact) {
90 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
91 __put_user(oldk.sa.sa_handler, &oact->sa_handler) ||
92 __put_user(oldk.sa.sa_restorer, &oact->sa_restorer) ||
93 __put_user(oldk.sa.sa_flags, &oact->sa_flags) ||
94 __put_user(oldk.sa.sa_mask.sig[0], &oact->sa_mask))
95 return -EFAULT;
96
97 }
98
99 return retval;
100}
101
102int
103sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
104{
105 return do_sigaltstack(uss, uoss, rdusp());
106}
107 54
108static int 55static int
109restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) 56restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
@@ -135,11 +82,9 @@ badframe:
135 return 1; 82 return 1;
136} 83}
137 84
138/* Define some dummy arguments to be able to reach the regs argument. */ 85asmlinkage int sys_sigreturn(void)
139asmlinkage int
140sys_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
141 struct pt_regs *regs)
142{ 86{
87 struct pt_regs *regs = current_pt_regs();
143 sigset_t set; 88 sigset_t set;
144 struct signal_frame __user *frame; 89 struct signal_frame __user *frame;
145 unsigned long oldspc = regs->spc; 90 unsigned long oldspc = regs->spc;
@@ -178,11 +123,9 @@ badframe:
178 return 0; 123 return 0;
179} 124}
180 125
181/* Define some dummy variables to be able to reach the regs argument. */ 126asmlinkage int sys_rt_sigreturn(void)
182asmlinkage int
183sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
184 struct pt_regs *regs)
185{ 127{
128 struct pt_regs *regs = current_pt_regs();
186 sigset_t set; 129 sigset_t set;
187 struct rt_signal_frame __user *frame; 130 struct rt_signal_frame __user *frame;
188 unsigned long oldspc = regs->spc; 131 unsigned long oldspc = regs->spc;
@@ -209,7 +152,7 @@ sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
209 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 152 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
210 goto badframe; 153 goto badframe;
211 154
212 if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT) 155 if (restore_altstack(&frame->uc.uc_stack))
213 goto badframe; 156 goto badframe;
214 157
215 keep_debug_flags(oldccs, oldspc, regs); 158 keep_debug_flags(oldccs, oldspc, regs);
@@ -371,6 +314,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
371 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext)); 314 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
372 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 315 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
373 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 316 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
317 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
374 318
375 if (err) 319 if (err)
376 goto give_sigsegv; 320 goto give_sigsegv;
diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h
index c0cb1fd4644c..c11b8745cece 100644
--- a/arch/cris/include/asm/signal.h
+++ b/arch/cris/include/asm/signal.h
@@ -16,23 +16,8 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct old_sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler; 20
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 void (*sa_restorer)(void);
24};
25
26struct sigaction {
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 void (*sa_restorer)(void);
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
37 22
38#endif 23#endif
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 6d062bdf92d4..be57a988bfb9 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -30,8 +30,6 @@
30#define __ARCH_WANT_SYS_OLDUMOUNT 30#define __ARCH_WANT_SYS_OLDUMOUNT
31#define __ARCH_WANT_SYS_SIGPENDING 31#define __ARCH_WANT_SYS_SIGPENDING
32#define __ARCH_WANT_SYS_SIGPROCMASK 32#define __ARCH_WANT_SYS_SIGPROCMASK
33#define __ARCH_WANT_SYS_RT_SIGACTION
34#define __ARCH_WANT_SYS_RT_SIGSUSPEND
35#define __ARCH_WANT_SYS_FORK 33#define __ARCH_WANT_SYS_FORK
36#define __ARCH_WANT_SYS_VFORK 34#define __ARCH_WANT_SYS_VFORK
37#define __ARCH_WANT_SYS_CLONE 35#define __ARCH_WANT_SYS_CLONE