aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-12-25 19:18:40 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-03 22:43:35 -0500
commita274bd498ce4b57294034d428b801b2bca3af774 (patch)
tree18ec27dca96e7a38f0bc0db67012d8954ae487fc
parentbdc40abf070eab82d27de99ef5ff62a1c5de238d (diff)
sparc: switch to use of generic old sigaction
note that due to historical accident we do *not* directly take generic versions - need to check and invert the sign of signal number first. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/sparc/Kconfig2
-rw-r--r--arch/sparc/include/uapi/asm/signal.h2
-rw-r--r--arch/sparc/kernel/sys32.S2
-rw-r--r--arch/sparc/kernel/sys_sparc32.c37
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c37
-rw-r--r--arch/sparc/kernel/systbls_32.S2
6 files changed, 13 insertions, 69 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9d2c395440df..1a8ef82b3475 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -53,6 +53,7 @@ config SPARC32
53 select GENERIC_ATOMIC64 53 select GENERIC_ATOMIC64
54 select CLZ_TAB 54 select CLZ_TAB
55 select HAVE_UID16 55 select HAVE_UID16
56 select OLD_SIGACTION
56 57
57config SPARC64 58config SPARC64
58 def_bool 64BIT 59 def_bool 64BIT
@@ -549,6 +550,7 @@ config COMPAT
549 select COMPAT_BINFMT_ELF 550 select COMPAT_BINFMT_ELF
550 select HAVE_UID16 551 select HAVE_UID16
551 select ARCH_WANT_OLD_COMPAT_IPC 552 select ARCH_WANT_OLD_COMPAT_IPC
553 select COMPAT_OLD_SIGACTION
552 554
553config SYSVIPC_COMPAT 555config SYSVIPC_COMPAT
554 bool 556 bool
diff --git a/arch/sparc/include/uapi/asm/signal.h b/arch/sparc/include/uapi/asm/signal.h
index 284836f0b7dc..f387400fcfdf 100644
--- a/arch/sparc/include/uapi/asm/signal.h
+++ b/arch/sparc/include/uapi/asm/signal.h
@@ -160,7 +160,6 @@ struct __new_sigaction {
160 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */ 160 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
161 __new_sigset_t sa_mask; 161 __new_sigset_t sa_mask;
162}; 162};
163#endif
164 163
165struct __old_sigaction { 164struct __old_sigaction {
166 __sighandler_t sa_handler; 165 __sighandler_t sa_handler;
@@ -168,6 +167,7 @@ struct __old_sigaction {
168 unsigned long sa_flags; 167 unsigned long sa_flags;
169 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */ 168 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
170}; 169};
170#endif
171 171
172typedef struct sigaltstack { 172typedef struct sigaltstack {
173 void __user *ss_sp; 173 void __user *ss_sp;
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index 8475a474273a..9d2e99658aff 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -60,7 +60,7 @@ SIGN1(sys32_setitimer, compat_sys_setitimer, %o0)
60SIGN1(sys32_getitimer, compat_sys_getitimer, %o0) 60SIGN1(sys32_getitimer, compat_sys_getitimer, %o0)
61SIGN1(sys32_sethostname, sys_sethostname, %o1) 61SIGN1(sys32_sethostname, sys_sethostname, %o1)
62SIGN1(sys32_swapon, sys_swapon, %o1) 62SIGN1(sys32_swapon, sys_swapon, %o1)
63SIGN1(sys32_sigaction, compat_sys_sigaction, %o0) 63SIGN1(sys32_sigaction, compat_sys_sparc_sigaction, %o0)
64SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0) 64SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0)
65SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0) 65SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0)
66SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0) 66SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0)
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 4e96771a1b59..dcce0a6216cf 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -211,41 +211,12 @@ asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
211 return sys_sysfs(option, arg1, arg2); 211 return sys_sysfs(option, arg1, arg2);
212} 212}
213 213
214asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act, 214COMPAT_SYSCALL_DEFINE3(sparc_sigaction, int, sig,
215 struct old_sigaction32 __user *oact) 215 struct compat_old_sigaction __user *,act,
216 struct compat_old_sigaction __user *,oact)
216{ 217{
217 struct k_sigaction new_ka, old_ka;
218 int ret;
219
220 WARN_ON_ONCE(sig >= 0); 218 WARN_ON_ONCE(sig >= 0);
221 sig = -sig; 219 return compat_sys_sigaction(-sig, act, oact);
222
223 if (act) {
224 compat_old_sigset_t mask;
225 u32 u_handler, u_restorer;
226
227 ret = get_user(u_handler, &act->sa_handler);
228 new_ka.sa.sa_handler = compat_ptr(u_handler);
229 ret |= __get_user(u_restorer, &act->sa_restorer);
230 new_ka.sa.sa_restorer = compat_ptr(u_restorer);
231 ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
232 ret |= __get_user(mask, &act->sa_mask);
233 if (ret)
234 return ret;
235 new_ka.ka_restorer = NULL;
236 siginitset(&new_ka.sa.sa_mask, mask);
237 }
238
239 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
240
241 if (!ret && oact) {
242 ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), &oact->sa_handler);
243 ret |= __put_user(ptr_to_compat(old_ka.sa.sa_restorer), &oact->sa_restorer);
244 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
245 ret |= __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
246 }
247
248 return ret;
249} 220}
250 221
251COMPAT_SYSCALL_DEFINE5(rt_sigaction, int, sig, 222COMPAT_SYSCALL_DEFINE5(rt_sigaction, int, sig,
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index cdd2d7035930..3a8d1844402e 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -160,41 +160,12 @@ sparc_breakpoint (struct pt_regs *regs)
160#endif 160#endif
161} 161}
162 162
163asmlinkage int 163SYSCALL_DEFINE3(sparc_sigaction, int, sig,
164sparc_sigaction (int sig, const struct old_sigaction __user *act, 164 struct old_sigaction __user *,act,
165 struct old_sigaction __user *oact) 165 struct old_sigaction __user *,oact)
166{ 166{
167 struct k_sigaction new_ka, old_ka;
168 int ret;
169
170 WARN_ON_ONCE(sig >= 0); 167 WARN_ON_ONCE(sig >= 0);
171 sig = -sig; 168 return sys_sigaction(-sig, act, oact);
172
173 if (act) {
174 unsigned long mask;
175
176 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
177 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
178 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
179 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
180 __get_user(mask, &act->sa_mask))
181 return -EFAULT;
182 siginitset(&new_ka.sa.sa_mask, mask);
183 new_ka.ka_restorer = NULL;
184 }
185
186 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
187
188 if (!ret && oact) {
189 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
190 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
191 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
192 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
193 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
194 return -EFAULT;
195 }
196
197 return ret;
198} 169}
199 170
200SYSCALL_DEFINE5(rt_sigaction, int, sig, 171SYSCALL_DEFINE5(rt_sigaction, int, sig,
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 6ac43c36bbbf..7b87171ecf1e 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -55,7 +55,7 @@ sys_call_table:
55/*180*/ .long sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_sigpending, sys_ni_syscall 55/*180*/ .long sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_sigpending, sys_ni_syscall
56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname 56/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl 57/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl
58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask 58/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_sparc_sigaction, sys_sgetmask
59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir 59/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, sys_old_readdir
60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 60/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 61/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo