aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
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/sh/kernel
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/sh/kernel')
-rw-r--r--arch/sh/kernel/signal_32.c63
-rw-r--r--arch/sh/kernel/signal_64.c62
2 files changed, 4 insertions, 121 deletions
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));