diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 21:50:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 21:50:11 -0500 |
commit | 9e2d59ad580d590134285f361a0e80f0e98c0207 (patch) | |
tree | f3232be75781484193413f32ec82c21f6d8eb76e /arch/cris/arch-v10/kernel | |
parent | 5ce1a70e2f00f0bce0cab57f798ca354b9496169 (diff) | |
parent | 235b80226b986dabcbba844968f7807866bd0bfe (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/cris/arch-v10/kernel')
-rw-r--r-- | arch/cris/arch-v10/kernel/signal.c | 65 |
1 files changed, 7 insertions, 58 deletions
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c index 0bb477c13a4e..61ce6273a895 100644 --- a/arch/cris/arch-v10/kernel/signal.c +++ b/arch/cris/arch-v10/kernel/signal.c | |||
@@ -42,55 +42,6 @@ | |||
42 | void do_signal(int canrestart, struct pt_regs *regs); | 42 | void do_signal(int canrestart, struct pt_regs *regs); |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Atomically swap in the new signal mask, and wait for a signal. Define | ||
46 | * dummy arguments to be able to reach the regs argument. (Note that this | ||
47 | * arrangement relies on old_sigset_t occupying one register.) | ||
48 | */ | ||
49 | int sys_sigsuspend(old_sigset_t mask) | ||
50 | { | ||
51 | sigset_t blocked; | ||
52 | siginitset(&blocked, mask); | ||
53 | return sigsuspend(&blocked); | ||
54 | } | ||
55 | |||
56 | int sys_sigaction(int sig, const struct old_sigaction __user *act, | ||
57 | struct old_sigaction *oact) | ||
58 | { | ||
59 | struct k_sigaction new_ka, old_ka; | ||
60 | int ret; | ||
61 | |||
62 | if (act) { | ||
63 | old_sigset_t mask; | ||
64 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | ||
65 | __get_user(new_ka.sa.sa_handler, &act->sa_handler) || | ||
66 | __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) || | ||
67 | __get_user(new_ka.sa.sa_flags, &act->sa_flags) || | ||
68 | __get_user(mask, &act->sa_mask)) | ||
69 | return -EFAULT; | ||
70 | siginitset(&new_ka.sa.sa_mask, mask); | ||
71 | } | ||
72 | |||
73 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | ||
74 | |||
75 | if (!ret && oact) { | ||
76 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | ||
77 | __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || | ||
78 | __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) || | ||
79 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags) || | ||
80 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask)) | ||
81 | return -EFAULT; | ||
82 | } | ||
83 | |||
84 | return ret; | ||
85 | } | ||
86 | |||
87 | int sys_sigaltstack(const stack_t *uss, stack_t __user *uoss) | ||
88 | { | ||
89 | return do_sigaltstack(uss, uoss, rdusp()); | ||
90 | } | ||
91 | |||
92 | |||
93 | /* | ||
94 | * Do a signal return; undo the signal stack. | 45 | * Do a signal return; undo the signal stack. |
95 | */ | 46 | */ |
96 | 47 | ||
@@ -150,11 +101,9 @@ badframe: | |||
150 | return 1; | 101 | return 1; |
151 | } | 102 | } |
152 | 103 | ||
153 | /* Define dummy arguments to be able to reach the regs argument. */ | 104 | asmlinkage int sys_sigreturn(void) |
154 | |||
155 | asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof, | ||
156 | long srp, struct pt_regs *regs) | ||
157 | { | 105 | { |
106 | struct pt_regs *regs = current_pt_regs(); | ||
158 | struct sigframe __user *frame = (struct sigframe *)rdusp(); | 107 | struct sigframe __user *frame = (struct sigframe *)rdusp(); |
159 | sigset_t set; | 108 | sigset_t set; |
160 | 109 | ||
@@ -188,11 +137,9 @@ badframe: | |||
188 | return 0; | 137 | return 0; |
189 | } | 138 | } |
190 | 139 | ||
191 | /* Define dummy arguments to be able to reach the regs argument. */ | 140 | asmlinkage int sys_rt_sigreturn(void) |
192 | |||
193 | asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, | ||
194 | long mof, long srp, struct pt_regs *regs) | ||
195 | { | 141 | { |
142 | struct pt_regs *regs = current_pt_regs(); | ||
196 | struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp(); | 143 | struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp(); |
197 | sigset_t set; | 144 | sigset_t set; |
198 | 145 | ||
@@ -214,7 +161,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, | |||
214 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 161 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
215 | goto badframe; | 162 | goto badframe; |
216 | 163 | ||
217 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT) | 164 | if (restore_altstack(&frame->uc.uc_stack)) |
218 | goto badframe; | 165 | goto badframe; |
219 | 166 | ||
220 | return regs->r10; | 167 | return regs->r10; |
@@ -362,6 +309,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
362 | 309 | ||
363 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 310 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
364 | 311 | ||
312 | err |= __save_altstack(&frame->uc.uc_stack, rdusp()); | ||
313 | |||
365 | if (err) | 314 | if (err) |
366 | goto give_sigsegv; | 315 | goto give_sigsegv; |
367 | 316 | ||