aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/kernel/signal.c4
-rw-r--r--arch/arm/kernel/signal.c6
-rw-r--r--arch/avr32/kernel/signal.c5
-rw-r--r--arch/blackfin/kernel/signal.c5
-rw-r--r--arch/c6x/kernel/signal.c5
-rw-r--r--arch/cris/arch-v10/kernel/signal.c5
-rw-r--r--arch/cris/arch-v32/kernel/signal.c5
-rw-r--r--arch/frv/kernel/signal.c6
-rw-r--r--arch/h8300/kernel/signal.c3
-rw-r--r--arch/hexagon/kernel/signal.c5
-rw-r--r--arch/ia64/kernel/signal.c5
-rw-r--r--arch/m32r/kernel/signal.c5
-rw-r--r--arch/m68k/kernel/signal.c5
-rw-r--r--arch/microblaze/kernel/signal.c5
-rw-r--r--arch/mips/kernel/signal.c5
-rw-r--r--arch/mn10300/kernel/signal.c5
-rw-r--r--arch/openrisc/kernel/signal.c6
-rw-r--r--arch/parisc/kernel/signal.c7
-rw-r--r--arch/powerpc/kernel/signal.c6
-rw-r--r--arch/s390/kernel/signal.c5
-rw-r--r--arch/score/kernel/signal.c5
-rw-r--r--arch/sh/kernel/signal_32.c5
-rw-r--r--arch/sh/kernel/signal_64.c7
-rw-r--r--arch/sparc/kernel/signal32.c5
-rw-r--r--arch/sparc/kernel/signal_32.c5
-rw-r--r--arch/sparc/kernel/signal_64.c5
-rw-r--r--arch/tile/kernel/signal.c5
-rw-r--r--arch/um/kernel/signal.c6
-rw-r--r--arch/unicore32/kernel/signal.c3
-rw-r--r--arch/x86/kernel/signal.c5
-rw-r--r--arch/xtensa/kernel/signal.c3
-rw-r--r--include/linux/sched.h6
32 files changed, 38 insertions, 125 deletions
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
index f6db3032ddf0..cadf4571ca31 100644
--- a/arch/alpha/kernel/signal.c
+++ b/arch/alpha/kernel/signal.c
@@ -572,9 +572,7 @@ do_signal(struct pt_regs * regs, struct switch_stack * sw,
572 } 572 }
573 573
574 /* If there's no signal to deliver, we just restore the saved mask. */ 574 /* If there's no signal to deliver, we just restore the saved mask. */
575 if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) 575 restore_saved_sigmask();
576 set_current_blocked(&current->saved_sigmask);
577
578 if (single_stepping) 576 if (single_stepping)
579 ptrace_set_bpt(current); /* re-set breakpoint */ 577 ptrace_set_bpt(current); /* re-set breakpoint */
580} 578}
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 63f327dd5198..3d1daac8ea04 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -663,11 +663,7 @@ static void do_signal(struct pt_regs *regs, int syscall)
663 set_thread_flag(TIF_SYSCALL_RESTARTSYS); 663 set_thread_flag(TIF_SYSCALL_RESTARTSYS);
664 } 664 }
665 665
666 /* If there's no signal to deliver, we just put the saved sigmask 666 restore_saved_sigmask();
667 * back.
668 */
669 if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK))
670 set_current_blocked(&current->saved_sigmask);
671} 667}
672 668
673asmlinkage void 669asmlinkage void
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c
index e7595ef74f51..8b12c3046137 100644
--- a/arch/avr32/kernel/signal.c
+++ b/arch/avr32/kernel/signal.c
@@ -297,10 +297,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int syscall)
297 297
298 if (signr == 0) { 298 if (signr == 0) {
299 /* No signal to deliver -- put the saved sigmask back */ 299 /* No signal to deliver -- put the saved sigmask back */
300 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 300 restore_saved_sigmask();
301 clear_thread_flag(TIF_RESTORE_SIGMASK);
302 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
303 }
304 return 0; 301 return 0;
305 } 302 }
306 303
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c
index fc9ecce8b6ce..9d692a1277b3 100644
--- a/arch/blackfin/kernel/signal.c
+++ b/arch/blackfin/kernel/signal.c
@@ -319,10 +319,7 @@ asmlinkage void do_signal(struct pt_regs *regs)
319 319
320 /* if there's no signal to deliver, we just put the saved sigmask 320 /* if there's no signal to deliver, we just put the saved sigmask
321 * back */ 321 * back */
322 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 322 restore_saved_sigmask();
323 clear_thread_flag(TIF_RESTORE_SIGMASK);
324 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
325 }
326} 323}
327 324
328/* 325/*
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c
index 9493f0bbf0a6..bfbcc958bbb4 100644
--- a/arch/c6x/kernel/signal.c
+++ b/arch/c6x/kernel/signal.c
@@ -343,10 +343,7 @@ static void do_signal(struct pt_regs *regs, int syscall)
343 343
344 /* if there's no signal to deliver, we just put the saved sigmask 344 /* if there's no signal to deliver, we just put the saved sigmask
345 * back */ 345 * back */
346 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 346 restore_saved_sigmask();
347 clear_thread_flag(TIF_RESTORE_SIGMASK);
348 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
349 }
350} 347}
351 348
352/* 349/*
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index e16f8f297f61..06885e94e455 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -525,8 +525,5 @@ void do_signal(int canrestart, struct pt_regs *regs)
525 525
526 /* if there's no signal to deliver, we just put the saved sigmask 526 /* if there's no signal to deliver, we just put the saved sigmask
527 * back */ 527 * back */
528 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 528 restore_saved_sigmask();
529 clear_thread_flag(TIF_RESTORE_SIGMASK);
530 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
531 }
532} 529}
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index b338d8fc0c12..fe12cdca0bac 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -560,10 +560,7 @@ do_signal(int canrestart, struct pt_regs *regs)
560 560
561 /* if there's no signal to deliver, we just put the saved sigmask 561 /* if there's no signal to deliver, we just put the saved sigmask
562 * back */ 562 * back */
563 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 563 restore_saved_sigmask();
564 clear_thread_flag(TIF_RESTORE_SIGMASK);
565 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
566 }
567} 564}
568 565
569asmlinkage void 566asmlinkage void
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index 595bf1e5a5dc..16351cc8c36c 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -536,11 +536,7 @@ no_signal:
536 536
537 /* if there's no signal to deliver, we just put the saved sigmask 537 /* if there's no signal to deliver, we just put the saved sigmask
538 * back */ 538 * back */
539 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 539 restore_saved_sigmask();
540 clear_thread_flag(TIF_RESTORE_SIGMASK);
541 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
542 }
543
544} /* end do_signal() */ 540} /* end do_signal() */
545 541
546/*****************************************************************************/ 542/*****************************************************************************/
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
index e58992ad789e..63623dabab32 100644
--- a/arch/h8300/kernel/signal.c
+++ b/arch/h8300/kernel/signal.c
@@ -501,8 +501,7 @@ statis void do_signal(struct pt_regs *regs)
501 } 501 }
502 502
503 /* If there's no signal to deliver, we just restore the saved mask. */ 503 /* If there's no signal to deliver, we just restore the saved mask. */
504 if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) 504 restore_saved_sigmask();
505 set_current_blocked(&current->saved_sigmask);
506} 505}
507 506
508asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) 507asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index 21a3018cb9bf..acd6272913b3 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -259,10 +259,7 @@ no_signal:
259 259
260no_restart: 260no_restart:
261 /* If there's no signal to deliver, put the saved sigmask back */ 261 /* If there's no signal to deliver, put the saved sigmask back */
262 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 262 restore_saved_sigmask();
263 clear_thread_flag(TIF_RESTORE_SIGMASK);
264 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
265 }
266} 263}
267 264
268void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 265void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 7523501d3bc0..39d8f3afff49 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -538,8 +538,5 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
538 538
539 /* if there's no signal to deliver, we just put the saved sigmask 539 /* if there's no signal to deliver, we just put the saved sigmask
540 * back */ 540 * back */
541 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 541 restore_saved_sigmask();
542 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
543 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
544 }
545} 542}
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 64804f1f5141..2ad7c4587669 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -360,10 +360,7 @@ static void do_signal(struct pt_regs *regs)
360 prev_insn(regs); 360 prev_insn(regs);
361 } 361 }
362 } 362 }
363 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 363 restore_saved_sigmask();
364 clear_thread_flag(TIF_RESTORE_SIGMASK);
365 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
366 }
367} 364}
368 365
369/* 366/*
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 973eec60cad4..685cbe84f33f 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -1182,10 +1182,7 @@ static void do_signal(struct pt_regs *regs)
1182 handle_restart(regs, NULL, 0); 1182 handle_restart(regs, NULL, 0);
1183 1183
1184 /* If there's no signal to deliver, we just restore the saved mask. */ 1184 /* If there's no signal to deliver, we just restore the saved mask. */
1185 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 1185 restore_saved_sigmask();
1186 clear_thread_flag(TIF_RESTORE_SIGMASK);
1187 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1188 }
1189} 1186}
1190 1187
1191void do_notify_resume(struct pt_regs *regs) 1188void do_notify_resume(struct pt_regs *regs)
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 5d796e32786e..8e644dfaba4f 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -381,10 +381,7 @@ static void do_signal(struct pt_regs *regs, int in_syscall)
381 * If there's no signal to deliver, we just put the saved sigmask 381 * If there's no signal to deliver, we just put the saved sigmask
382 * back. 382 * back.
383 */ 383 */
384 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 384 restore_saved_sigmask();
385 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
386 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
387 }
388} 385}
389 386
390void do_notify_resume(struct pt_regs *regs, int in_syscall) 387void do_notify_resume(struct pt_regs *regs, int in_syscall)
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 8a6e6d116ab0..aad2d2da5eec 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -614,10 +614,7 @@ static void do_signal(struct pt_regs *regs)
614 * If there's no signal to deliver, we just put the saved sigmask 614 * If there's no signal to deliver, we just put the saved sigmask
615 * back 615 * back
616 */ 616 */
617 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 617 restore_saved_sigmask();
618 clear_thread_flag(TIF_RESTORE_SIGMASK);
619 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
620 }
621} 618}
622 619
623/* 620/*
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c
index b8b6aa1a6837..b7994c38eacc 100644
--- a/arch/mn10300/kernel/signal.c
+++ b/arch/mn10300/kernel/signal.c
@@ -525,10 +525,7 @@ static void do_signal(struct pt_regs *regs)
525 525
526 /* if there's no signal to deliver, we just put the saved sigmask 526 /* if there's no signal to deliver, we just put the saved sigmask
527 * back */ 527 * back */
528 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 528 restore_saved_sigmask();
529 clear_thread_flag(TIF_RESTORE_SIGMASK);
530 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
531 }
532} 529}
533 530
534/* 531/*
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 9ae611522953..266c6fd2eb5c 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -339,11 +339,7 @@ void do_signal(struct pt_regs *regs)
339 if (signr <= 0) { 339 if (signr <= 0) {
340 /* no signal to deliver so we just put the saved sigmask 340 /* no signal to deliver so we just put the saved sigmask
341 * back */ 341 * back */
342 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 342 restore_saved_sigmask();
343 clear_thread_flag(TIF_RESTORE_SIGMASK);
344 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
345 }
346
347 } else { /* signr > 0 */ 343 } else { /* signr > 0 */
348 sigset_t *oldset; 344 sigset_t *oldset;
349 345
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index e7a7cd3e1120..277cacadf653 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -621,12 +621,7 @@ do_signal(struct pt_regs *regs, long in_syscall)
621 DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n", 621 DBG(1,"do_signal: Exit (not delivered), regs->gr[28] = %ld\n",
622 regs->gr[28]); 622 regs->gr[28]);
623 623
624 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 624 restore_saved_sigmask();
625 clear_thread_flag(TIF_RESTORE_SIGMASK);
626 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
627 }
628
629 return;
630} 625}
631 626
632void do_notify_resume(struct pt_regs *regs, long in_syscall) 627void do_notify_resume(struct pt_regs *regs, long in_syscall)
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index bfc3ec1382fb..0f4cc67f4268 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -132,12 +132,8 @@ static int do_signal(struct pt_regs *regs)
132 check_syscall_restart(regs, &ka, signr > 0); 132 check_syscall_restart(regs, &ka, signr > 0);
133 133
134 if (signr <= 0) { 134 if (signr <= 0) {
135 struct thread_info *ti = current_thread_info();
136 /* No signal to deliver -- put the saved sigmask back */ 135 /* No signal to deliver -- put the saved sigmask back */
137 if (ti->local_flags & _TLF_RESTORE_SIGMASK) { 136 restore_saved_sigmask();
138 ti->local_flags &= ~_TLF_RESTORE_SIGMASK;
139 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
140 }
141 regs->trap = 0; 137 regs->trap = 0;
142 return 0; /* no signals delivered */ 138 return 0; /* no signals delivered */
143 } 139 }
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 42a6e8b47f06..37799089c38e 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -484,10 +484,7 @@ void do_signal(struct pt_regs *regs)
484 /* 484 /*
485 * If there's no signal to deliver, we just put the saved sigmask back. 485 * If there's no signal to deliver, we just put the saved sigmask back.
486 */ 486 */
487 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 487 restore_saved_sigmask();
488 clear_thread_flag(TIF_RESTORE_SIGMASK);
489 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
490 }
491} 488}
492 489
493void do_notify_resume(struct pt_regs *regs) 490void do_notify_resume(struct pt_regs *regs)
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index 302838d3acf6..9e751559375b 100644
--- a/arch/score/kernel/signal.c
+++ b/arch/score/kernel/signal.c
@@ -337,10 +337,7 @@ static void do_signal(struct pt_regs *regs)
337 * If there's no signal to deliver, we just put the saved sigmask 337 * If there's no signal to deliver, we just put the saved sigmask
338 * back 338 * back
339 */ 339 */
340 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 340 restore_saved_sigmask();
341 clear_thread_flag(TIF_RESTORE_SIGMASK);
342 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
343 }
344} 341}
345 342
346/* 343/*
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 9d7bfd66f189..92f4173ad29a 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -610,10 +610,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
610 * If there's no signal to deliver, we just put the saved sigmask 610 * If there's no signal to deliver, we just put the saved sigmask
611 * back. 611 * back.
612 */ 612 */
613 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 613 restore_saved_sigmask();
614 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
615 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
616 }
617} 614}
618 615
619asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0, 616asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned int save_r0,
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index aa6428430842..6e191ef0aa62 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -143,12 +143,7 @@ static void do_signal(struct pt_regs *regs)
143 } 143 }
144 144
145 /* No signal to deliver -- put the saved sigmask back */ 145 /* No signal to deliver -- put the saved sigmask back */
146 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 146 restore_saved_sigmask();
147 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
148 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
149 }
150
151 return;
152} 147}
153 148
154/* 149/*
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index bb1513e45f1a..88e0d8122d2c 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -872,10 +872,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs)
872 /* If there's no signal to deliver, we just put the saved sigmask 872 /* If there's no signal to deliver, we just put the saved sigmask
873 * back 873 * back
874 */ 874 */
875 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 875 restore_saved_sigmask();
876 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
877 set_current_blocked(&current->saved_sigmask);
878 }
879} 876}
880 877
881struct sigstack32 { 878struct sigstack32 {
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 6b42e8622d12..9dd97d2e171e 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -576,10 +576,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
576 /* if there's no signal to deliver, we just put the saved sigmask 576 /* if there's no signal to deliver, we just put the saved sigmask
577 * back 577 * back
578 */ 578 */
579 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 579 restore_saved_sigmask();
580 clear_thread_flag(TIF_RESTORE_SIGMASK);
581 set_current_blocked(&current->saved_sigmask);
582 }
583} 580}
584 581
585void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, 582void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index c82cf1cc3965..55b820ee0ac9 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -594,10 +594,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
594 /* If there's no signal to deliver, we just put the saved sigmask 594 /* If there's no signal to deliver, we just put the saved sigmask
595 * back 595 * back
596 */ 596 */
597 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 597 restore_saved_sigmask();
598 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
599 set_current_blocked(&current->saved_sigmask);
600 }
601} 598}
602 599
603void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) 600void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags)
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c
index f79d4b88c747..62b3493ea77d 100644
--- a/arch/tile/kernel/signal.c
+++ b/arch/tile/kernel/signal.c
@@ -350,10 +350,7 @@ void do_signal(struct pt_regs *regs)
350 } 350 }
351 351
352 /* If there's no signal to deliver, just put the saved sigmask back. */ 352 /* If there's no signal to deliver, just put the saved sigmask back. */
353 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 353 restore_saved_sigmask();
354 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
355 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
356 }
357 354
358done: 355done:
359 /* Avoid double syscall restart if there are nested signals. */ 356 /* Avoid double syscall restart if there are nested signals. */
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index 292e706016c5..6acf13c1740b 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -130,10 +130,8 @@ static int kern_do_signal(struct pt_regs *regs)
130 * if there's no signal to deliver, we just put the saved sigmask 130 * if there's no signal to deliver, we just put the saved sigmask
131 * back 131 * back
132 */ 132 */
133 if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) { 133 if (!handled_sig)
134 clear_thread_flag(TIF_RESTORE_SIGMASK); 134 restore_saved_sigmask();
135 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
136 }
137 return handled_sig; 135 return handled_sig;
138} 136}
139 137
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c
index 28782ad47b93..65a5ed3b6f2a 100644
--- a/arch/unicore32/kernel/signal.c
+++ b/arch/unicore32/kernel/signal.c
@@ -451,8 +451,7 @@ static void do_signal(struct pt_regs *regs, int syscall)
451 /* If there's no signal to deliver, we just put the saved 451 /* If there's no signal to deliver, we just put the saved
452 * sigmask back. 452 * sigmask back.
453 */ 453 */
454 if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) 454 restore_saved_sigmask();
455 set_current_blocked(&current->saved_sigmask);
456} 455}
457 456
458asmlinkage void do_notify_resume(struct pt_regs *regs, 457asmlinkage void do_notify_resume(struct pt_regs *regs,
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 2e937a5ad531..25a4a81a51aa 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -796,10 +796,7 @@ static void do_signal(struct pt_regs *regs)
796 * If there's no signal to deliver, we just put the saved sigmask 796 * If there's no signal to deliver, we just put the saved sigmask
797 * back. 797 * back.
798 */ 798 */
799 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 799 restore_saved_sigmask();
800 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
801 set_current_blocked(&current->saved_sigmask);
802 }
803} 800}
804 801
805/* 802/*
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index ea7e17778a75..8c4e751e3b83 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -532,8 +532,7 @@ no_signal:
532 } 532 }
533 533
534 /* If there's no signal to deliver, we just restore the saved mask. */ 534 /* If there's no signal to deliver, we just restore the saved mask. */
535 if (test_and_clear_thread_flag(TIF_RESTORE_SIGMASK)) 535 restore_saved_sigmask();
536 set_current_blocked(&current->saved_sigmask);
537 536
538 if (current->ptrace & PT_SINGLESTEP) 537 if (current->ptrace & PT_SINGLESTEP)
539 task_pt_regs(current)->icountlevel = 1; 538 task_pt_regs(current)->icountlevel = 1;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 660c8ae93471..f1b46b88f6f5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2207,6 +2207,12 @@ extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
2207extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 2207extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
2208extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); 2208extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
2209 2209
2210static inline void restore_saved_sigmask(void)
2211{
2212 if (test_and_clear_restore_sigmask())
2213 set_current_blocked(&current->saved_sigmask);
2214}
2215
2210static inline int kill_cad_pid(int sig, int priv) 2216static inline int kill_cad_pid(int sig, int priv)
2211{ 2217{
2212 return kill_pid(cad_pid, sig, priv); 2218 return kill_pid(cad_pid, sig, priv);