TIF_RESTORE_SIGMASK can be set only when TIF_SIGPENDING is set
[deliverable/linux.git] / arch / frv / kernel / signal.c
index 8cf5dca01758f75e63041d2c81edf1d8542bbb0c..9ec3d2e27b4c23ace494465b137ff382aa3d75c0 100644 (file)
@@ -426,9 +426,10 @@ give_sigsegv:
 /*
  * OK, we're invoking a handler
  */
-static int handle_signal(unsigned long sig, siginfo_t *info,
-                        struct k_sigaction *ka, sigset_t *oldset)
+static void handle_signal(unsigned long sig, siginfo_t *info,
+                        struct k_sigaction *ka)
 {
+       sigset_t *oldset = sigmask_to_save();
        int ret;
 
        /* Are we from a system call? */
@@ -460,11 +461,12 @@ static int handle_signal(unsigned long sig, siginfo_t *info,
        else
                ret = setup_frame(sig, ka, oldset);
 
-       if (ret == 0)
-               block_sigmask(ka, sig);
-
-       return ret;
+       if (ret)
+               return;
 
+       block_sigmask(ka, sig);
+       tracehook_signal_handler(sig, info, ka, __frame,
+                                test_thread_flag(TIF_SINGLESTEP));
 } /* end handle_signal() */
 
 /*****************************************************************************/
@@ -489,32 +491,12 @@ static void do_signal(void)
        if (!user_mode(__frame))
                return;
 
-       if (try_to_freeze())
-               goto no_signal;
-
-       if (test_thread_flag(TIF_RESTORE_SIGMASK))
-               oldset = &current->saved_sigmask;
-       else
-               oldset = &current->blocked;
-
        signr = get_signal_to_deliver(&info, &ka, __frame, NULL);
        if (signr > 0) {
-               if (handle_signal(signr, &info, &ka, oldset) == 0) {
-                       /* a signal was successfully delivered; the saved
-                        * sigmask will have been stored in the signal frame,
-                        * and will be restored by sigreturn, so we can simply
-                        * clear the TIF_RESTORE_SIGMASK flag */
-                       if (test_thread_flag(TIF_RESTORE_SIGMASK))
-                               clear_thread_flag(TIF_RESTORE_SIGMASK);
-
-                       tracehook_signal_handler(signr, &info, &ka, __frame,
-                                                test_thread_flag(TIF_SINGLESTEP));
-               }
-
+               handle_signal(signr, &info, &ka);
                return;
        }
 
-no_signal:
        /* Did we come from a system call? */
        if (__frame->syscallno != -1) {
                /* Restart the system call - no handlers present */
@@ -536,11 +518,7 @@ no_signal:
 
        /* if there's no signal to deliver, we just put the saved sigmask
         * back */
-       if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
-               clear_thread_flag(TIF_RESTORE_SIGMASK);
-               sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
-       }
-
+       restore_saved_sigmask();
 } /* end do_signal() */
 
 /*****************************************************************************/
@@ -555,15 +533,13 @@ asmlinkage void do_notify_resume(__u32 thread_info_flags)
                clear_thread_flag(TIF_SINGLESTEP);
 
        /* deal with pending signal delivery */
-       if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
+       if (thread_info_flags & _TIF_SIGPENDING))
                do_signal();
 
        /* deal with notification on about to resume userspace execution */
        if (thread_info_flags & _TIF_NOTIFY_RESUME) {
                clear_thread_flag(TIF_NOTIFY_RESUME);
                tracehook_notify_resume(__frame);
-               if (current->replacement_session_keyring)
-                       key_replace_session_keyring();
        }
 
 } /* end do_notify_resume() */
This page took 0.029354 seconds and 5 git commands to generate.