diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-28 02:04:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-01 12:58:52 -0400 |
commit | efee984c27b67e3ebef40410f35671997441b57c (patch) | |
tree | 53457dba2338f853d34e1754e7f7f960e4a29482 | |
parent | 17440f171e28e86cc21a4c8fd1fa3c561503f80e (diff) |
new helper: signal_delivered()
Does block_sigmask() + tracehook_signal_handler(); called when
sigframe has been successfully built. All architectures converted
to it; block_sigmask() itself is gone now (merged into this one).
I'm still not too happy with the signature, but that's a separate
story (IMO we need a structure that would contain signal number +
siginfo + k_sigaction, so that get_signal_to_deliver() would fill one,
signal_delivered(), handle_signal() and probably setup...frame() -
take one).
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
34 files changed, 47 insertions, 83 deletions
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index 48c4df2389ac..a8c97d42ec8e 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -478,7 +478,7 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
478 | force_sigsegv(sig, current); | 478 | force_sigsegv(sig, current); |
479 | return; | 479 | return; |
480 | } | 480 | } |
481 | block_sigmask(ka, sig); | 481 | signal_delivered(sig, info, ka, regs, 0); |
482 | } | 482 | } |
483 | 483 | ||
484 | static inline void | 484 | static inline void |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index c126eba8411d..fd2392a17ac1 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -557,12 +557,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
557 | force_sigsegv(sig, tsk); | 557 | force_sigsegv(sig, tsk); |
558 | return; | 558 | return; |
559 | } | 559 | } |
560 | 560 | signal_delivered(sig, info, ka, regs, 0); | |
561 | /* | ||
562 | * Block the signal if we were successful. | ||
563 | */ | ||
564 | block_sigmask(ka, sig); | ||
565 | tracehook_signal_handler(sig, info, ka, regs, 0); | ||
566 | } | 561 | } |
567 | 562 | ||
568 | /* | 563 | /* |
diff --git a/arch/avr32/kernel/signal.c b/arch/avr32/kernel/signal.c index e883fa5eb845..c140f9b41dce 100644 --- a/arch/avr32/kernel/signal.c +++ b/arch/avr32/kernel/signal.c | |||
@@ -241,7 +241,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
241 | if (ret != 0) | 241 | if (ret != 0) |
242 | force_sigsegv(sig, current); | 242 | force_sigsegv(sig, current); |
243 | else | 243 | else |
244 | block_sigmask(ka, sig); | 244 | signal_delivered(sig, info, ka, regs, 0); |
245 | } | 245 | } |
246 | 246 | ||
247 | /* | 247 | /* |
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index 463612643821..35459e681483 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -260,8 +260,7 @@ handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
260 | if (ret) | 260 | if (ret) |
261 | return; | 261 | return; |
262 | 262 | ||
263 | block_sigmask(ka, sig); | 263 | signal_delivered(sig, info, ka, regs, |
264 | tracehook_signal_handler(sig, info, ka, regs, | ||
265 | test_thread_flag(TIF_SINGLESTEP)); | 264 | test_thread_flag(TIF_SINGLESTEP)); |
266 | } | 265 | } |
267 | 266 | ||
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c index eb1b3086ae00..3d8f3c22a94f 100644 --- a/arch/c6x/kernel/signal.c +++ b/arch/c6x/kernel/signal.c | |||
@@ -276,8 +276,7 @@ static void handle_signal(int sig, | |||
276 | /* Set up the stack frame */ | 276 | /* Set up the stack frame */ |
277 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) | 277 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
278 | return; | 278 | return; |
279 | block_sigmask(ka, sig); | 279 | signal_delivered(sig, info, ka, regs, 0); |
280 | tracehook_signal_handler(sig, info, ka, regs, 0); | ||
281 | } | 280 | } |
282 | 281 | ||
283 | /* | 282 | /* |
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c index cf6380cb9a57..0bb477c13a4e 100644 --- a/arch/cris/arch-v10/kernel/signal.c +++ b/arch/cris/arch-v10/kernel/signal.c | |||
@@ -453,7 +453,7 @@ static inline void handle_signal(int canrestart, unsigned long sig, | |||
453 | ret = setup_frame(sig, ka, oldset, regs); | 453 | ret = setup_frame(sig, ka, oldset, regs); |
454 | 454 | ||
455 | if (ret == 0) | 455 | if (ret == 0) |
456 | block_sigmask(ka, sig); | 456 | signal_delivered(sig, info, ka, regs, 0); |
457 | } | 457 | } |
458 | 458 | ||
459 | /* | 459 | /* |
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c index 07b81ee09f65..b60d1b65a426 100644 --- a/arch/cris/arch-v32/kernel/signal.c +++ b/arch/cris/arch-v32/kernel/signal.c | |||
@@ -485,7 +485,7 @@ handle_signal(int canrestart, unsigned long sig, | |||
485 | ret = setup_frame(sig, ka, oldset, regs); | 485 | ret = setup_frame(sig, ka, oldset, regs); |
486 | 486 | ||
487 | if (ret == 0) | 487 | if (ret == 0) |
488 | block_sigmask(ka, sig); | 488 | signal_delivered(sig, info, ka, regs, 0); |
489 | } | 489 | } |
490 | 490 | ||
491 | /* | 491 | /* |
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 511285fa2461..4e134c7eceea 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c | |||
@@ -460,8 +460,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
460 | if (ret) | 460 | if (ret) |
461 | return; | 461 | return; |
462 | 462 | ||
463 | block_sigmask(ka, sig); | 463 | signal_delivered(sig, info, ka, __frame, |
464 | tracehook_signal_handler(sig, info, ka, __frame, | ||
465 | test_thread_flag(TIF_SINGLESTEP)); | 464 | test_thread_flag(TIF_SINGLESTEP)); |
466 | } /* end handle_signal() */ | 465 | } /* end handle_signal() */ |
467 | 466 | ||
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c index aa6f09666915..fca10378701b 100644 --- a/arch/h8300/kernel/signal.c +++ b/arch/h8300/kernel/signal.c | |||
@@ -439,7 +439,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
439 | ret = setup_frame(sig, ka, oldset, regs); | 439 | ret = setup_frame(sig, ka, oldset, regs); |
440 | 440 | ||
441 | if (!ret) | 441 | if (!ret) |
442 | block_sigmask(ka, sig); | 442 | signal_delivered(sig, info, ka, regs, 0); |
443 | } | 443 | } |
444 | 444 | ||
445 | /* | 445 | /* |
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c index 439f11a3a8ef..304b0808d072 100644 --- a/arch/hexagon/kernel/signal.c +++ b/arch/hexagon/kernel/signal.c | |||
@@ -186,8 +186,7 @@ static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
186 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) | 186 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs) < 0) |
187 | return; | 187 | return; |
188 | 188 | ||
189 | block_sigmask(ka, sig); | 189 | signal_delivered(sig, info, ka, regs, |
190 | tracehook_signal_handler(sig, info, ka, regs, | ||
191 | test_thread_flag(TIF_SINGLESTEP)); | 190 | test_thread_flag(TIF_SINGLESTEP)); |
192 | } | 191 | } |
193 | 192 | ||
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index c4041c76c07d..a199be1fe619 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c | |||
@@ -419,12 +419,7 @@ handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
419 | if (!setup_frame(sig, ka, info, sigmask_to_save(), scr)) | 419 | if (!setup_frame(sig, ka, info, sigmask_to_save(), scr)) |
420 | return 0; | 420 | return 0; |
421 | 421 | ||
422 | block_sigmask(ka, sig); | 422 | signal_delivered(sig, info, ka, &scr->pt, |
423 | |||
424 | /* | ||
425 | * Let tracing know that we've done the handler setup. | ||
426 | */ | ||
427 | tracehook_signal_handler(sig, info, ka, &scr->pt, | ||
428 | test_thread_flag(TIF_SINGLESTEP)); | 423 | test_thread_flag(TIF_SINGLESTEP)); |
429 | 424 | ||
430 | return 1; | 425 | return 1; |
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index 07f9032576c0..f3fb2c029cfc 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -294,7 +294,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
294 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) | 294 | if (setup_rt_frame(sig, ka, info, sigmask_to_save(), regs)) |
295 | return; | 295 | return; |
296 | 296 | ||
297 | block_sigmask(ka, sig); | 297 | signal_delivered(sig, info, ka, regs, 0); |
298 | } | 298 | } |
299 | 299 | ||
300 | /* | 300 | /* |
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c index c00caad215a6..710a528b928b 100644 --- a/arch/m68k/kernel/signal.c +++ b/arch/m68k/kernel/signal.c | |||
@@ -1137,7 +1137,7 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
1137 | if (err) | 1137 | if (err) |
1138 | return; | 1138 | return; |
1139 | 1139 | ||
1140 | block_sigmask(ka, sig); | 1140 | signal_delivered(sig, info, ka, regs, 0); |
1141 | 1141 | ||
1142 | if (test_thread_flag(TIF_DELAYED_TRACE)) { | 1142 | if (test_thread_flag(TIF_DELAYED_TRACE)) { |
1143 | regs->sr &= ~0x8000; | 1143 | regs->sr &= ~0x8000; |
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index c662e68671a2..76b9722557db 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -323,7 +323,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
323 | if (ret) | 323 | if (ret) |
324 | return; | 324 | return; |
325 | 325 | ||
326 | block_sigmask(ka, sig); | 326 | signal_delivered(sig, info, ka, regs, 0); |
327 | } | 327 | } |
328 | 328 | ||
329 | /* | 329 | /* |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 02e0cba24f82..f2c09cfc60ac 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -551,7 +551,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
551 | if (ret) | 551 | if (ret) |
552 | return; | 552 | return; |
553 | 553 | ||
554 | block_sigmask(ka, sig); | 554 | signal_delivered(sig, info, ka, regs, 0); |
555 | } | 555 | } |
556 | 556 | ||
557 | static void do_signal(struct pt_regs *regs) | 557 | static void do_signal(struct pt_regs *regs) |
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 4f6d20763061..6ab0bee2a54f 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -461,8 +461,7 @@ static int handle_signal(int sig, | |||
461 | if (ret) | 461 | if (ret) |
462 | return; | 462 | return; |
463 | 463 | ||
464 | block_sigmask(ka, sig); | 464 | signal_delivered(sig, info, ka, regs, |
465 | tracehook_signal_handler(sig, info, ka, regs, | ||
466 | test_thread_flag(TIF_SINGLESTEP)); | 465 | test_thread_flag(TIF_SINGLESTEP)); |
467 | } | 466 | } |
468 | 467 | ||
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c index 53972b7260b7..30110297f4f9 100644 --- a/arch/openrisc/kernel/signal.c +++ b/arch/openrisc/kernel/signal.c | |||
@@ -259,8 +259,7 @@ handle_signal(unsigned long sig, | |||
259 | if (ret) | 259 | if (ret) |
260 | return; | 260 | return; |
261 | 261 | ||
262 | block_sigmask(ka, sig); | 262 | signal_delivered(sig, info, ka, regs, |
263 | tracehook_signal_handler(sig, info, ka, regs, | ||
264 | test_thread_flag(TIF_SINGLESTEP)); | 263 | test_thread_flag(TIF_SINGLESTEP)); |
265 | } | 264 | } |
266 | 265 | ||
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 25161eaf720d..594459bde14e 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -449,9 +449,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
449 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) | 449 | if (!setup_rt_frame(sig, ka, info, oldset, regs, in_syscall)) |
450 | return 0; | 450 | return 0; |
451 | 451 | ||
452 | block_sigmask(ka, sig); | 452 | signal_delivered(sig, info, ka, regs, |
453 | |||
454 | tracehook_signal_handler(sig, info, ka, regs, | ||
455 | test_thread_flag(TIF_SINGLESTEP) || | 453 | test_thread_flag(TIF_SINGLESTEP) || |
456 | test_thread_flag(TIF_BLOCKSTEP)); | 454 | test_thread_flag(TIF_BLOCKSTEP)); |
457 | 455 | ||
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index 129bdffc6daf..5c023c9cf16e 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -148,11 +148,7 @@ static int do_signal(struct pt_regs *regs) | |||
148 | 148 | ||
149 | regs->trap = 0; | 149 | regs->trap = 0; |
150 | if (ret) { | 150 | if (ret) { |
151 | block_sigmask(&ka, signr); | 151 | signal_delivered(signr, &info, &ka, regs, |
152 | /* | ||
153 | * Let tracing know that we've done the handler setup. | ||
154 | */ | ||
155 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
156 | test_thread_flag(TIF_SINGLESTEP)); | 152 | test_thread_flag(TIF_SINGLESTEP)); |
157 | } | 153 | } |
158 | 154 | ||
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c index 923baa96c0b0..3c0c19830c37 100644 --- a/arch/s390/kernel/compat_signal.c +++ b/arch/s390/kernel/compat_signal.c | |||
@@ -580,11 +580,7 @@ void handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
580 | ret = setup_frame32(sig, ka, oldset, regs); | 580 | ret = setup_frame32(sig, ka, oldset, regs); |
581 | if (ret) | 581 | if (ret) |
582 | return; | 582 | return; |
583 | block_sigmask(ka, sig); | 583 | signal_delivered(sig, info, ka, regs, |
584 | /* | ||
585 | * Let tracing know that we've done the handler setup. | ||
586 | */ | ||
587 | tracehook_signal_handler(sig, info, ka, regs, | ||
588 | test_thread_flag(TIF_SINGLE_STEP)); | 584 | test_thread_flag(TIF_SINGLE_STEP)); |
589 | } | 585 | } |
590 | 586 | ||
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 8332a6943384..ac565b44aabb 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -375,11 +375,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
375 | ret = setup_frame(sig, ka, oldset, regs); | 375 | ret = setup_frame(sig, ka, oldset, regs); |
376 | if (ret) | 376 | if (ret) |
377 | return; | 377 | return; |
378 | block_sigmask(ka, sig); | 378 | signal_delivered(sig, info, ka, regs, |
379 | /* | ||
380 | * Let tracing know that we've done the handler setup. | ||
381 | */ | ||
382 | tracehook_signal_handler(sig, info, ka, regs, | ||
383 | test_thread_flag(TIF_SINGLE_STEP)); | 379 | test_thread_flag(TIF_SINGLE_STEP)); |
384 | } | 380 | } |
385 | 381 | ||
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index f1b3fef0907b..e382c52ca0d9 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
@@ -267,7 +267,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
267 | if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) | 267 | if (setup_rt_frame(ka, regs, sig, sigmask_to_save(), info) < 0) |
268 | return; | 268 | return; |
269 | 269 | ||
270 | block_sigmask(ka, sig); | 270 | signal_delivered(sig, info, ka, regs, 0); |
271 | } | 271 | } |
272 | 272 | ||
273 | static void do_signal(struct pt_regs *regs) | 273 | static void do_signal(struct pt_regs *regs) |
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index e4a531414e19..d6b7b6154f87 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -533,8 +533,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
533 | 533 | ||
534 | if (ret) | 534 | if (ret) |
535 | return; | 535 | return; |
536 | block_sigmask(ka, sig); | 536 | signal_delivered(sig, info, ka, regs, |
537 | tracehook_signal_handler(sig, info, ka, regs, | ||
538 | test_thread_flag(TIF_SINGLESTEP)); | 537 | test_thread_flag(TIF_SINGLESTEP)); |
539 | } | 538 | } |
540 | 539 | ||
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index 75960ef6c1d1..6b5b3dfe886b 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -650,8 +650,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
650 | if (ret) | 650 | if (ret) |
651 | return; | 651 | return; |
652 | 652 | ||
653 | block_sigmask(ka, sig); | 653 | signal_delivered(sig, info, ka, regs, |
654 | tracehook_signal_handler(sig, info, ka, regs, | ||
655 | test_thread_flag(TIF_SINGLESTEP)); | 654 | test_thread_flag(TIF_SINGLESTEP)); |
656 | } | 655 | } |
657 | 656 | ||
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index ba3dbfcdb28e..a53e0a5fd3a3 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -785,8 +785,7 @@ static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka, | |||
785 | if (err) | 785 | if (err) |
786 | return; | 786 | return; |
787 | 787 | ||
788 | block_sigmask(ka, signr); | 788 | signal_delivered(signr, info, ka, regs, 0); |
789 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
790 | } | 789 | } |
791 | 790 | ||
792 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, | 791 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 1bfa854be602..68f9c8650af4 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -460,8 +460,7 @@ handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
460 | if (err) | 460 | if (err) |
461 | return; | 461 | return; |
462 | 462 | ||
463 | block_sigmask(ka, signr); | 463 | signal_delivered(signr, info, ka, regs, 0); |
464 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
465 | } | 464 | } |
466 | 465 | ||
467 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 466 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index 23b60caa6c43..867de2f8189c 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -473,8 +473,7 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
473 | if (err) | 473 | if (err) |
474 | return; | 474 | return; |
475 | 475 | ||
476 | block_sigmask(ka, signr); | 476 | signal_delivered(signr, info, ka, regs, 0); |
477 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
478 | } | 477 | } |
479 | 478 | ||
480 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 479 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c index e068aa0c6dfc..e29b0553211d 100644 --- a/arch/tile/kernel/signal.c +++ b/arch/tile/kernel/signal.c | |||
@@ -278,7 +278,7 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
278 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 278 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
279 | if (ret) | 279 | if (ret) |
280 | return; | 280 | return; |
281 | block_sigmask(ka, sig); | 281 | signal_delivered(sig, info, ka, regs, 0); |
282 | } | 282 | } |
283 | 283 | ||
284 | /* | 284 | /* |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index 4ce6ab2d2996..7362d58efc29 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -61,7 +61,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr, | |||
61 | if (err) | 61 | if (err) |
62 | force_sigsegv(signr, current); | 62 | force_sigsegv(signr, current); |
63 | else | 63 | else |
64 | block_sigmask(ka, signr); | 64 | signal_delivered(signr, info, ka, regs, 0); |
65 | } | 65 | } |
66 | 66 | ||
67 | static int kern_do_signal(struct pt_regs *regs) | 67 | static int kern_do_signal(struct pt_regs *regs) |
diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c index 4d9c4841989d..8adedb37720a 100644 --- a/arch/unicore32/kernel/signal.c +++ b/arch/unicore32/kernel/signal.c | |||
@@ -362,10 +362,7 @@ static void handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
362 | return; | 362 | return; |
363 | } | 363 | } |
364 | 364 | ||
365 | /* | 365 | signal_delivered(sig, info, ka, regs, 0); |
366 | * Block the signal if we were successful. | ||
367 | */ | ||
368 | block_sigmask(ka, sig); | ||
369 | } | 366 | } |
370 | 367 | ||
371 | /* | 368 | /* |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 11e206f0f45a..e8a89374d356 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -715,10 +715,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
715 | */ | 715 | */ |
716 | regs->flags &= ~X86_EFLAGS_TF; | 716 | regs->flags &= ~X86_EFLAGS_TF; |
717 | 717 | ||
718 | block_sigmask(ka, sig); | 718 | signal_delivered(sig, info, ka, regs, |
719 | 719 | test_thread_flag(TIF_SINGLESTEP)); | |
720 | tracehook_signal_handler(sig, info, ka, regs, | ||
721 | test_thread_flag(TIF_SINGLESTEP)); | ||
722 | } | 720 | } |
723 | 721 | ||
724 | #ifdef CONFIG_X86_32 | 722 | #ifdef CONFIG_X86_32 |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index 4da3c6f6d929..b9f8e5850d3a 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -493,7 +493,7 @@ static void do_signal(struct pt_regs *regs) | |||
493 | if (ret) | 493 | if (ret) |
494 | return; | 494 | return; |
495 | 495 | ||
496 | block_sigmask(&ka, signr); | 496 | signal_delivered(signr, info, ka, regs, 0); |
497 | if (current->ptrace & PT_SINGLESTEP) | 497 | if (current->ptrace & PT_SINGLESTEP) |
498 | task_pt_regs(current)->icountlevel = 1; | 498 | task_pt_regs(current)->icountlevel = 1; |
499 | 499 | ||
diff --git a/include/linux/signal.h b/include/linux/signal.h index 065e76330398..26b424adc842 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -256,7 +256,7 @@ extern int show_unhandled_signals; | |||
256 | extern int sigsuspend(sigset_t *); | 256 | extern int sigsuspend(sigset_t *); |
257 | 257 | ||
258 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); | 258 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); |
259 | extern void block_sigmask(struct k_sigaction *ka, int signr); | 259 | extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); |
260 | extern void exit_signals(struct task_struct *tsk); | 260 | extern void exit_signals(struct task_struct *tsk); |
261 | 261 | ||
262 | extern struct kmem_cache *sighand_cachep; | 262 | extern struct kmem_cache *sighand_cachep; |
diff --git a/kernel/signal.c b/kernel/signal.c index df8d721a9e6f..677102789cf2 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2368,17 +2368,20 @@ relock: | |||
2368 | } | 2368 | } |
2369 | 2369 | ||
2370 | /** | 2370 | /** |
2371 | * block_sigmask - add @ka's signal mask to current->blocked | 2371 | * signal_delivered - |
2372 | * @ka: action for @signr | 2372 | * @sig: number of signal being delivered |
2373 | * @signr: signal that has been successfully delivered | 2373 | * @info: siginfo_t of signal being delivered |
2374 | * @ka: sigaction setting that chose the handler | ||
2375 | * @regs: user register state | ||
2376 | * @stepping: nonzero if debugger single-step or block-step in use | ||
2374 | * | 2377 | * |
2375 | * This function should be called when a signal has succesfully been | 2378 | * This function should be called when a signal has succesfully been |
2376 | * delivered. It adds the mask of signals for @ka to current->blocked | 2379 | * delivered. It updates the blocked signals accordingly (@ka->sa.sa_mask |
2377 | * so that they are blocked during the execution of the signal | 2380 | * is always blocked, and the signal itself is blocked unless %SA_NODEFER |
2378 | * handler. In addition, @signr will be blocked unless %SA_NODEFER is | 2381 | * is set in @ka->sa.sa_flags. Tracing is notified. |
2379 | * set in @ka->sa.sa_flags. | ||
2380 | */ | 2382 | */ |
2381 | void block_sigmask(struct k_sigaction *ka, int signr) | 2383 | void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, |
2384 | struct pt_regs *regs, int stepping) | ||
2382 | { | 2385 | { |
2383 | sigset_t blocked; | 2386 | sigset_t blocked; |
2384 | 2387 | ||
@@ -2390,8 +2393,9 @@ void block_sigmask(struct k_sigaction *ka, int signr) | |||
2390 | 2393 | ||
2391 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); | 2394 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); |
2392 | if (!(ka->sa.sa_flags & SA_NODEFER)) | 2395 | if (!(ka->sa.sa_flags & SA_NODEFER)) |
2393 | sigaddset(&blocked, signr); | 2396 | sigaddset(&blocked, sig); |
2394 | set_current_blocked(&blocked); | 2397 | set_current_blocked(&blocked); |
2398 | tracehook_signal_handler(sig, info, ka, regs, stepping); | ||
2395 | } | 2399 | } |
2396 | 2400 | ||
2397 | /* | 2401 | /* |