aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv/kernel/signal.c')
-rw-r--r--arch/frv/kernel/signal.c57
1 files changed, 10 insertions, 47 deletions
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index 595bf1e5a5dc..f3b9064c548c 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -28,8 +28,6 @@
28 28
29#define DEBUG_SIG 0 29#define DEBUG_SIG 0
30 30
31#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
32
33struct fdpic_func_descriptor { 31struct fdpic_func_descriptor {
34 unsigned long text; 32 unsigned long text;
35 unsigned long GOT; 33 unsigned long GOT;
@@ -149,7 +147,6 @@ asmlinkage int sys_sigreturn(void)
149 __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask))) 147 __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask)))
150 goto badframe; 148 goto badframe;
151 149
152 sigdelsetmask(&set, ~_BLOCKABLE);
153 set_current_blocked(&set); 150 set_current_blocked(&set);
154 151
155 if (restore_sigcontext(&frame->sc, &gr8)) 152 if (restore_sigcontext(&frame->sc, &gr8))
@@ -172,7 +169,6 @@ asmlinkage int sys_rt_sigreturn(void)
172 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 169 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
173 goto badframe; 170 goto badframe;
174 171
175 sigdelsetmask(&set, ~_BLOCKABLE);
176 set_current_blocked(&set); 172 set_current_blocked(&set);
177 173
178 if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) 174 if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8))
@@ -426,9 +422,10 @@ give_sigsegv:
426/* 422/*
427 * OK, we're invoking a handler 423 * OK, we're invoking a handler
428 */ 424 */
429static int handle_signal(unsigned long sig, siginfo_t *info, 425static void handle_signal(unsigned long sig, siginfo_t *info,
430 struct k_sigaction *ka, sigset_t *oldset) 426 struct k_sigaction *ka)
431{ 427{
428 sigset_t *oldset = sigmask_to_save();
432 int ret; 429 int ret;
433 430
434 /* Are we from a system call? */ 431 /* Are we from a system call? */
@@ -460,11 +457,11 @@ static int handle_signal(unsigned long sig, siginfo_t *info,
460 else 457 else
461 ret = setup_frame(sig, ka, oldset); 458 ret = setup_frame(sig, ka, oldset);
462 459
463 if (ret == 0) 460 if (ret)
464 block_sigmask(ka, sig); 461 return;
465
466 return ret;
467 462
463 signal_delivered(sig, info, ka, __frame,
464 test_thread_flag(TIF_SINGLESTEP));
468} /* end handle_signal() */ 465} /* end handle_signal() */
469 466
470/*****************************************************************************/ 467/*****************************************************************************/
@@ -477,44 +474,14 @@ static void do_signal(void)
477{ 474{
478 struct k_sigaction ka; 475 struct k_sigaction ka;
479 siginfo_t info; 476 siginfo_t info;
480 sigset_t *oldset;
481 int signr; 477 int signr;
482 478
483 /*
484 * We want the common case to go fast, which
485 * is why we may in certain cases get here from
486 * kernel mode. Just return without doing anything
487 * if so.
488 */
489 if (!user_mode(__frame))
490 return;
491
492 if (try_to_freeze())
493 goto no_signal;
494
495 if (test_thread_flag(TIF_RESTORE_SIGMASK))
496 oldset = &current->saved_sigmask;
497 else
498 oldset = &current->blocked;
499
500 signr = get_signal_to_deliver(&info, &ka, __frame, NULL); 479 signr = get_signal_to_deliver(&info, &ka, __frame, NULL);
501 if (signr > 0) { 480 if (signr > 0) {
502 if (handle_signal(signr, &info, &ka, oldset) == 0) { 481 handle_signal(signr, &info, &ka);
503 /* a signal was successfully delivered; the saved
504 * sigmask will have been stored in the signal frame,
505 * and will be restored by sigreturn, so we can simply
506 * clear the TIF_RESTORE_SIGMASK flag */
507 if (test_thread_flag(TIF_RESTORE_SIGMASK))
508 clear_thread_flag(TIF_RESTORE_SIGMASK);
509
510 tracehook_signal_handler(signr, &info, &ka, __frame,
511 test_thread_flag(TIF_SINGLESTEP));
512 }
513
514 return; 482 return;
515 } 483 }
516 484
517no_signal:
518 /* Did we come from a system call? */ 485 /* Did we come from a system call? */
519 if (__frame->syscallno != -1) { 486 if (__frame->syscallno != -1) {
520 /* Restart the system call - no handlers present */ 487 /* Restart the system call - no handlers present */
@@ -536,11 +503,7 @@ no_signal:
536 503
537 /* if there's no signal to deliver, we just put the saved sigmask 504 /* if there's no signal to deliver, we just put the saved sigmask
538 * back */ 505 * back */
539 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 506 restore_saved_sigmask();
540 clear_thread_flag(TIF_RESTORE_SIGMASK);
541 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
542 }
543
544} /* end do_signal() */ 507} /* end do_signal() */
545 508
546/*****************************************************************************/ 509/*****************************************************************************/
@@ -555,7 +518,7 @@ asmlinkage void do_notify_resume(__u32 thread_info_flags)
555 clear_thread_flag(TIF_SINGLESTEP); 518 clear_thread_flag(TIF_SINGLESTEP);
556 519
557 /* deal with pending signal delivery */ 520 /* deal with pending signal delivery */
558 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 521 if (thread_info_flags & _TIF_SIGPENDING))
559 do_signal(); 522 do_signal();
560 523
561 /* deal with notification on about to resume userspace execution */ 524 /* deal with notification on about to resume userspace execution */