diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 21:50:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 21:50:11 -0500 |
commit | 9e2d59ad580d590134285f361a0e80f0e98c0207 (patch) | |
tree | f3232be75781484193413f32ec82c21f6d8eb76e /arch/tile | |
parent | 5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff) | |
parent | 235b80226b986dabcbba844968f7807866bd0bfe (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/tile')
-rw-r--r-- | arch/tile/include/asm/compat.h | 8 | ||||
-rw-r--r-- | arch/tile/include/asm/syscalls.h | 2 | ||||
-rw-r--r-- | arch/tile/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/tile/kernel/compat_signal.c | 112 | ||||
-rw-r--r-- | arch/tile/kernel/signal.c | 15 |
5 files changed, 4 insertions, 134 deletions
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 88f3c227afd9..001d418a8957 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h | |||
@@ -272,17 +272,9 @@ extern int compat_setup_rt_frame(int sig, struct k_sigaction *ka, | |||
272 | struct pt_regs *regs); | 272 | struct pt_regs *regs); |
273 | 273 | ||
274 | /* Compat syscalls. */ | 274 | /* Compat syscalls. */ |
275 | struct compat_sigaction; | ||
276 | struct compat_siginfo; | 275 | struct compat_siginfo; |
277 | struct compat_sigaltstack; | 276 | struct compat_sigaltstack; |
278 | long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, | ||
279 | struct compat_sigaction __user *oact, | ||
280 | size_t sigsetsize); | ||
281 | long compat_sys_rt_sigqueueinfo(int pid, int sig, | ||
282 | struct compat_siginfo __user *uinfo); | ||
283 | long compat_sys_rt_sigreturn(void); | 277 | long compat_sys_rt_sigreturn(void); |
284 | long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, | ||
285 | struct compat_sigaltstack __user *uoss_ptr); | ||
286 | long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); | 278 | long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); |
287 | long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); | 279 | long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); |
288 | long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, | 280 | long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, |
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h index 4c8462a62cb6..78886e2417a6 100644 --- a/arch/tile/include/asm/syscalls.h +++ b/arch/tile/include/asm/syscalls.h | |||
@@ -64,9 +64,7 @@ long sys_ftruncate64(unsigned int fd, loff_t length); | |||
64 | 64 | ||
65 | /* Provide versions of standard syscalls that use current_pt_regs(). */ | 65 | /* Provide versions of standard syscalls that use current_pt_regs(). */ |
66 | long sys_rt_sigreturn(void); | 66 | long sys_rt_sigreturn(void); |
67 | long sys_sigaltstack(const stack_t __user *, stack_t __user *); | ||
68 | #define sys_rt_sigreturn sys_rt_sigreturn | 67 | #define sys_rt_sigreturn sys_rt_sigreturn |
69 | #define sys_sigaltstack sys_sigaltstack | ||
70 | 68 | ||
71 | /* These are the intvec*.S trampolines. */ | 69 | /* These are the intvec*.S trampolines. */ |
72 | long _sys_rt_sigreturn(void); | 70 | long _sys_rt_sigreturn(void); |
diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h index 6ac21034f69a..940831fe9e94 100644 --- a/arch/tile/include/asm/unistd.h +++ b/arch/tile/include/asm/unistd.h | |||
@@ -14,7 +14,6 @@ | |||
14 | /* In compat mode, we use sys_llseek() for compat_sys_llseek(). */ | 14 | /* In compat mode, we use sys_llseek() for compat_sys_llseek(). */ |
15 | #ifdef CONFIG_COMPAT | 15 | #ifdef CONFIG_COMPAT |
16 | #define __ARCH_WANT_SYS_LLSEEK | 16 | #define __ARCH_WANT_SYS_LLSEEK |
17 | #define __ARCH_WANT_COMPAT_SYS_SCHED_RR_GET_INTERVAL | ||
18 | #endif | 17 | #endif |
19 | #define __ARCH_WANT_SYS_NEWFSTATAT | 18 | #define __ARCH_WANT_SYS_NEWFSTATAT |
20 | #define __ARCH_WANT_SYS_CLONE | 19 | #define __ARCH_WANT_SYS_CLONE |
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 2e4cc69224a6..d0a052e725be 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
@@ -34,19 +34,6 @@ | |||
34 | #include <asm/syscalls.h> | 34 | #include <asm/syscalls.h> |
35 | #include <arch/interrupts.h> | 35 | #include <arch/interrupts.h> |
36 | 36 | ||
37 | struct compat_sigaction { | ||
38 | compat_uptr_t sa_handler; | ||
39 | compat_ulong_t sa_flags; | ||
40 | compat_uptr_t sa_restorer; | ||
41 | sigset_t sa_mask __packed; | ||
42 | }; | ||
43 | |||
44 | struct compat_sigaltstack { | ||
45 | compat_uptr_t ss_sp; | ||
46 | int ss_flags; | ||
47 | compat_size_t ss_size; | ||
48 | }; | ||
49 | |||
50 | struct compat_ucontext { | 37 | struct compat_ucontext { |
51 | compat_ulong_t uc_flags; | 38 | compat_ulong_t uc_flags; |
52 | compat_uptr_t uc_link; | 39 | compat_uptr_t uc_link; |
@@ -61,63 +48,6 @@ struct compat_rt_sigframe { | |||
61 | struct compat_ucontext uc; | 48 | struct compat_ucontext uc; |
62 | }; | 49 | }; |
63 | 50 | ||
64 | long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, | ||
65 | struct compat_sigaction __user *oact, | ||
66 | size_t sigsetsize) | ||
67 | { | ||
68 | struct k_sigaction new_sa, old_sa; | ||
69 | int ret = -EINVAL; | ||
70 | |||
71 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
72 | if (sigsetsize != sizeof(sigset_t)) | ||
73 | goto out; | ||
74 | |||
75 | if (act) { | ||
76 | compat_uptr_t handler, restorer; | ||
77 | |||
78 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | ||
79 | __get_user(handler, &act->sa_handler) || | ||
80 | __get_user(new_sa.sa.sa_flags, &act->sa_flags) || | ||
81 | __get_user(restorer, &act->sa_restorer) || | ||
82 | __copy_from_user(&new_sa.sa.sa_mask, &act->sa_mask, | ||
83 | sizeof(sigset_t))) | ||
84 | return -EFAULT; | ||
85 | new_sa.sa.sa_handler = compat_ptr(handler); | ||
86 | new_sa.sa.sa_restorer = compat_ptr(restorer); | ||
87 | } | ||
88 | |||
89 | ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL); | ||
90 | |||
91 | if (!ret && oact) { | ||
92 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | ||
93 | __put_user(ptr_to_compat(old_sa.sa.sa_handler), | ||
94 | &oact->sa_handler) || | ||
95 | __put_user(ptr_to_compat(old_sa.sa.sa_restorer), | ||
96 | &oact->sa_restorer) || | ||
97 | __put_user(old_sa.sa.sa_flags, &oact->sa_flags) || | ||
98 | __copy_to_user(&oact->sa_mask, &old_sa.sa.sa_mask, | ||
99 | sizeof(sigset_t))) | ||
100 | return -EFAULT; | ||
101 | } | ||
102 | out: | ||
103 | return ret; | ||
104 | } | ||
105 | |||
106 | long compat_sys_rt_sigqueueinfo(int pid, int sig, | ||
107 | struct compat_siginfo __user *uinfo) | ||
108 | { | ||
109 | siginfo_t info; | ||
110 | int ret; | ||
111 | mm_segment_t old_fs = get_fs(); | ||
112 | |||
113 | if (copy_siginfo_from_user32(&info, uinfo)) | ||
114 | return -EFAULT; | ||
115 | set_fs(KERNEL_DS); | ||
116 | ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __force __user *)&info); | ||
117 | set_fs(old_fs); | ||
118 | return ret; | ||
119 | } | ||
120 | |||
121 | int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) | 51 | int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) |
122 | { | 52 | { |
123 | int err; | 53 | int err; |
@@ -196,40 +126,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) | |||
196 | return err; | 126 | return err; |
197 | } | 127 | } |
198 | 128 | ||
199 | long compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, | ||
200 | struct compat_sigaltstack __user *uoss_ptr) | ||
201 | { | ||
202 | stack_t uss, uoss; | ||
203 | int ret; | ||
204 | mm_segment_t seg; | ||
205 | |||
206 | if (uss_ptr) { | ||
207 | u32 ptr; | ||
208 | |||
209 | memset(&uss, 0, sizeof(stack_t)); | ||
210 | if (!access_ok(VERIFY_READ, uss_ptr, sizeof(*uss_ptr)) || | ||
211 | __get_user(ptr, &uss_ptr->ss_sp) || | ||
212 | __get_user(uss.ss_flags, &uss_ptr->ss_flags) || | ||
213 | __get_user(uss.ss_size, &uss_ptr->ss_size)) | ||
214 | return -EFAULT; | ||
215 | uss.ss_sp = compat_ptr(ptr); | ||
216 | } | ||
217 | seg = get_fs(); | ||
218 | set_fs(KERNEL_DS); | ||
219 | ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL, | ||
220 | (stack_t __user __force *)&uoss, | ||
221 | (unsigned long)compat_ptr(current_pt_regs()->sp)); | ||
222 | set_fs(seg); | ||
223 | if (ret >= 0 && uoss_ptr) { | ||
224 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(*uoss_ptr)) || | ||
225 | __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) || | ||
226 | __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) || | ||
227 | __put_user(uoss.ss_size, &uoss_ptr->ss_size)) | ||
228 | ret = -EFAULT; | ||
229 | } | ||
230 | return ret; | ||
231 | } | ||
232 | |||
233 | /* The assembly shim for this function arranges to ignore the return value. */ | 129 | /* The assembly shim for this function arranges to ignore the return value. */ |
234 | long compat_sys_rt_sigreturn(void) | 130 | long compat_sys_rt_sigreturn(void) |
235 | { | 131 | { |
@@ -248,7 +144,7 @@ long compat_sys_rt_sigreturn(void) | |||
248 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 144 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
249 | goto badframe; | 145 | goto badframe; |
250 | 146 | ||
251 | if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL) == -EFAULT) | 147 | if (compat_restore_altstack(&frame->uc.uc_stack)) |
252 | goto badframe; | 148 | goto badframe; |
253 | 149 | ||
254 | return 0; | 150 | return 0; |
@@ -325,11 +221,7 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
325 | err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); | 221 | err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); |
326 | err |= __put_user(0, &frame->uc.uc_flags); | 222 | err |= __put_user(0, &frame->uc.uc_flags); |
327 | err |= __put_user(0, &frame->uc.uc_link); | 223 | err |= __put_user(0, &frame->uc.uc_link); |
328 | err |= __put_user(ptr_to_compat((void *)(current->sas_ss_sp)), | 224 | err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); |
329 | &frame->uc.uc_stack.ss_sp); | ||
330 | err |= __put_user(sas_ss_flags(regs->sp), | ||
331 | &frame->uc.uc_stack.ss_flags); | ||
332 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
333 | err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); | 225 | err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); |
334 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 226 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
335 | if (err) | 227 | if (err) |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index 657a7ace4ab4..9531845bf661 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
@@ -37,13 +37,6 @@ | |||
37 | 37 | ||
38 | #define DEBUG_SIG 0 | 38 | #define DEBUG_SIG 0 |
39 | 39 | ||
40 | SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss, | ||
41 | stack_t __user *, uoss) | ||
42 | { | ||
43 | return do_sigaltstack(uss, uoss, current_pt_regs()->sp); | ||
44 | } | ||
45 | |||
46 | |||
47 | /* | 40 | /* |
48 | * Do a signal return; undo the signal stack. | 41 | * Do a signal return; undo the signal stack. |
49 | */ | 42 | */ |
@@ -100,7 +93,7 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
100 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 93 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
101 | goto badframe; | 94 | goto badframe; |
102 | 95 | ||
103 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT) | 96 | if (restore_altstack(&frame->uc.uc_stack)) |
104 | goto badframe; | 97 | goto badframe; |
105 | 98 | ||
106 | return 0; | 99 | return 0; |
@@ -191,11 +184,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
191 | err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); | 184 | err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); |
192 | err |= __put_user(0, &frame->uc.uc_flags); | 185 | err |= __put_user(0, &frame->uc.uc_flags); |
193 | err |= __put_user(NULL, &frame->uc.uc_link); | 186 | err |= __put_user(NULL, &frame->uc.uc_link); |
194 | err |= __put_user((void __user *)(current->sas_ss_sp), | 187 | err |= __save_altstack(&frame->uc.uc_stack, regs->sp); |
195 | &frame->uc.uc_stack.ss_sp); | ||
196 | err |= __put_user(sas_ss_flags(regs->sp), | ||
197 | &frame->uc.uc_stack.ss_flags); | ||
198 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
199 | err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); | 188 | err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); |
200 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 189 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
201 | if (err) | 190 | if (err) |