diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-23 03:50:34 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-03 18:16:21 -0500 |
commit | 47669ab0361558a734e42f78196636d70201e44f (patch) | |
tree | 4152f4be043a8eb8a507d380626d01bafbd7ef16 /arch/tile | |
parent | 0aa0203fb43f04714004b2c4ad33b858e240555d (diff) |
tile: switch to generic sigaltstack
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/Kconfig | 1 | ||||
-rw-r--r-- | arch/tile/include/asm/compat.h | 2 | ||||
-rw-r--r-- | arch/tile/include/asm/syscalls.h | 2 | ||||
-rw-r--r-- | arch/tile/kernel/compat_signal.c | 48 | ||||
-rw-r--r-- | arch/tile/kernel/signal.c | 15 |
5 files changed, 5 insertions, 63 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 875d008828b8..dae6ac1eac62 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -21,6 +21,7 @@ config TILE | |||
21 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 21 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
22 | select GENERIC_CLOCKEVENTS | 22 | select GENERIC_CLOCKEVENTS |
23 | select MODULES_USE_ELF_RELA | 23 | select MODULES_USE_ELF_RELA |
24 | select GENERIC_SIGALTSTACK | ||
24 | 25 | ||
25 | # FIXME: investigate whether we need/want these options. | 26 | # FIXME: investigate whether we need/want these options. |
26 | # select HAVE_IOREMAP_PROT | 27 | # select HAVE_IOREMAP_PROT |
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 88f3c227afd9..f11be1f2fe2f 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h | |||
@@ -281,8 +281,6 @@ long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, | |||
281 | long compat_sys_rt_sigqueueinfo(int pid, int sig, | 281 | long compat_sys_rt_sigqueueinfo(int pid, int sig, |
282 | struct compat_siginfo __user *uinfo); | 282 | struct compat_siginfo __user *uinfo); |
283 | long compat_sys_rt_sigreturn(void); | 283 | 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); | 284 | 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); | 285 | 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, | 286 | 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/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 2e4cc69224a6..6228be73cdf2 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
@@ -41,12 +41,6 @@ struct compat_sigaction { | |||
41 | sigset_t sa_mask __packed; | 41 | sigset_t sa_mask __packed; |
42 | }; | 42 | }; |
43 | 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 { | 44 | struct compat_ucontext { |
51 | compat_ulong_t uc_flags; | 45 | compat_ulong_t uc_flags; |
52 | compat_uptr_t uc_link; | 46 | compat_uptr_t uc_link; |
@@ -196,40 +190,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) | |||
196 | return err; | 190 | return err; |
197 | } | 191 | } |
198 | 192 | ||
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. */ | 193 | /* The assembly shim for this function arranges to ignore the return value. */ |
234 | long compat_sys_rt_sigreturn(void) | 194 | long compat_sys_rt_sigreturn(void) |
235 | { | 195 | { |
@@ -248,7 +208,7 @@ long compat_sys_rt_sigreturn(void) | |||
248 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 208 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
249 | goto badframe; | 209 | goto badframe; |
250 | 210 | ||
251 | if (compat_sys_sigaltstack(&frame->uc.uc_stack, NULL) == -EFAULT) | 211 | if (compat_restore_altstack(&frame->uc.uc_stack)) |
252 | goto badframe; | 212 | goto badframe; |
253 | 213 | ||
254 | return 0; | 214 | return 0; |
@@ -325,11 +285,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)); | 285 | err |= __clear_user(&frame->save_area, sizeof(frame->save_area)); |
326 | err |= __put_user(0, &frame->uc.uc_flags); | 286 | err |= __put_user(0, &frame->uc.uc_flags); |
327 | err |= __put_user(0, &frame->uc.uc_link); | 287 | err |= __put_user(0, &frame->uc.uc_link); |
328 | err |= __put_user(ptr_to_compat((void *)(current->sas_ss_sp)), | 288 | 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); | 289 | err |= setup_sigcontext(&frame->uc.uc_mcontext, regs); |
334 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 290 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
335 | if (err) | 291 | 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) |