aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-12-25 18:43:46 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-03 18:16:22 -0500
commita402922bff5f28469ec6bbc5066bda3556299f52 (patch)
tree4aa171c01d369e8e8ea1c34ba6629e5b944f9dee /arch
parent7b5d3c1d112d040b9eda239ec4ff247cf7102bd2 (diff)
tile: switch to generic compat rt_sigaction()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/tile/include/asm/compat.h4
-rw-r--r--arch/tile/kernel/compat_signal.c49
3 files changed, 1 insertions, 53 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index f81b2755b4be..96a717ebb1fa 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -22,6 +22,7 @@ config TILE
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 select GENERIC_SIGALTSTACK
25 select GENERIC_COMPAT_RT_SIGACTION
25 select GENERIC_COMPAT_RT_SIGQUEUEINFO 26 select GENERIC_COMPAT_RT_SIGQUEUEINFO
26 select GENERIC_COMPAT_RT_SIGPROCMASK 27 select GENERIC_COMPAT_RT_SIGPROCMASK
27 select GENERIC_COMPAT_RT_SIGPENDING 28 select GENERIC_COMPAT_RT_SIGPENDING
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index e81b70d025dd..001d418a8957 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -272,12 +272,8 @@ 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. */
275struct compat_sigaction;
276struct compat_siginfo; 275struct compat_siginfo;
277struct compat_sigaltstack; 276struct compat_sigaltstack;
278long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act,
279 struct compat_sigaction __user *oact,
280 size_t sigsetsize);
281long compat_sys_rt_sigreturn(void); 277long compat_sys_rt_sigreturn(void);
282long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high); 278long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high);
283long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high); 279long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high);
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 6773e620cbfc..d0a052e725be 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -34,13 +34,6 @@
34#include <asm/syscalls.h> 34#include <asm/syscalls.h>
35#include <arch/interrupts.h> 35#include <arch/interrupts.h>
36 36
37struct 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
44struct compat_ucontext { 37struct compat_ucontext {
45 compat_ulong_t uc_flags; 38 compat_ulong_t uc_flags;
46 compat_uptr_t uc_link; 39 compat_uptr_t uc_link;
@@ -55,48 +48,6 @@ struct compat_rt_sigframe {
55 struct compat_ucontext uc; 48 struct compat_ucontext uc;
56}; 49};
57 50
58long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act,
59 struct compat_sigaction __user *oact,
60 size_t sigsetsize)
61{
62 struct k_sigaction new_sa, old_sa;
63 int ret = -EINVAL;
64
65 /* XXX: Don't preclude handling different sized sigset_t's. */
66 if (sigsetsize != sizeof(sigset_t))
67 goto out;
68
69 if (act) {
70 compat_uptr_t handler, restorer;
71
72 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
73 __get_user(handler, &act->sa_handler) ||
74 __get_user(new_sa.sa.sa_flags, &act->sa_flags) ||
75 __get_user(restorer, &act->sa_restorer) ||
76 __copy_from_user(&new_sa.sa.sa_mask, &act->sa_mask,
77 sizeof(sigset_t)))
78 return -EFAULT;
79 new_sa.sa.sa_handler = compat_ptr(handler);
80 new_sa.sa.sa_restorer = compat_ptr(restorer);
81 }
82
83 ret = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
84
85 if (!ret && oact) {
86 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
87 __put_user(ptr_to_compat(old_sa.sa.sa_handler),
88 &oact->sa_handler) ||
89 __put_user(ptr_to_compat(old_sa.sa.sa_restorer),
90 &oact->sa_restorer) ||
91 __put_user(old_sa.sa.sa_flags, &oact->sa_flags) ||
92 __copy_to_user(&oact->sa_mask, &old_sa.sa.sa_mask,
93 sizeof(sigset_t)))
94 return -EFAULT;
95 }
96out:
97 return ret;
98}
99
100int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from) 51int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from)
101{ 52{
102 int err; 53 int err;