aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc/kernel/signal.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-06-01 14:53:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-06-01 14:53:44 -0400
commit86c47b70f62a7072d441ba212aab33c2f82627c2 (patch)
treed03988bd2226966352bb7f3c2e82ff545353d2c4 /arch/openrisc/kernel/signal.c
parent1193755ac6328ad240ba987e6ec41d5e8baf0680 (diff)
parent44fbbb3dc687c9709a6f2236197316e5c79ab1eb (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull third pile of signal handling patches from Al Viro: "This time it's mostly helpers and conversions to them; there's a lot of stuff remaining in the tree, but that'll either go in -rc2 (isolated bug fixes, ideally via arch maintainers' trees) or will sit there until the next cycle." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: x86: get rid of calling do_notify_resume() when returning to kernel mode blackfin: check __get_user() return value whack-a-mole with TIF_FREEZE FRV: Optimise the system call exit path in entry.S [ver #2] FRV: Shrink TIF_WORK_MASK [ver #2] FRV: Prevent syscall exit tracing and notify_resume at end of kernel exceptions new helper: signal_delivered() powerpc: get rid of restore_sigmask() most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set set_restore_sigmask() is never called without SIGPENDING (and never should be) TIF_RESTORE_SIGMASK can be set only when TIF_SIGPENDING is set don't call try_to_freeze() from do_signal() pull clearing RESTORE_SIGMASK into block_sigmask() sh64: failure to build sigframe != signal without handler openrisc: tracehook_signal_handler() is supposed to be called on success new helper: sigmask_to_save() new helper: restore_saved_sigmask() new helpers: {clear,test,test_and_clear}_restore_sigmask() HAVE_RESTORE_SIGMASK is defined on all architectures now
Diffstat (limited to 'arch/openrisc/kernel/signal.c')
-rw-r--r--arch/openrisc/kernel/signal.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 9ae611522953..30110297f4f9 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -33,8 +33,6 @@
33 33
34#define DEBUG_SIG 0 34#define DEBUG_SIG 0
35 35
36#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
37
38asmlinkage long 36asmlinkage long
39_sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) 37_sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
40{ 38{
@@ -101,7 +99,6 @@ asmlinkage long _sys_rt_sigreturn(struct pt_regs *regs)
101 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 99 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
102 goto badframe; 100 goto badframe;
103 101
104 sigdelsetmask(&set, ~_BLOCKABLE);
105 set_current_blocked(&set); 102 set_current_blocked(&set);
106 103
107 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 104 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
@@ -251,20 +248,19 @@ give_sigsegv:
251 return -EFAULT; 248 return -EFAULT;
252} 249}
253 250
254static inline int 251static inline void
255handle_signal(unsigned long sig, 252handle_signal(unsigned long sig,
256 siginfo_t *info, struct k_sigaction *ka, 253 siginfo_t *info, struct k_sigaction *ka,
257 sigset_t *oldset, struct pt_regs *regs) 254 struct pt_regs *regs)
258{ 255{
259 int ret; 256 int ret;
260 257
261 ret = setup_rt_frame(sig, ka, info, oldset, regs); 258 ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs);
262 if (ret) 259 if (ret)
263 return ret; 260 return;
264
265 block_sigmask(ka, sig);
266 261
267 return 0; 262 signal_delivered(sig, info, ka, regs,
263 test_thread_flag(TIF_SINGLESTEP));
268} 264}
269 265
270/* 266/*
@@ -339,30 +335,10 @@ void do_signal(struct pt_regs *regs)
339 if (signr <= 0) { 335 if (signr <= 0) {
340 /* no signal to deliver so we just put the saved sigmask 336 /* no signal to deliver so we just put the saved sigmask
341 * back */ 337 * back */
342 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 338 restore_saved_sigmask();
343 clear_thread_flag(TIF_RESTORE_SIGMASK);
344 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
345 }
346
347 } else { /* signr > 0 */ 339 } else { /* signr > 0 */
348 sigset_t *oldset;
349
350 if (current_thread_info()->flags & _TIF_RESTORE_SIGMASK)
351 oldset = &current->saved_sigmask;
352 else
353 oldset = &current->blocked;
354
355 /* Whee! Actually deliver the signal. */ 340 /* Whee! Actually deliver the signal. */
356 if (!handle_signal(signr, &info, &ka, oldset, regs)) { 341 handle_signal(signr, &info, &ka, regs);
357 /* a signal was successfully delivered; the saved
358 * sigmask will have been stored in the signal frame,
359 * and will be restored by sigreturn, so we can simply
360 * clear the TIF_RESTORE_SIGMASK flag */
361 clear_thread_flag(TIF_RESTORE_SIGMASK);
362 }
363
364 tracehook_signal_handler(signr, &info, &ka, regs,
365 test_thread_flag(TIF_SINGLESTEP));
366 } 342 }
367 343
368 return; 344 return;