aboutsummaryrefslogtreecommitdiffstats
path: root/arch/h8300
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 21:50:11 -0500
commit9e2d59ad580d590134285f361a0e80f0e98c0207 (patch)
treef3232be75781484193413f32ec82c21f6d8eb76e /arch/h8300
parent5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff)
parent235b80226b986dabcbba844968f7807866bd0bfe (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/h8300')
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/h8300/include/asm/signal.h18
-rw-r--r--arch/h8300/include/asm/unistd.h2
-rw-r--r--arch/h8300/kernel/signal.c72
-rw-r--r--arch/h8300/kernel/syscalls.S15
5 files changed, 11 insertions, 98 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 2d2efb653ee0..05b613af223a 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -9,6 +9,8 @@ config H8300
9 select GENERIC_IRQ_SHOW 9 select GENERIC_IRQ_SHOW
10 select GENERIC_CPU_DEVICES 10 select GENERIC_CPU_DEVICES
11 select MODULES_USE_ELF_RELA 11 select MODULES_USE_ELF_RELA
12 select OLD_SIGSUSPEND3
13 select OLD_SIGACTION
12 14
13config SYMBOL_PREFIX 15config SYMBOL_PREFIX
14 string 16 string
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h
index 66c81c67e55d..6341e36386f8 100644
--- a/arch/h8300/include/asm/signal.h
+++ b/arch/h8300/include/asm/signal.h
@@ -16,23 +16,7 @@ typedef struct {
16 unsigned long sig[_NSIG_WORDS]; 16 unsigned long sig[_NSIG_WORDS];
17} sigset_t; 17} sigset_t;
18 18
19struct old_sigaction { 19#define __ARCH_HAS_SA_RESTORER
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 void (*sa_restorer)(void);
24};
25
26struct sigaction {
27 __sighandler_t sa_handler;
28 unsigned long sa_flags;
29 void (*sa_restorer)(void);
30 sigset_t sa_mask; /* mask last for extensibility */
31};
32
33struct k_sigaction {
34 struct sigaction sa;
35};
36 20
37#include <asm/sigcontext.h> 21#include <asm/sigcontext.h>
38#undef __HAVE_ARCH_SIG_BITOPS 22#undef __HAVE_ARCH_SIG_BITOPS
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index aa38105959fb..6721856d841b 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -29,8 +29,6 @@
29#define __ARCH_WANT_SYS_OLDUMOUNT 29#define __ARCH_WANT_SYS_OLDUMOUNT
30#define __ARCH_WANT_SYS_SIGPENDING 30#define __ARCH_WANT_SYS_SIGPENDING
31#define __ARCH_WANT_SYS_SIGPROCMASK 31#define __ARCH_WANT_SYS_SIGPROCMASK
32#define __ARCH_WANT_SYS_RT_SIGACTION
33#define __ARCH_WANT_SYS_RT_SIGSUSPEND
34#define __ARCH_WANT_SYS_FORK 32#define __ARCH_WANT_SYS_FORK
35#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
36#define __ARCH_WANT_SYS_CLONE 34#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index 0e81b96c642f..a65ff3b76326 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -47,56 +47,6 @@
47#include <asm/ucontext.h> 47#include <asm/ucontext.h>
48 48
49/* 49/*
50 * Atomically swap in the new signal mask, and wait for a signal.
51 */
52asmlinkage int
53sys_sigsuspend(int unused1, int unused2, old_sigset_t mask)
54{
55 sigset_t blocked;
56 siginitset(&blocked, mask);
57 return sigsuspend(&blocked);
58}
59
60asmlinkage int
61sys_sigaction(int sig, const struct old_sigaction *act,
62 struct old_sigaction *oact)
63{
64 struct k_sigaction new_ka, old_ka;
65 int ret;
66
67 if (act) {
68 old_sigset_t mask;
69 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
70 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
71 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
72 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
73 __get_user(mask, &act->sa_mask))
74 return -EFAULT;
75 siginitset(&new_ka.sa.sa_mask, mask);
76 }
77
78 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
79
80 if (!ret && oact) {
81 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
82 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
83 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
84 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
85 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
86 return -EFAULT;
87 }
88
89 return ret;
90}
91
92asmlinkage int
93sys_sigaltstack(const stack_t *uss, stack_t *uoss)
94{
95 return do_sigaltstack(uss, uoss, rdusp());
96}
97
98
99/*
100 * Do a signal return; undo the signal stack. 50 * Do a signal return; undo the signal stack.
101 * 51 *
102 * Keep the return code on the stack quadword aligned! 52 * Keep the return code on the stack quadword aligned!
@@ -136,9 +86,9 @@ struct rt_sigframe
136} __attribute__((aligned(2),packed)); 86} __attribute__((aligned(2),packed));
137 87
138static inline int 88static inline int
139restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, 89restore_sigcontext(struct sigcontext *usc, int *pd0)
140 int *pd0)
141{ 90{
91 struct pt_regs *regs = current_pt_regs();
142 int err = 0; 92 int err = 0;
143 unsigned int ccr; 93 unsigned int ccr;
144 unsigned int usp; 94 unsigned int usp;
@@ -167,9 +117,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc,
167 return err; 117 return err;
168} 118}
169 119
170asmlinkage int do_sigreturn(unsigned long __unused,...) 120asmlinkage int sys_sigreturn(void)
171{ 121{
172 struct pt_regs *regs = (struct pt_regs *) (&__unused - 1);
173 unsigned long usp = rdusp(); 122 unsigned long usp = rdusp();
174 struct sigframe *frame = (struct sigframe *)(usp - 4); 123 struct sigframe *frame = (struct sigframe *)(usp - 4);
175 sigset_t set; 124 sigset_t set;
@@ -185,7 +134,7 @@ asmlinkage int do_sigreturn(unsigned long __unused,...)
185 134
186 set_current_blocked(&set); 135 set_current_blocked(&set);
187 136
188 if (restore_sigcontext(regs, &frame->sc, &er0)) 137 if (restore_sigcontext(&frame->sc, &er0))
189 goto badframe; 138 goto badframe;
190 return er0; 139 return er0;
191 140
@@ -194,9 +143,8 @@ badframe:
194 return 0; 143 return 0;
195} 144}
196 145
197asmlinkage int do_rt_sigreturn(unsigned long __unused,...) 146asmlinkage int sys_rt_sigreturn(void)
198{ 147{
199 struct pt_regs *regs = (struct pt_regs *) &__unused;
200 unsigned long usp = rdusp(); 148 unsigned long usp = rdusp();
201 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 149 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
202 sigset_t set; 150 sigset_t set;
@@ -209,10 +157,10 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...)
209 157
210 set_current_blocked(&set); 158 set_current_blocked(&set);
211 159
212 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0)) 160 if (restore_sigcontext(&frame->uc.uc_mcontext, &er0))
213 goto badframe; 161 goto badframe;
214 162
215 if (do_sigaltstack(&frame->uc.uc_stack, NULL, usp) == -EFAULT) 163 if (restore_altstack(&frame->uc.uc_stack))
216 goto badframe; 164 goto badframe;
217 165
218 return er0; 166 return er0;
@@ -358,11 +306,7 @@ static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
358 /* Create the ucontext. */ 306 /* Create the ucontext. */
359 err |= __put_user(0, &frame->uc.uc_flags); 307 err |= __put_user(0, &frame->uc.uc_flags);
360 err |= __put_user(0, &frame->uc.uc_link); 308 err |= __put_user(0, &frame->uc.uc_link);
361 err |= __put_user((void *)current->sas_ss_sp, 309 err |= __save_altstack(&frame->uc.uc_stack, rdusp());
362 &frame->uc.uc_stack.ss_sp);
363 err |= __put_user(sas_ss_flags(rdusp()),
364 &frame->uc.uc_stack.ss_flags);
365 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
366 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 310 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
367 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); 311 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
368 if (err) 312 if (err)
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index b74dd0ade58d..5c2168fb9b9e 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -334,18 +334,3 @@ SYMBOL_NAME_LABEL(sys_call_table)
334 .long SYMBOL_NAME(sys_getcpu) 334 .long SYMBOL_NAME(sys_getcpu)
335 .long SYMBOL_NAME(sys_ni_syscall) /* sys_epoll_pwait */ 335 .long SYMBOL_NAME(sys_ni_syscall) /* sys_epoll_pwait */
336 .long SYMBOL_NAME(sys_setns) /* 320 */ 336 .long SYMBOL_NAME(sys_setns) /* 320 */
337
338 .macro call_sp addr
339 mov.l #SYMBOL_NAME(\addr),er6
340 bra SYMBOL_NAME(syscall_trampoline):8
341 .endm
342
343SYMBOL_NAME_LABEL(sys_sigreturn)
344 call_sp do_sigreturn
345
346SYMBOL_NAME_LABEL(sys_rt_sigreturn)
347 call_sp do_rt_sigreturn
348
349SYMBOL_NAME_LABEL(syscall_trampoline)
350 mov.l sp,er0
351 jmp @er6