aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-12-25 19:27:42 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-03 18:16:10 -0500
commit09a4d5d015d951c7262d999cbd39f5c2cd5786da (patch)
treeb3e6d4bdd78ceef78c2407e11ce3fac5c5fbce09 /arch
parent5aa1cde2edbc64403a6b06aaa8723cca11c12681 (diff)
powerpc: switch to generic old sigaction()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/include/uapi/asm/signal.h2
-rw-r--r--arch/powerpc/kernel/ppc32.h9
-rw-r--r--arch/powerpc/kernel/signal_32.c65
4 files changed, 3 insertions, 75 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bec7808b7b0f..ec89a7b11f7b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -150,6 +150,7 @@ config PPC
150 select GENERIC_COMPAT_RT_SIGPROCMASK 150 select GENERIC_COMPAT_RT_SIGPROCMASK
151 select GENERIC_COMPAT_RT_SIGPENDING 151 select GENERIC_COMPAT_RT_SIGPENDING
152 select OLD_SIGSUSPEND 152 select OLD_SIGSUSPEND
153 select OLD_SIGACTION if PPC32
153 154
154config EARLY_PRINTK 155config EARLY_PRINTK
155 bool 156 bool
@@ -160,6 +161,7 @@ config COMPAT
160 default y if PPC64 161 default y if PPC64
161 select COMPAT_BINFMT_ELF 162 select COMPAT_BINFMT_ELF
162 select ARCH_WANT_OLD_COMPAT_IPC 163 select ARCH_WANT_OLD_COMPAT_IPC
164 select COMPAT_OLD_SIGACTION
163 165
164config SYSVIPC_COMPAT 166config SYSVIPC_COMPAT
165 bool 167 bool
diff --git a/arch/powerpc/include/uapi/asm/signal.h b/arch/powerpc/include/uapi/asm/signal.h
index 6defdd65594e..6c69ee94fd8d 100644
--- a/arch/powerpc/include/uapi/asm/signal.h
+++ b/arch/powerpc/include/uapi/asm/signal.h
@@ -90,6 +90,7 @@ typedef struct {
90 90
91#include <asm-generic/signal-defs.h> 91#include <asm-generic/signal-defs.h>
92 92
93#ifndef __KERNEL__
93struct old_sigaction { 94struct old_sigaction {
94 __sighandler_t sa_handler; 95 __sighandler_t sa_handler;
95 old_sigset_t sa_mask; 96 old_sigset_t sa_mask;
@@ -97,7 +98,6 @@ struct old_sigaction {
97 __sigrestore_t sa_restorer; 98 __sigrestore_t sa_restorer;
98}; 99};
99 100
100#ifndef __KERNEL__
101struct sigaction { 101struct sigaction {
102 __sighandler_t sa_handler; 102 __sighandler_t sa_handler;
103 unsigned long sa_flags; 103 unsigned long sa_flags;
diff --git a/arch/powerpc/kernel/ppc32.h b/arch/powerpc/kernel/ppc32.h
index fe92b0d0603a..a27c914d5802 100644
--- a/arch/powerpc/kernel/ppc32.h
+++ b/arch/powerpc/kernel/ppc32.h
@@ -16,15 +16,6 @@
16 16
17/* These are here to support 32-bit syscalls on a 64-bit kernel. */ 17/* These are here to support 32-bit syscalls on a 64-bit kernel. */
18 18
19#define __old_sigaction32 old_sigaction32
20
21struct __old_sigaction32 {
22 compat_uptr_t sa_handler;
23 compat_old_sigset_t sa_mask;
24 unsigned int sa_flags;
25 compat_uptr_t sa_restorer; /* not used by Linux/SPARC yet */
26};
27
28struct pt_regs32 { 19struct pt_regs32 {
29 unsigned int gpr[32]; 20 unsigned int gpr[32];
30 unsigned int nip; 21 unsigned int nip;
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 16ec1c9899ad..802ab5ea36cb 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -57,7 +57,6 @@
57 57
58#ifdef CONFIG_PPC64 58#ifdef CONFIG_PPC64
59#define sys_rt_sigreturn compat_sys_rt_sigreturn 59#define sys_rt_sigreturn compat_sys_rt_sigreturn
60#define sys_sigaction compat_sys_sigaction
61#define sys_swapcontext compat_sys_swapcontext 60#define sys_swapcontext compat_sys_swapcontext
62#define sys_sigreturn compat_sys_sigreturn 61#define sys_sigreturn compat_sys_sigreturn
63 62
@@ -130,23 +129,6 @@ static inline int get_sigset_t(sigset_t *set,
130 return 0; 129 return 0;
131} 130}
132 131
133static inline int get_old_sigaction(struct k_sigaction *new_ka,
134 struct old_sigaction __user *act)
135{
136 compat_old_sigset_t mask;
137 compat_uptr_t handler, restorer;
138
139 if (get_user(handler, &act->sa_handler) ||
140 __get_user(restorer, &act->sa_restorer) ||
141 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
142 __get_user(mask, &act->sa_mask))
143 return -EFAULT;
144 new_ka->sa.sa_handler = compat_ptr(handler);
145 new_ka->sa.sa_restorer = compat_ptr(restorer);
146 siginitset(&new_ka->sa.sa_mask, mask);
147 return 0;
148}
149
150#define to_user_ptr(p) ptr_to_compat(p) 132#define to_user_ptr(p) ptr_to_compat(p)
151#define from_user_ptr(p) compat_ptr(p) 133#define from_user_ptr(p) compat_ptr(p)
152 134
@@ -196,21 +178,6 @@ static inline int get_sigset_t(sigset_t *set, const sigset_t __user *uset)
196 return copy_from_user(set, uset, sizeof(*uset)); 178 return copy_from_user(set, uset, sizeof(*uset));
197} 179}
198 180
199static inline int get_old_sigaction(struct k_sigaction *new_ka,
200 struct old_sigaction __user *act)
201{
202 old_sigset_t mask;
203
204 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
205 __get_user(new_ka->sa.sa_handler, &act->sa_handler) ||
206 __get_user(new_ka->sa.sa_restorer, &act->sa_restorer) ||
207 __get_user(new_ka->sa.sa_flags, &act->sa_flags) ||
208 __get_user(mask, &act->sa_mask))
209 return -EFAULT;
210 siginitset(&new_ka->sa.sa_mask, mask);
211 return 0;
212}
213
214#define to_user_ptr(p) ((unsigned long)(p)) 181#define to_user_ptr(p) ((unsigned long)(p))
215#define from_user_ptr(p) ((void __user *)(p)) 182#define from_user_ptr(p) ((void __user *)(p))
216 183
@@ -234,40 +201,8 @@ static inline int restore_general_regs(struct pt_regs *regs,
234 return -EFAULT; 201 return -EFAULT;
235 return 0; 202 return 0;
236} 203}
237
238#endif /* CONFIG_PPC64 */
239
240long sys_sigaction(int sig, struct old_sigaction __user *act,
241 struct old_sigaction __user *oact)
242{
243 struct k_sigaction new_ka, old_ka;
244 int ret;
245
246#ifdef CONFIG_PPC64
247 if (sig < 0)
248 sig = -sig;
249#endif 204#endif
250 205
251 if (act) {
252 if (get_old_sigaction(&new_ka, act))
253 return -EFAULT;
254 }
255
256 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
257 if (!ret && oact) {
258 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
259 __put_user(to_user_ptr(old_ka.sa.sa_handler),
260 &oact->sa_handler) ||
261 __put_user(to_user_ptr(old_ka.sa.sa_restorer),
262 &oact->sa_restorer) ||
263 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
264 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
265 return -EFAULT;
266 }
267
268 return ret;
269}
270
271/* 206/*
272 * When we have signals to deliver, we set up on the 207 * When we have signals to deliver, we set up on the
273 * user stack, going down from the original stack pointer: 208 * user stack, going down from the original stack pointer: