diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-21 23:42:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-01 12:58:49 -0400 |
commit | a610d6e672d6d3723e8da257ad4a8a288a8f2f89 (patch) | |
tree | 2fac6ce7f72756771f4f87583205cc402589dcad | |
parent | 5754f412a3f107cbcd93ee125bef296f2a07539b (diff) |
pull clearing RESTORE_SIGMASK into block_sigmask()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
34 files changed, 130 insertions, 387 deletions
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index f1e7d2aa2586..bb45a8813393 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -481,11 +481,6 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
481 | return; | 481 | return; |
482 | } | 482 | } |
483 | block_sigmask(ka, sig); | 483 | block_sigmask(ka, sig); |
484 | /* A signal was successfully delivered, and the | ||
485 | saved sigmask was stored on the signal frame, | ||
486 | and will be restored by sigreturn. So we can | ||
487 | simply clear the restore sigmask flag. */ | ||
488 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
489 | } | 484 | } |
490 | 485 | ||
491 | static inline void | 486 | static inline void |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 2e66c93973c3..7f9abd75fc2e 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -528,7 +528,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
528 | /* | 528 | /* |
529 | * OK, we're invoking a handler | 529 | * OK, we're invoking a handler |
530 | */ | 530 | */ |
531 | static int | 531 | static void |
532 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 532 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
533 | siginfo_t *info, struct pt_regs *regs) | 533 | siginfo_t *info, struct pt_regs *regs) |
534 | { | 534 | { |
@@ -559,17 +559,14 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
559 | 559 | ||
560 | if (ret != 0) { | 560 | if (ret != 0) { |
561 | force_sigsegv(sig, tsk); | 561 | force_sigsegv(sig, tsk); |
562 | return ret; | 562 | return; |
563 | } | 563 | } |
564 | 564 | ||
565 | /* | 565 | /* |
566 | * Block the signal if we were successful. | 566 | * Block the signal if we were successful. |
567 | */ | 567 | */ |
568 | block_sigmask(ka, sig); | 568 | block_sigmask(ka, sig); |
569 | |||
570 | tracehook_signal_handler(sig, info, ka, regs, 0); | 569 | tracehook_signal_handler(sig, info, ka, regs, 0); |
571 | |||
572 | return 0; | ||
573 | } | 570 | } |
574 | 571 | ||
575 | /* | 572 | /* |
@@ -633,16 +630,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
633 | clear_thread_flag(TIF_SYSCALL_RESTARTSYS); | 630 | clear_thread_flag(TIF_SYSCALL_RESTARTSYS); |
634 | } | 631 | } |
635 | 632 | ||
636 | if (handle_signal(signr, &ka, &info, regs) == 0) { | 633 | handle_signal(signr, &ka, &info, regs); |
637 | /* | ||
638 | * A signal was successfully delivered; the saved | ||
639 | * sigmask will have been stored in the signal frame, | ||
640 | * and will be restored by sigreturn, so we can simply | ||
641 | * clear the TIF_RESTORE_SIGMASK flag. | ||
642 | */ | ||
643 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
644 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
645 | } | ||
646 | return; | 634 | return; |
647 | } | 635 | } |
648 | 636 | ||
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c index 0e2c0527c9fe..dc7875a0ad79 100644 --- a/arch/avr32/kernel/signal.c +++ b/arch/avr32/kernel/signal.c | |||
@@ -238,16 +238,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
238 | */ | 238 | */ |
239 | ret |= !valid_user_regs(regs); | 239 | ret |= !valid_user_regs(regs); |
240 | 240 | ||
241 | if (ret != 0) { | ||
242 | force_sigsegv(sig, current); | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | /* | 241 | /* |
247 | * Block the signal if we were successful. | 242 | * Block the signal if we were successful. |
248 | */ | 243 | */ |
249 | block_sigmask(ka, sig); | 244 | if (ret != 0) |
250 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 245 | force_sigsegv(sig, current); |
246 | else | ||
247 | block_sigmask(ka, sig); | ||
251 | } | 248 | } |
252 | 249 | ||
253 | /* | 250 | /* |
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 7f4205ddfa4d..b25cbfef8192 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -247,7 +247,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler) | |||
247 | /* | 247 | /* |
248 | * OK, we're invoking a handler | 248 | * OK, we're invoking a handler |
249 | */ | 249 | */ |
250 | static int | 250 | static void |
251 | handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | 251 | handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, |
252 | struct pt_regs *regs) | 252 | struct pt_regs *regs) |
253 | { | 253 | { |
@@ -260,11 +260,12 @@ handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
260 | 260 | ||
261 | /* set up the stack frame */ | 261 | /* set up the stack frame */ |
262 | ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); | 262 | ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); |
263 | if (ret) | ||
264 | return; | ||
263 | 265 | ||
264 | if (ret == 0) | 266 | block_sigmask(ka, sig); |
265 | block_sigmask(ka, sig); | 267 | tracehook_signal_handler(sig, info, ka, regs, |
266 | 268 | test_thread_flag(TIF_SINGLESTEP)); | |
267 | return ret; | ||
268 | } | 269 | } |
269 | 270 | ||
270 | /* | 271 | /* |
@@ -290,18 +291,7 @@ asmlinkage void do_signal(struct pt_regs *regs) | |||
290 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 291 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
291 | if (signr > 0) { | 292 | if (signr > 0) { |
292 | /* Whee! Actually deliver the signal. */ | 293 | /* Whee! Actually deliver the signal. */ |
293 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 294 | handle_signal(signr, &info, &ka, regs); |
294 | /* a signal was successfully delivered; the saved | ||
295 | * sigmask will have been stored in the signal frame, | ||
296 | * and will be restored by sigreturn, so we can simply | ||
297 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
298 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
299 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
300 | |||
301 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
302 | test_thread_flag(TIF_SINGLESTEP)); | ||
303 | } | ||
304 | |||
305 | return; | 295 | return; |
306 | } | 296 | } |
307 | 297 | ||
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c index 38bb501eb117..f39346f1f2d6 100644 --- a/arch/c6x/kernel/signal.c +++ b/arch/c6x/kernel/signal.c | |||
@@ -248,7 +248,7 @@ do_restart: | |||
248 | /* | 248 | /* |
249 | * handle the actual delivery of a signal to userspace | 249 | * handle the actual delivery of a signal to userspace |
250 | */ | 250 | */ |
251 | static int handle_signal(int sig, | 251 | static void handle_signal(int sig, |
252 | siginfo_t *info, struct k_sigaction *ka, | 252 | siginfo_t *info, struct k_sigaction *ka, |
253 | struct pt_regs *regs, int syscall) | 253 | struct pt_regs *regs, int syscall) |
254 | { | 254 | { |
@@ -277,11 +277,10 @@ static int handle_signal(int sig, | |||
277 | } | 277 | } |
278 | 278 | ||
279 | /* Set up the stack frame */ | 279 | /* Set up the stack frame */ |
280 | ret = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); | 280 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
281 | if (ret == 0) | 281 | return; |
282 | block_sigmask(ka, sig); | 282 | block_sigmask(ka, sig); |
283 | 283 | tracehook_signal_handler(sig, info, ka, regs, 0); | |
284 | return ret; | ||
285 | } | 284 | } |
286 | 285 | ||
287 | /* | 286 | /* |
@@ -300,17 +299,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
300 | 299 | ||
301 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 300 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
302 | if (signr > 0) { | 301 | if (signr > 0) { |
303 | if (handle_signal(signr, &info, &ka, regs, syscall) == 0) { | 302 | handle_signal(signr, &info, &ka, regs, syscall); |
304 | /* a signal was successfully delivered; the saved | ||
305 | * sigmask will have been stored in the signal frame, | ||
306 | * and will be restored by sigreturn, so we can simply | ||
307 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
308 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
309 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
310 | |||
311 | tracehook_signal_handler(signr, &info, &ka, regs, 0); | ||
312 | } | ||
313 | |||
314 | return; | 303 | return; |
315 | } | 304 | } |
316 | 305 | ||
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c index 09a4cf4eb08a..46c8ca605e4d 100644 --- a/arch/cris/arch-v10/kernel/signal.c +++ b/arch/cris/arch-v10/kernel/signal.c | |||
@@ -415,7 +415,7 @@ give_sigsegv: | |||
415 | * OK, we're invoking a handler | 415 | * OK, we're invoking a handler |
416 | */ | 416 | */ |
417 | 417 | ||
418 | static inline int handle_signal(int canrestart, unsigned long sig, | 418 | static inline void handle_signal(int canrestart, unsigned long sig, |
419 | siginfo_t *info, struct k_sigaction *ka, | 419 | siginfo_t *info, struct k_sigaction *ka, |
420 | struct pt_regs *regs) | 420 | struct pt_regs *regs) |
421 | { | 421 | { |
@@ -458,8 +458,6 @@ static inline int handle_signal(int canrestart, unsigned long sig, | |||
458 | 458 | ||
459 | if (ret == 0) | 459 | if (ret == 0) |
460 | block_sigmask(ka, sig); | 460 | block_sigmask(ka, sig); |
461 | |||
462 | return ret; | ||
463 | } | 461 | } |
464 | 462 | ||
465 | /* | 463 | /* |
@@ -492,15 +490,7 @@ void do_signal(int canrestart, struct pt_regs *regs) | |||
492 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 490 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
493 | if (signr > 0) { | 491 | if (signr > 0) { |
494 | /* Whee! Actually deliver the signal. */ | 492 | /* Whee! Actually deliver the signal. */ |
495 | if (handle_signal(canrestart, signr, &info, &ka, | 493 | handle_signal(canrestart, signr, &info, &ka, regs); |
496 | regs)) { | ||
497 | /* a signal was successfully delivered; the saved | ||
498 | * sigmask will have been stored in the signal frame, | ||
499 | * and will be restored by sigreturn, so we can simply | ||
500 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
501 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
502 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
503 | } | ||
504 | return; | 494 | return; |
505 | } | 495 | } |
506 | 496 | ||
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c index d52276ddae4b..e0431328b7cd 100644 --- a/arch/cris/arch-v32/kernel/signal.c +++ b/arch/cris/arch-v32/kernel/signal.c | |||
@@ -434,7 +434,7 @@ give_sigsegv: | |||
434 | } | 434 | } |
435 | 435 | ||
436 | /* Invoke a signal handler to, well, handle the signal. */ | 436 | /* Invoke a signal handler to, well, handle the signal. */ |
437 | static inline int | 437 | static inline void |
438 | handle_signal(int canrestart, unsigned long sig, | 438 | handle_signal(int canrestart, unsigned long sig, |
439 | siginfo_t *info, struct k_sigaction *ka, | 439 | siginfo_t *info, struct k_sigaction *ka, |
440 | struct pt_regs * regs) | 440 | struct pt_regs * regs) |
@@ -491,8 +491,6 @@ handle_signal(int canrestart, unsigned long sig, | |||
491 | 491 | ||
492 | if (ret == 0) | 492 | if (ret == 0) |
493 | block_sigmask(ka, sig); | 493 | block_sigmask(ka, sig); |
494 | |||
495 | return ret; | ||
496 | } | 494 | } |
497 | 495 | ||
498 | /* | 496 | /* |
@@ -525,16 +523,7 @@ do_signal(int canrestart, struct pt_regs *regs) | |||
525 | 523 | ||
526 | if (signr > 0) { | 524 | if (signr > 0) { |
527 | /* Whee! Actually deliver the signal. */ | 525 | /* Whee! Actually deliver the signal. */ |
528 | if (handle_signal(canrestart, signr, &info, &ka, | 526 | handle_signal(canrestart, signr, &info, &ka, regs); |
529 | regs)) { | ||
530 | /* a signal was successfully delivered; the saved | ||
531 | * sigmask will have been stored in the signal frame, | ||
532 | * and will be restored by sigreturn, so we can simply | ||
533 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
534 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
535 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
536 | } | ||
537 | |||
538 | return; | 527 | return; |
539 | } | 528 | } |
540 | 529 | ||
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 22efe8d25038..8dd0492bfb7b 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c | |||
@@ -426,7 +426,7 @@ give_sigsegv: | |||
426 | /* | 426 | /* |
427 | * OK, we're invoking a handler | 427 | * OK, we're invoking a handler |
428 | */ | 428 | */ |
429 | static int handle_signal(unsigned long sig, siginfo_t *info, | 429 | static void handle_signal(unsigned long sig, siginfo_t *info, |
430 | struct k_sigaction *ka) | 430 | struct k_sigaction *ka) |
431 | { | 431 | { |
432 | sigset_t *oldset = sigmask_to_save(); | 432 | sigset_t *oldset = sigmask_to_save(); |
@@ -461,11 +461,12 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
461 | else | 461 | else |
462 | ret = setup_frame(sig, ka, oldset); | 462 | ret = setup_frame(sig, ka, oldset); |
463 | 463 | ||
464 | if (ret == 0) | 464 | if (ret) |
465 | block_sigmask(ka, sig); | 465 | return; |
466 | |||
467 | return ret; | ||
468 | 466 | ||
467 | block_sigmask(ka, sig); | ||
468 | tracehook_signal_handler(sig, info, ka, __frame, | ||
469 | test_thread_flag(TIF_SINGLESTEP)); | ||
469 | } /* end handle_signal() */ | 470 | } /* end handle_signal() */ |
470 | 471 | ||
471 | /*****************************************************************************/ | 472 | /*****************************************************************************/ |
@@ -495,18 +496,7 @@ static void do_signal(void) | |||
495 | 496 | ||
496 | signr = get_signal_to_deliver(&info, &ka, __frame, NULL); | 497 | signr = get_signal_to_deliver(&info, &ka, __frame, NULL); |
497 | if (signr > 0) { | 498 | if (signr > 0) { |
498 | if (handle_signal(signr, &info, &ka) == 0) { | 499 | handle_signal(signr, &info, &ka); |
499 | /* a signal was successfully delivered; the saved | ||
500 | * sigmask will have been stored in the signal frame, | ||
501 | * and will be restored by sigreturn, so we can simply | ||
502 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
503 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
504 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
505 | |||
506 | tracehook_signal_handler(signr, &info, &ka, __frame, | ||
507 | test_thread_flag(TIF_SINGLESTEP)); | ||
508 | } | ||
509 | |||
510 | return; | 500 | return; |
511 | } | 501 | } |
512 | 502 | ||
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c index d4d2f72672ad..eac26c9ffc44 100644 --- a/arch/h8300/kernel/signal.c +++ b/arch/h8300/kernel/signal.c | |||
@@ -442,10 +442,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
442 | else | 442 | else |
443 | ret = setup_frame(sig, ka, oldset, regs); | 443 | ret = setup_frame(sig, ka, oldset, regs); |
444 | 444 | ||
445 | if (!ret) { | 445 | if (!ret) |
446 | block_sigmask(ka, sig); | 446 | block_sigmask(ka, sig); |
447 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
448 | } | ||
449 | } | 447 | } |
450 | 448 | ||
451 | /* | 449 | /* |
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c index f73fcee09bac..5f7d7c8a1328 100644 --- a/arch/hexagon/kernel/signal.c +++ b/arch/hexagon/kernel/signal.c | |||
@@ -149,11 +149,9 @@ sigsegv: | |||
149 | /* | 149 | /* |
150 | * Setup invocation of signal handler | 150 | * Setup invocation of signal handler |
151 | */ | 151 | */ |
152 | static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | 152 | static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, |
153 | struct pt_regs *regs) | 153 | struct pt_regs *regs) |
154 | { | 154 | { |
155 | int rc; | ||
156 | |||
157 | /* | 155 | /* |
158 | * If we're handling a signal that aborted a system call, | 156 | * If we're handling a signal that aborted a system call, |
159 | * set up the error return value before adding the signal | 157 | * set up the error return value before adding the signal |
@@ -186,15 +184,13 @@ static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
186 | * Set up the stack frame; not doing the SA_SIGINFO thing. We | 184 | * Set up the stack frame; not doing the SA_SIGINFO thing. We |
187 | * only set up the rt_frame flavor. | 185 | * only set up the rt_frame flavor. |
188 | */ | 186 | */ |
189 | rc = setup_rt_frame(sig, ka, info, sigmask_to_save(), regs); | ||
190 | |||
191 | /* If there was an error on setup, no signal was delivered. */ | 187 | /* If there was an error on setup, no signal was delivered. */ |
192 | if (rc) | 188 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
193 | return rc; | 189 | return; |
194 | 190 | ||
195 | block_sigmask(ka, sig); | 191 | block_sigmask(ka, sig); |
196 | 192 | tracehook_signal_handler(sig, info, ka, regs, | |
197 | return 0; | 193 | test_thread_flag(TIF_SINGLESTEP)); |
198 | } | 194 | } |
199 | 195 | ||
200 | /* | 196 | /* |
@@ -215,17 +211,7 @@ static void do_signal(struct pt_regs *regs) | |||
215 | signo = get_signal_to_deliver(&info, &sigact, regs, NULL); | 211 | signo = get_signal_to_deliver(&info, &sigact, regs, NULL); |
216 | 212 | ||
217 | if (signo > 0) { | 213 | if (signo > 0) { |
218 | if (handle_signal(signo, &info, &sigact, regs) == 0) { | 214 | handle_signal(signo, &info, &sigact, regs); |
219 | /* | ||
220 | * Successful delivery case. The saved sigmask is | ||
221 | * stored in the signal frame, and will be restored | ||
222 | * by sigreturn. We can clear the TIF flag. | ||
223 | */ | ||
224 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
225 | |||
226 | tracehook_signal_handler(signo, &info, &sigact, regs, | ||
227 | test_thread_flag(TIF_SINGLESTEP)); | ||
228 | } | ||
229 | return; | 215 | return; |
230 | } | 216 | } |
231 | 217 | ||
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 9fee6d6a3f21..dc6fe6573465 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c | |||
@@ -501,16 +501,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
501 | * Whee! Actually deliver the signal. If the delivery failed, we need to | 501 | * Whee! Actually deliver the signal. If the delivery failed, we need to |
502 | * continue to iterate in this loop so we can deliver the SIGSEGV... | 502 | * continue to iterate in this loop so we can deliver the SIGSEGV... |
503 | */ | 503 | */ |
504 | if (handle_signal(signr, &ka, &info, scr)) { | 504 | if (handle_signal(signr, &ka, &info, scr)) |
505 | /* | ||
506 | * A signal was successfully delivered; the saved | ||
507 | * sigmask will have been stored in the signal frame, | ||
508 | * and will be restored by sigreturn, so we can simply | ||
509 | * clear the TS_RESTORE_SIGMASK flag. | ||
510 | */ | ||
511 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
512 | return; | 505 | return; |
513 | } | ||
514 | } | 506 | } |
515 | 507 | ||
516 | /* Did we come from a system call? */ | 508 | /* Did we come from a system call? */ |
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index e0d6d1079f33..970f46dbf24f 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -267,7 +267,7 @@ static int prev_insn(struct pt_regs *regs) | |||
267 | * OK, we're invoking a handler | 267 | * OK, we're invoking a handler |
268 | */ | 268 | */ |
269 | 269 | ||
270 | static int | 270 | static void |
271 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 271 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
272 | struct pt_regs *regs) | 272 | struct pt_regs *regs) |
273 | { | 273 | { |
@@ -295,10 +295,9 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
295 | 295 | ||
296 | /* Set up the stack frame */ | 296 | /* Set up the stack frame */ |
297 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) | 297 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) |
298 | return -EFAULT; | 298 | return; |
299 | 299 | ||
300 | block_sigmask(ka, sig); | 300 | block_sigmask(ka, sig); |
301 | return 0; | ||
302 | } | 301 | } |
303 | 302 | ||
304 | /* | 303 | /* |
@@ -333,8 +332,7 @@ static void do_signal(struct pt_regs *regs) | |||
333 | */ | 332 | */ |
334 | 333 | ||
335 | /* Whee! Actually deliver the signal. */ | 334 | /* Whee! Actually deliver the signal. */ |
336 | if (handle_signal(signr, &ka, &info, regs) == 0) | 335 | handle_signal(signr, &ka, &info, regs); |
337 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
338 | 336 | ||
339 | return; | 337 | return; |
340 | } | 338 | } |
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c index c83eb5a8ed8b..6dbee8a167a5 100644 --- a/arch/m68k/kernel/signal.c +++ b/arch/m68k/kernel/signal.c | |||
@@ -1147,8 +1147,6 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
1147 | regs->sr &= ~0x8000; | 1147 | regs->sr &= ~0x8000; |
1148 | send_sig(SIGTRAP, current, 1); | 1148 | send_sig(SIGTRAP, current, 1); |
1149 | } | 1149 | } |
1150 | |||
1151 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
1152 | } | 1150 | } |
1153 | 1151 | ||
1154 | /* | 1152 | /* |
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index fd2de5718a4e..03641199666e 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -310,7 +310,7 @@ do_restart: | |||
310 | * OK, we're invoking a handler | 310 | * OK, we're invoking a handler |
311 | */ | 311 | */ |
312 | 312 | ||
313 | static int | 313 | static void |
314 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 314 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
315 | siginfo_t *info, struct pt_regs *regs) | 315 | siginfo_t *info, struct pt_regs *regs) |
316 | { | 316 | { |
@@ -324,11 +324,9 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
324 | ret = setup_rt_frame(sig, ka, NULL, oldset, regs); | 324 | ret = setup_rt_frame(sig, ka, NULL, oldset, regs); |
325 | 325 | ||
326 | if (ret) | 326 | if (ret) |
327 | return ret; | 327 | return; |
328 | 328 | ||
329 | block_sigmask(ka, sig); | 329 | block_sigmask(ka, sig); |
330 | |||
331 | return 0; | ||
332 | } | 330 | } |
333 | 331 | ||
334 | /* | 332 | /* |
@@ -356,16 +354,7 @@ static void do_signal(struct pt_regs *regs, int in_syscall) | |||
356 | /* Whee! Actually deliver the signal. */ | 354 | /* Whee! Actually deliver the signal. */ |
357 | if (in_syscall) | 355 | if (in_syscall) |
358 | handle_restart(regs, &ka, 1); | 356 | handle_restart(regs, &ka, 1); |
359 | if (!handle_signal(signr, &ka, &info, oldset, regs)) { | 357 | handle_signal(signr, &ka, &info, regs); |
360 | /* | ||
361 | * A signal was successfully delivered; the saved | ||
362 | * sigmask will have been stored in the signal frame, | ||
363 | * and will be restored by sigreturn, so we can simply | ||
364 | * clear the TS_RESTORE_SIGMASK flag. | ||
365 | */ | ||
366 | current_thread_info()->status &= | ||
367 | ~TS_RESTORE_SIGMASK; | ||
368 | } | ||
369 | return; | 358 | return; |
370 | } | 359 | } |
371 | 360 | ||
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 18355060f241..53c6e90082f0 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -514,7 +514,7 @@ struct mips_abi mips_abi = { | |||
514 | .restart = __NR_restart_syscall | 514 | .restart = __NR_restart_syscall |
515 | }; | 515 | }; |
516 | 516 | ||
517 | static int handle_signal(unsigned long sig, siginfo_t *info, | 517 | static void handle_signal(unsigned long sig, siginfo_t *info, |
518 | struct k_sigaction *ka, struct pt_regs *regs) | 518 | struct k_sigaction *ka, struct pt_regs *regs) |
519 | { | 519 | { |
520 | sigset_t *oldset = sigmask_to_save(); | 520 | sigset_t *oldset = sigmask_to_save(); |
@@ -551,11 +551,9 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
551 | ka, regs, sig, oldset); | 551 | ka, regs, sig, oldset); |
552 | 552 | ||
553 | if (ret) | 553 | if (ret) |
554 | return ret; | 554 | return; |
555 | 555 | ||
556 | block_sigmask(ka, sig); | 556 | block_sigmask(ka, sig); |
557 | |||
558 | return ret; | ||
559 | } | 557 | } |
560 | 558 | ||
561 | static void do_signal(struct pt_regs *regs) | 559 | static void do_signal(struct pt_regs *regs) |
@@ -575,17 +573,7 @@ static void do_signal(struct pt_regs *regs) | |||
575 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 573 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
576 | if (signr > 0) { | 574 | if (signr > 0) { |
577 | /* Whee! Actually deliver the signal. */ | 575 | /* Whee! Actually deliver the signal. */ |
578 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 576 | handle_signal(signr, &info, &ka, regs); |
579 | /* | ||
580 | * A signal was successfully delivered; the saved | ||
581 | * sigmask will have been stored in the signal frame, | ||
582 | * and will be restored by sigreturn, so we can simply | ||
583 | * clear the TIF_RESTORE_SIGMASK flag. | ||
584 | */ | ||
585 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
586 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
587 | } | ||
588 | |||
589 | return; | 577 | return; |
590 | } | 578 | } |
591 | 579 | ||
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 26a1d98c62a1..1715478f4e94 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -462,11 +462,12 @@ static int handle_signal(int sig, | |||
462 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 462 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
463 | else | 463 | else |
464 | ret = setup_frame(sig, ka, oldset, regs); | 464 | ret = setup_frame(sig, ka, oldset, regs); |
465 | if (ret) | ||
466 | return; | ||
465 | 467 | ||
466 | if (ret == 0) | 468 | block_sigmask(ka, sig); |
467 | block_sigmask(ka, sig); | 469 | tracehook_signal_handler(sig, info, ka, regs, |
468 | 470 | test_thread_flag(TIF_SINGLESTEP)); | |
469 | return ret; | ||
470 | } | 471 | } |
471 | 472 | ||
472 | /* | 473 | /* |
@@ -486,15 +487,6 @@ static void do_signal(struct pt_regs *regs) | |||
486 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 487 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
487 | if (signr > 0) { | 488 | if (signr > 0) { |
488 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 489 | if (handle_signal(signr, &info, &ka, regs) == 0) { |
489 | /* a signal was successfully delivered; the saved | ||
490 | * sigmask will have been stored in the signal frame, | ||
491 | * and will be restored by sigreturn, so we can simply | ||
492 | * clear the TIF_RESTORE_SIGMASK flag */ | ||
493 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
494 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
495 | |||
496 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
497 | test_thread_flag(TIF_SINGLESTEP)); | ||
498 | } | 490 | } |
499 | 491 | ||
500 | return; | 492 | return; |
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 6c41778410e6..aa1105c1618f 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c | |||
@@ -263,8 +263,6 @@ handle_signal(unsigned long sig, | |||
263 | return; | 263 | return; |
264 | 264 | ||
265 | block_sigmask(ka, sig); | 265 | block_sigmask(ka, sig); |
266 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
267 | |||
268 | tracehook_signal_handler(sig, info, ka, regs, | 266 | tracehook_signal_handler(sig, info, ka, regs, |
269 | test_thread_flag(TIF_SINGLESTEP)); | 267 | test_thread_flag(TIF_SINGLESTEP)); |
270 | } | 268 | } |
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 441b25992846..d6ddc572eba1 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -459,6 +459,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
459 | test_thread_flag(TIF_SINGLESTEP) || | 459 | test_thread_flag(TIF_SINGLESTEP) || |
460 | test_thread_flag(TIF_BLOCKSTEP)); | 460 | test_thread_flag(TIF_BLOCKSTEP)); |
461 | 461 | ||
462 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", | ||
463 | regs->gr[28]); | ||
464 | |||
462 | return 1; | 465 | return 1; |
463 | } | 466 | } |
464 | 467 | ||
@@ -593,13 +596,8 @@ do_signal(struct pt_regs *regs, long in_syscall) | |||
593 | /* Whee! Actually deliver the signal. If the | 596 | /* Whee! Actually deliver the signal. If the |
594 | delivery failed, we need to continue to iterate in | 597 | delivery failed, we need to continue to iterate in |
595 | this loop so we can deliver the SIGSEGV... */ | 598 | this loop so we can deliver the SIGSEGV... */ |
596 | if (handle_signal(signr, &info, &ka, regs, in_syscall)) { | 599 | if (handle_signal(signr, &info, &ka, regs, in_syscall)) |
597 | DBG(1,KERN_DEBUG "do_signal: Exit (success), regs->gr[28] = %ld\n", | ||
598 | regs->gr[28]); | ||
599 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
600 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
601 | return; | 600 | return; |
602 | } | ||
603 | } | 601 | } |
604 | /* end of while(1) looping forever if we can't force a signal */ | 602 | /* end of while(1) looping forever if we can't force a signal */ |
605 | 603 | ||
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index 8e9ddab7ade6..d926d2e4611a 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -159,13 +159,6 @@ static int do_signal(struct pt_regs *regs) | |||
159 | regs->trap = 0; | 159 | regs->trap = 0; |
160 | if (ret) { | 160 | if (ret) { |
161 | block_sigmask(&ka, signr); | 161 | block_sigmask(&ka, signr); |
162 | |||
163 | /* | ||
164 | * A signal was successfully delivered; the saved sigmask is in | ||
165 | * its frame, and we can clear the TLF_RESTORE_SIGMASK flag. | ||
166 | */ | ||
167 | current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK; | ||
168 | |||
169 | /* | 162 | /* |
170 | * Let tracing know that we've done the handler setup. | 163 | * Let tracing know that we've done the handler setup. |
171 | */ | 164 | */ |
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index 377c096ca4a7..233db1d68eee 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -572,7 +572,7 @@ give_sigsegv: | |||
572 | * OK, we're invoking a handler | 572 | * OK, we're invoking a handler |
573 | */ | 573 | */ |
574 | 574 | ||
575 | int handle_signal32(unsigned long sig, struct k_sigaction *ka, | 575 | void handle_signal32(unsigned long sig, struct k_sigaction *ka, |
576 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 576 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
577 | { | 577 | { |
578 | int ret; | 578 | int ret; |
@@ -583,8 +583,12 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
583 | else | 583 | else |
584 | ret = setup_frame32(sig, ka, oldset, regs); | 584 | ret = setup_frame32(sig, ka, oldset, regs); |
585 | if (ret) | 585 | if (ret) |
586 | return ret; | 586 | return; |
587 | block_sigmask(ka, sig); | 587 | block_sigmask(ka, sig); |
588 | return 0; | 588 | /* |
589 | * Let tracing know that we've done the handler setup. | ||
590 | */ | ||
591 | tracehook_signal_handler(sig, info, ka, regs, | ||
592 | test_thread_flag(TIF_SINGLE_STEP)); | ||
589 | } | 593 | } |
590 | 594 | ||
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h index 6cdddac93a2e..f66a229ab0b3 100644 --- a/arch/s390/kernel/entry.h +++ b/arch/s390/kernel/entry.h | |||
@@ -31,7 +31,7 @@ void do_per_trap(struct pt_regs *regs); | |||
31 | void syscall_trace(struct pt_regs *regs, int entryexit); | 31 | void syscall_trace(struct pt_regs *regs, int entryexit); |
32 | void kernel_stack_overflow(struct pt_regs * regs); | 32 | void kernel_stack_overflow(struct pt_regs * regs); |
33 | void do_signal(struct pt_regs *regs); | 33 | void do_signal(struct pt_regs *regs); |
34 | int handle_signal32(unsigned long sig, struct k_sigaction *ka, | 34 | void handle_signal32(unsigned long sig, struct k_sigaction *ka, |
35 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); | 35 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs); |
36 | void do_notify_resume(struct pt_regs *regs); | 36 | void do_notify_resume(struct pt_regs *regs); |
37 | 37 | ||
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index c880c48a09f3..7f9a862a161a 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -367,7 +367,7 @@ give_sigsegv: | |||
367 | return -EFAULT; | 367 | return -EFAULT; |
368 | } | 368 | } |
369 | 369 | ||
370 | static int handle_signal(unsigned long sig, struct k_sigaction *ka, | 370 | static void handle_signal(unsigned long sig, struct k_sigaction *ka, |
371 | siginfo_t *info, sigset_t *oldset, | 371 | siginfo_t *info, sigset_t *oldset, |
372 | struct pt_regs *regs) | 372 | struct pt_regs *regs) |
373 | { | 373 | { |
@@ -379,9 +379,13 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
379 | else | 379 | else |
380 | ret = setup_frame(sig, ka, oldset, regs); | 380 | ret = setup_frame(sig, ka, oldset, regs); |
381 | if (ret) | 381 | if (ret) |
382 | return ret; | 382 | return; |
383 | block_sigmask(ka, sig); | 383 | block_sigmask(ka, sig); |
384 | return 0; | 384 | /* |
385 | * Let tracing know that we've done the handler setup. | ||
386 | */ | ||
387 | tracehook_signal_handler(sig, info, ka, regs, | ||
388 | test_thread_flag(TIF_SINGLE_STEP)); | ||
385 | } | 389 | } |
386 | 390 | ||
387 | /* | 391 | /* |
@@ -436,24 +440,10 @@ void do_signal(struct pt_regs *regs) | |||
436 | /* No longer in a system call */ | 440 | /* No longer in a system call */ |
437 | clear_thread_flag(TIF_SYSCALL); | 441 | clear_thread_flag(TIF_SYSCALL); |
438 | 442 | ||
439 | if ((is_compat_task() ? | 443 | if (is_compat_task()) |
440 | handle_signal32(signr, &ka, &info, oldset, regs) : | 444 | handle_signal32(signr, &ka, &info, oldset, regs); |
441 | handle_signal(signr, &ka, &info, oldset, regs)) == 0) { | 445 | else |
442 | /* | 446 | handle_signal(signr, &ka, &info, oldset, regs); |
443 | * A signal was successfully delivered; the saved | ||
444 | * sigmask will have been stored in the signal frame, | ||
445 | * and will be restored by sigreturn, so we can simply | ||
446 | * clear the TIF_RESTORE_SIGMASK flag. | ||
447 | */ | ||
448 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
449 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
450 | |||
451 | /* | ||
452 | * Let tracing know that we've done the handler setup. | ||
453 | */ | ||
454 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
455 | test_thread_flag(TIF_SINGLE_STEP)); | ||
456 | } | ||
457 | return; | 447 | return; |
458 | } | 448 | } |
459 | 449 | ||
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index b24dfaf2462f..13e0eed0e301 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
@@ -241,11 +241,9 @@ give_sigsegv: | |||
241 | return -EFAULT; | 241 | return -EFAULT; |
242 | } | 242 | } |
243 | 243 | ||
244 | static int handle_signal(unsigned long sig, siginfo_t *info, | 244 | static void handle_signal(unsigned long sig, siginfo_t *info, |
245 | struct k_sigaction *ka, struct pt_regs *regs) | 245 | struct k_sigaction *ka, struct pt_regs *regs) |
246 | { | 246 | { |
247 | int ret; | ||
248 | |||
249 | if (regs->is_syscall) { | 247 | if (regs->is_syscall) { |
250 | switch (regs->regs[4]) { | 248 | switch (regs->regs[4]) { |
251 | case ERESTART_RESTARTBLOCK: | 249 | case ERESTART_RESTARTBLOCK: |
@@ -269,12 +267,10 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
269 | /* | 267 | /* |
270 | * Set up the stack frame | 268 | * Set up the stack frame |
271 | */ | 269 | */ |
272 | ret = setup_rt_frame(ka, regs, sig, sigmask_to_save(), info); | 270 | if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) |
273 | 271 | return; | |
274 | if (ret == 0) | ||
275 | block_sigmask(ka, sig); | ||
276 | 272 | ||
277 | return ret; | 273 | block_sigmask(ka, sig); |
278 | } | 274 | } |
279 | 275 | ||
280 | static void do_signal(struct pt_regs *regs) | 276 | static void do_signal(struct pt_regs *regs) |
@@ -294,17 +290,7 @@ static void do_signal(struct pt_regs *regs) | |||
294 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 290 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
295 | if (signr > 0) { | 291 | if (signr > 0) { |
296 | /* Actually deliver the signal. */ | 292 | /* Actually deliver the signal. */ |
297 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 293 | handle_signal(signr, &info, &ka, regs); |
298 | /* | ||
299 | * A signal was successfully delivered; the saved | ||
300 | * sigmask will have been stored in the signal frame, | ||
301 | * and will be restored by sigreturn, so we can simply | ||
302 | * clear the TIF_RESTORE_SIGMASK flag. | ||
303 | */ | ||
304 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
305 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
306 | } | ||
307 | |||
308 | return; | 294 | return; |
309 | } | 295 | } |
310 | 296 | ||
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index bfb3d599f032..2675a97f374f 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -522,7 +522,7 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs, | |||
522 | /* | 522 | /* |
523 | * OK, we're invoking a handler | 523 | * OK, we're invoking a handler |
524 | */ | 524 | */ |
525 | static int | 525 | static void |
526 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 526 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
527 | struct pt_regs *regs, unsigned int save_r0) | 527 | struct pt_regs *regs, unsigned int save_r0) |
528 | { | 528 | { |
@@ -535,10 +535,11 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
535 | else | 535 | else |
536 | ret = setup_frame(sig, ka, oldset, regs); | 536 | ret = setup_frame(sig, ka, oldset, regs); |
537 | 537 | ||
538 | if (ret == 0) | 538 | if (ret) |
539 | block_sigmask(ka, sig); | 539 | return; |
540 | 540 | block_sigmask(ka, sig); | |
541 | return ret; | 541 | tracehook_signal_handler(sig, info, ka, regs, |
542 | test_thread_flag(TIF_SINGLESTEP)); | ||
542 | } | 543 | } |
543 | 544 | ||
544 | /* | 545 | /* |
@@ -570,20 +571,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0) | |||
570 | handle_syscall_restart(save_r0, regs, &ka.sa); | 571 | handle_syscall_restart(save_r0, regs, &ka.sa); |
571 | 572 | ||
572 | /* Whee! Actually deliver the signal. */ | 573 | /* Whee! Actually deliver the signal. */ |
573 | if (handle_signal(signr, &ka, &info, | 574 | handle_signal(signr, &ka, &info, regs, save_r0); |
574 | regs, save_r0) == 0) { | ||
575 | /* | ||
576 | * A signal was successfully delivered; the saved | ||
577 | * sigmask will have been stored in the signal frame, | ||
578 | * and will be restored by sigreturn, so we can simply | ||
579 | * clear the TS_RESTORE_SIGMASK flag | ||
580 | */ | ||
581 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
582 | |||
583 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
584 | test_thread_flag(TIF_SINGLESTEP)); | ||
585 | } | ||
586 | |||
587 | return; | 575 | return; |
588 | } | 576 | } |
589 | 577 | ||
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index aeeab070aaa9..7075c63bfc6f 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 44 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
45 | 45 | ||
46 | static int | 46 | static void |
47 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 47 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
48 | struct pt_regs * regs); | 48 | struct pt_regs * regs); |
49 | 49 | ||
@@ -103,17 +103,7 @@ static void do_signal(struct pt_regs *regs) | |||
103 | handle_syscall_restart(regs, &ka.sa); | 103 | handle_syscall_restart(regs, &ka.sa); |
104 | 104 | ||
105 | /* Whee! Actually deliver the signal. */ | 105 | /* Whee! Actually deliver the signal. */ |
106 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 106 | handle_signal(signr, &info, &ka, regs); |
107 | /* | ||
108 | * If a signal was successfully delivered, the | ||
109 | * saved sigmask is in its frame, and we can | ||
110 | * clear the TS_RESTORE_SIGMASK flag. | ||
111 | */ | ||
112 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
113 | |||
114 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
115 | test_thread_flag(TIF_SINGLESTEP)); | ||
116 | } | ||
117 | return; | 107 | return; |
118 | } | 108 | } |
119 | 109 | ||
@@ -648,7 +638,7 @@ give_sigsegv: | |||
648 | /* | 638 | /* |
649 | * OK, we're invoking a handler | 639 | * OK, we're invoking a handler |
650 | */ | 640 | */ |
651 | static int | 641 | static void |
652 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 642 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
653 | struct pt_regs * regs) | 643 | struct pt_regs * regs) |
654 | { | 644 | { |
@@ -661,10 +651,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
661 | else | 651 | else |
662 | ret = setup_frame(sig, ka, oldset, regs); | 652 | ret = setup_frame(sig, ka, oldset, regs); |
663 | 653 | ||
664 | if (ret == 0) | 654 | if (ret) |
665 | block_sigmask(ka, sig); | 655 | return; |
666 | 656 | ||
667 | return ret; | 657 | block_sigmask(ka, sig); |
658 | tracehook_signal_handler(sig, info, ka, regs, | ||
659 | test_thread_flag(TIF_SINGLESTEP)); | ||
668 | } | 660 | } |
669 | 661 | ||
670 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | 662 | asmlinkage void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) |
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index 88e0d8122d2c..8c93c00922a7 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -775,7 +775,7 @@ sigsegv: | |||
775 | return -EFAULT; | 775 | return -EFAULT; |
776 | } | 776 | } |
777 | 777 | ||
778 | static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, | 778 | static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka, |
779 | siginfo_t *info, | 779 | siginfo_t *info, |
780 | sigset_t *oldset, struct pt_regs *regs) | 780 | sigset_t *oldset, struct pt_regs *regs) |
781 | { | 781 | { |
@@ -787,12 +787,10 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, | |||
787 | err = setup_frame32(ka, regs, signr, oldset); | 787 | err = setup_frame32(ka, regs, signr, oldset); |
788 | 788 | ||
789 | if (err) | 789 | if (err) |
790 | return err; | 790 | return; |
791 | 791 | ||
792 | block_sigmask(ka, signr); | 792 | block_sigmask(ka, signr); |
793 | tracehook_signal_handler(signr, info, ka, regs, 0); | 793 | tracehook_signal_handler(signr, info, ka, regs, 0); |
794 | |||
795 | return 0; | ||
796 | } | 794 | } |
797 | 795 | ||
798 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, | 796 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, |
@@ -841,14 +839,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs) | |||
841 | if (signr > 0) { | 839 | if (signr > 0) { |
842 | if (restart_syscall) | 840 | if (restart_syscall) |
843 | syscall_restart32(orig_i0, regs, &ka.sa); | 841 | syscall_restart32(orig_i0, regs, &ka.sa); |
844 | if (handle_signal32(signr, &ka, &info, oldset, regs) == 0) { | 842 | handle_signal32(signr, &ka, &info, oldset, regs); |
845 | /* A signal was successfully delivered; the saved | ||
846 | * sigmask will have been stored in the signal frame, | ||
847 | * and will be restored by sigreturn, so we can simply | ||
848 | * clear the TS_RESTORE_SIGMASK flag. | ||
849 | */ | ||
850 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
851 | } | ||
852 | return; | 843 | return; |
853 | } | 844 | } |
854 | if (restart_syscall && | 845 | if (restart_syscall && |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 5d74410c787b..ee81b90c532f 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -449,7 +449,7 @@ sigsegv: | |||
449 | return -EFAULT; | 449 | return -EFAULT; |
450 | } | 450 | } |
451 | 451 | ||
452 | static inline int | 452 | static inline void |
453 | handle_signal(unsigned long signr, struct k_sigaction *ka, | 453 | handle_signal(unsigned long signr, struct k_sigaction *ka, |
454 | siginfo_t *info, struct pt_regs *regs) | 454 | siginfo_t *info, struct pt_regs *regs) |
455 | { | 455 | { |
@@ -462,12 +462,10 @@ handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
462 | err = setup_frame(ka, regs, signr, oldset); | 462 | err = setup_frame(ka, regs, signr, oldset); |
463 | 463 | ||
464 | if (err) | 464 | if (err) |
465 | return err; | 465 | return; |
466 | 466 | ||
467 | block_sigmask(ka, signr); | 467 | block_sigmask(ka, signr); |
468 | tracehook_signal_handler(signr, info, ka, regs, 0); | 468 | tracehook_signal_handler(signr, info, ka, regs, 0); |
469 | |||
470 | return 0; | ||
471 | } | 469 | } |
472 | 470 | ||
473 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 471 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
@@ -539,15 +537,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
539 | if (signr > 0) { | 537 | if (signr > 0) { |
540 | if (restart_syscall) | 538 | if (restart_syscall) |
541 | syscall_restart(orig_i0, regs, &ka.sa); | 539 | syscall_restart(orig_i0, regs, &ka.sa); |
542 | if (handle_signal(signr, &ka, &info, regs) == 0) { | 540 | handle_signal(signr, &ka, &info, regs); |
543 | /* a signal was successfully delivered; the saved | ||
544 | * sigmask will have been stored in the signal frame, | ||
545 | * and will be restored by sigreturn, so we can simply | ||
546 | * clear the TIF_RESTORE_SIGMASK flag. | ||
547 | */ | ||
548 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
549 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
550 | } | ||
551 | return; | 541 | return; |
552 | } | 542 | } |
553 | if (restart_syscall && | 543 | if (restart_syscall && |
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index 088a733f83f9..febbc4b697ba 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -466,7 +466,7 @@ sigsegv: | |||
466 | return -EFAULT; | 466 | return -EFAULT; |
467 | } | 467 | } |
468 | 468 | ||
469 | static inline int handle_signal(unsigned long signr, struct k_sigaction *ka, | 469 | static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, |
470 | siginfo_t *info, | 470 | siginfo_t *info, |
471 | sigset_t *oldset, struct pt_regs *regs) | 471 | sigset_t *oldset, struct pt_regs *regs) |
472 | { | 472 | { |
@@ -475,12 +475,10 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
475 | err = setup_rt_frame(ka, regs, signr, oldset, | 475 | err = setup_rt_frame(ka, regs, signr, oldset, |
476 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); | 476 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); |
477 | if (err) | 477 | if (err) |
478 | return err; | 478 | return; |
479 | 479 | ||
480 | block_sigmask(ka, signr); | 480 | block_sigmask(ka, signr); |
481 | tracehook_signal_handler(signr, info, ka, regs, 0); | 481 | tracehook_signal_handler(signr, info, ka, regs, 0); |
482 | |||
483 | return 0; | ||
484 | } | 482 | } |
485 | 483 | ||
486 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 484 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
@@ -558,14 +556,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
558 | if (signr > 0) { | 556 | if (signr > 0) { |
559 | if (restart_syscall) | 557 | if (restart_syscall) |
560 | syscall_restart(orig_i0, regs, &ka.sa); | 558 | syscall_restart(orig_i0, regs, &ka.sa); |
561 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { | 559 | handle_signal(signr, &ka, &info, oldset, regs); |
562 | /* A signal was successfully delivered; the saved | ||
563 | * sigmask will have been stored in the signal frame, | ||
564 | * and will be restored by sigreturn, so we can simply | ||
565 | * clear the TS_RESTORE_SIGMASK flag. | ||
566 | */ | ||
567 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
568 | } | ||
569 | return; | 560 | return; |
570 | } | 561 | } |
571 | if (restart_syscall && | 562 | if (restart_syscall && |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index 588c28b2db58..9b71bfd4913d 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
@@ -242,7 +242,7 @@ give_sigsegv: | |||
242 | * OK, we're invoking a handler | 242 | * OK, we're invoking a handler |
243 | */ | 243 | */ |
244 | 244 | ||
245 | static int handle_signal(unsigned long sig, siginfo_t *info, | 245 | static void handle_signal(unsigned long sig, siginfo_t *info, |
246 | struct k_sigaction *ka, | 246 | struct k_sigaction *ka, |
247 | struct pt_regs *regs) | 247 | struct pt_regs *regs) |
248 | { | 248 | { |
@@ -279,15 +279,9 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
279 | else | 279 | else |
280 | #endif | 280 | #endif |
281 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 281 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
282 | if (ret == 0) { | 282 | if (ret) |
283 | /* This code is only called from system calls or from | 283 | return; |
284 | * the work_pending path in the return-to-user code, and | 284 | block_sigmask(ka, sig); |
285 | * either way we can re-enable interrupts unconditionally. | ||
286 | */ | ||
287 | block_sigmask(ka, sig); | ||
288 | } | ||
289 | |||
290 | return ret; | ||
291 | } | 285 | } |
292 | 286 | ||
293 | /* | 287 | /* |
@@ -311,16 +305,7 @@ void do_signal(struct pt_regs *regs) | |||
311 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 305 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
312 | if (signr > 0) { | 306 | if (signr > 0) { |
313 | /* Whee! Actually deliver the signal. */ | 307 | /* Whee! Actually deliver the signal. */ |
314 | if (handle_signal(signr, &info, &ka, regs) == 0) { | 308 | handle_signal(signr, &info, &ka, regs); |
315 | /* | ||
316 | * A signal was successfully delivered; the saved | ||
317 | * sigmask will have been stored in the signal frame, | ||
318 | * and will be restored by sigreturn, so we can simply | ||
319 | * clear the TS_RESTORE_SIGMASK flag. | ||
320 | */ | ||
321 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
322 | } | ||
323 | |||
324 | goto done; | 309 | goto done; |
325 | } | 310 | } |
326 | 311 | ||
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 909e9b8d6612..549a51c8e54f 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -22,7 +22,7 @@ EXPORT_SYMBOL(unblock_signals); | |||
22 | /* | 22 | /* |
23 | * OK, we're invoking a handler | 23 | * OK, we're invoking a handler |
24 | */ | 24 | */ |
25 | static int handle_signal(struct pt_regs *regs, unsigned long signr, | 25 | static void handle_signal(struct pt_regs *regs, unsigned long signr, |
26 | struct k_sigaction *ka, siginfo_t *info) | 26 | struct k_sigaction *ka, siginfo_t *info) |
27 | { | 27 | { |
28 | sigset_t *oldset = sigmask_to_save(); | 28 | sigset_t *oldset = sigmask_to_save(); |
@@ -66,8 +66,6 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, | |||
66 | force_sigsegv(signr, current); | 66 | force_sigsegv(signr, current); |
67 | else | 67 | else |
68 | block_sigmask(ka, signr); | 68 | block_sigmask(ka, signr); |
69 | |||
70 | return err; | ||
71 | } | 69 | } |
72 | 70 | ||
73 | static int kern_do_signal(struct pt_regs *regs) | 71 | static int kern_do_signal(struct pt_regs *regs) |
@@ -79,17 +77,7 @@ static int kern_do_signal(struct pt_regs *regs) | |||
79 | while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { | 77 | while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { |
80 | handled_sig = 1; | 78 | handled_sig = 1; |
81 | /* Whee! Actually deliver the signal. */ | 79 | /* Whee! Actually deliver the signal. */ |
82 | if (!handle_signal(regs, sig, &ka_copy, &info)) { | 80 | handle_signal(regs, sig, &ka_copy, &info); |
83 | /* | ||
84 | * a signal was successfully delivered; the saved | ||
85 | * sigmask will have been stored in the signal frame, | ||
86 | * and will be restored by sigreturn, so we can simply | ||
87 | * clear the TIF_RESTORE_SIGMASK flag | ||
88 | */ | ||
89 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
90 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
91 | break; | ||
92 | } | ||
93 | } | 81 | } |
94 | 82 | ||
95 | /* Did we come from a system call? */ | 83 | /* Did we come from a system call? */ |
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c index bf23194dc74d..dc41b11f8a57 100644 --- a/arch/unicore32/kernel/signal.c +++ b/arch/unicore32/kernel/signal.c | |||
@@ -312,7 +312,7 @@ static inline void setup_syscall_restart(struct pt_regs *regs) | |||
312 | /* | 312 | /* |
313 | * OK, we're invoking a handler | 313 | * OK, we're invoking a handler |
314 | */ | 314 | */ |
315 | static int handle_signal(unsigned long sig, struct k_sigaction *ka, | 315 | static void handle_signal(unsigned long sig, struct k_sigaction *ka, |
316 | siginfo_t *info, struct pt_regs *regs, int syscall) | 316 | siginfo_t *info, struct pt_regs *regs, int syscall) |
317 | { | 317 | { |
318 | struct thread_info *thread = current_thread_info(); | 318 | struct thread_info *thread = current_thread_info(); |
@@ -363,15 +363,13 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
363 | 363 | ||
364 | if (ret != 0) { | 364 | if (ret != 0) { |
365 | force_sigsegv(sig, tsk); | 365 | force_sigsegv(sig, tsk); |
366 | return ret; | 366 | return; |
367 | } | 367 | } |
368 | 368 | ||
369 | /* | 369 | /* |
370 | * Block the signal if we were successful. | 370 | * Block the signal if we were successful. |
371 | */ | 371 | */ |
372 | block_sigmask(ka, sig); | 372 | block_sigmask(ka, sig); |
373 | |||
374 | return 0; | ||
375 | } | 373 | } |
376 | 374 | ||
377 | /* | 375 | /* |
@@ -403,17 +401,7 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
403 | 401 | ||
404 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 402 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
405 | if (signr > 0) { | 403 | if (signr > 0) { |
406 | if (handle_signal(signr, &ka, &info, regs, syscall) | 404 | handle_signal(signr, &ka, &info, regs, syscall); |
407 | == 0) { | ||
408 | /* | ||
409 | * A signal was successfully delivered; the saved | ||
410 | * sigmask will have been stored in the signal frame, | ||
411 | * and will be restored by sigreturn, so we can simply | ||
412 | * clear the TIF_RESTORE_SIGMASK flag. | ||
413 | */ | ||
414 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
415 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
416 | } | ||
417 | return; | 405 | return; |
418 | } | 406 | } |
419 | 407 | ||
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 56f3062c5111..700c49dcd84e 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -648,38 +648,27 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
648 | { | 648 | { |
649 | int usig = signr_convert(sig); | 649 | int usig = signr_convert(sig); |
650 | sigset_t *set = sigmask_to_save(); | 650 | sigset_t *set = sigmask_to_save(); |
651 | int ret; | ||
652 | 651 | ||
653 | /* Set up the stack frame */ | 652 | /* Set up the stack frame */ |
654 | if (is_ia32) { | 653 | if (is_ia32) { |
655 | if (ka->sa.sa_flags & SA_SIGINFO) | 654 | if (ka->sa.sa_flags & SA_SIGINFO) |
656 | ret = ia32_setup_rt_frame(usig, ka, info, set, regs); | 655 | return ia32_setup_rt_frame(usig, ka, info, set, regs); |
657 | else | 656 | else |
658 | ret = ia32_setup_frame(usig, ka, set, regs); | 657 | return ia32_setup_frame(usig, ka, set, regs); |
659 | #ifdef CONFIG_X86_X32_ABI | 658 | #ifdef CONFIG_X86_X32_ABI |
660 | } else if (is_x32) { | 659 | } else if (is_x32) { |
661 | ret = x32_setup_rt_frame(usig, ka, info, | 660 | return x32_setup_rt_frame(usig, ka, info, |
662 | (compat_sigset_t *)set, regs); | 661 | (compat_sigset_t *)set, regs); |
663 | #endif | 662 | #endif |
664 | } else { | 663 | } else { |
665 | ret = __setup_rt_frame(sig, ka, info, set, regs); | 664 | return __setup_rt_frame(sig, ka, info, set, regs); |
666 | } | 665 | } |
667 | |||
668 | if (ret) { | ||
669 | force_sigsegv(sig, current); | ||
670 | return -EFAULT; | ||
671 | } | ||
672 | |||
673 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
674 | return ret; | ||
675 | } | 666 | } |
676 | 667 | ||
677 | static int | 668 | static void |
678 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | 669 | handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, |
679 | struct pt_regs *regs) | 670 | struct pt_regs *regs) |
680 | { | 671 | { |
681 | int ret; | ||
682 | |||
683 | /* Are we from a system call? */ | 672 | /* Are we from a system call? */ |
684 | if (syscall_get_nr(current, regs) >= 0) { | 673 | if (syscall_get_nr(current, regs) >= 0) { |
685 | /* If so, check system call restarting.. */ | 674 | /* If so, check system call restarting.. */ |
@@ -710,10 +699,10 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
710 | likely(test_and_clear_thread_flag(TIF_FORCED_TF))) | 699 | likely(test_and_clear_thread_flag(TIF_FORCED_TF))) |
711 | regs->flags &= ~X86_EFLAGS_TF; | 700 | regs->flags &= ~X86_EFLAGS_TF; |
712 | 701 | ||
713 | ret = setup_rt_frame(sig, ka, info, regs); | 702 | if (setup_rt_frame(sig, ka, info, regs) < 0) { |
714 | 703 | force_sigsegv(sig, current); | |
715 | if (ret) | 704 | return; |
716 | return ret; | 705 | } |
717 | 706 | ||
718 | /* | 707 | /* |
719 | * Clear the direction flag as per the ABI for function entry. | 708 | * Clear the direction flag as per the ABI for function entry. |
@@ -732,8 +721,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
732 | 721 | ||
733 | tracehook_signal_handler(sig, info, ka, regs, | 722 | tracehook_signal_handler(sig, info, ka, regs, |
734 | test_thread_flag(TIF_SINGLESTEP)); | 723 | test_thread_flag(TIF_SINGLESTEP)); |
735 | |||
736 | return 0; | ||
737 | } | 724 | } |
738 | 725 | ||
739 | #ifdef CONFIG_X86_32 | 726 | #ifdef CONFIG_X86_32 |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index e4b06e2d4eb9..3e83913a3c7c 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -499,7 +499,6 @@ static void do_signal(struct pt_regs *regs) | |||
499 | if (ret) | 499 | if (ret) |
500 | return; | 500 | return; |
501 | 501 | ||
502 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
503 | block_sigmask(&ka, signr); | 502 | block_sigmask(&ka, signr); |
504 | if (current->ptrace & PT_SINGLESTEP) | 503 | if (current->ptrace & PT_SINGLESTEP) |
505 | task_pt_regs(current)->icountlevel = 1; | 504 | task_pt_regs(current)->icountlevel = 1; |
diff --git a/kernel/signal.c b/kernel/signal.c index 95a9d9d8122b..b9be7e0fe41a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2382,6 +2382,12 @@ void block_sigmask(struct k_sigaction *ka, int signr) | |||
2382 | { | 2382 | { |
2383 | sigset_t blocked; | 2383 | sigset_t blocked; |
2384 | 2384 | ||
2385 | /* A signal was successfully delivered, and the | ||
2386 | saved sigmask was stored on the signal frame, | ||
2387 | and will be restored by sigreturn. So we can | ||
2388 | simply clear the restore sigmask flag. */ | ||
2389 | clear_restore_sigmask(); | ||
2390 | |||
2385 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); | 2391 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); |
2386 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 2392 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
2387 | sigaddset(&blocked, signr); | 2393 | sigaddset(&blocked, signr); |