diff options
| author | Roland McGrath <roland@redhat.com> | 2008-03-14 20:46:38 -0400 |
|---|---|---|
| committer | Roland McGrath <roland@redhat.com> | 2008-07-26 17:37:59 -0400 |
| commit | 36a033082b5243d45d508c5ccd47a754edbc6821 (patch) | |
| tree | 5713fa16a1681092936409e3a372c27421778555 | |
| parent | a048d3aff8b828b6c0fa7ddd90a531248ab4e0f9 (diff) | |
x86: tracehook_signal_handler
This makes the x86 signal handling code use tracehook_signal_handler() in
place of calling into ptrace guts. The call is moved after the sa_mask
processing, but there is no other change. This cleanup doesn't matter to
existing debuggers, but is the sensible thing: have all facets of the
handler setup complete before the debugger inspects the task again.
Signed-off-by: Roland McGrath <roland@redhat.com>
| -rw-r--r-- | arch/x86/kernel/signal_32.c | 6 | ||||
| -rw-r--r-- | arch/x86/kernel/signal_64.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c index 6fb5bcdd8933..22aae1683c14 100644 --- a/arch/x86/kernel/signal_32.c +++ b/arch/x86/kernel/signal_32.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
| 18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
| 19 | #include <linux/wait.h> | 19 | #include <linux/wait.h> |
| 20 | #include <linux/tracehook.h> | ||
| 20 | #include <linux/elf.h> | 21 | #include <linux/elf.h> |
| 21 | #include <linux/smp.h> | 22 | #include <linux/smp.h> |
| 22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
| @@ -558,8 +559,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
| 558 | * handler too. | 559 | * handler too. |
| 559 | */ | 560 | */ |
| 560 | regs->flags &= ~X86_EFLAGS_TF; | 561 | regs->flags &= ~X86_EFLAGS_TF; |
| 561 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
| 562 | ptrace_notify(SIGTRAP); | ||
| 563 | 562 | ||
| 564 | spin_lock_irq(¤t->sighand->siglock); | 563 | spin_lock_irq(¤t->sighand->siglock); |
| 565 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | 564 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); |
| @@ -568,6 +567,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
| 568 | recalc_sigpending(); | 567 | recalc_sigpending(); |
| 569 | spin_unlock_irq(¤t->sighand->siglock); | 568 | spin_unlock_irq(¤t->sighand->siglock); |
| 570 | 569 | ||
| 570 | tracehook_signal_handler(sig, info, ka, regs, | ||
| 571 | test_thread_flag(TIF_SINGLESTEP)); | ||
| 572 | |||
| 571 | return 0; | 573 | return 0; |
| 572 | } | 574 | } |
| 573 | 575 | ||
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c index b45ef8ddd651..3beb2db88c5a 100644 --- a/arch/x86/kernel/signal_64.c +++ b/arch/x86/kernel/signal_64.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
| 16 | #include <linux/wait.h> | 16 | #include <linux/wait.h> |
| 17 | #include <linux/ptrace.h> | 17 | #include <linux/ptrace.h> |
| 18 | #include <linux/tracehook.h> | ||
| 18 | #include <linux/unistd.h> | 19 | #include <linux/unistd.h> |
| 19 | #include <linux/stddef.h> | 20 | #include <linux/stddef.h> |
| 20 | #include <linux/personality.h> | 21 | #include <linux/personality.h> |
| @@ -444,8 +445,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
| 444 | * handler too. | 445 | * handler too. |
| 445 | */ | 446 | */ |
| 446 | regs->flags &= ~X86_EFLAGS_TF; | 447 | regs->flags &= ~X86_EFLAGS_TF; |
| 447 | if (test_thread_flag(TIF_SINGLESTEP)) | ||
| 448 | ptrace_notify(SIGTRAP); | ||
| 449 | 448 | ||
| 450 | spin_lock_irq(¤t->sighand->siglock); | 449 | spin_lock_irq(¤t->sighand->siglock); |
| 451 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 450 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
| @@ -453,6 +452,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, | |||
| 453 | sigaddset(¤t->blocked,sig); | 452 | sigaddset(¤t->blocked,sig); |
| 454 | recalc_sigpending(); | 453 | recalc_sigpending(); |
| 455 | spin_unlock_irq(¤t->sighand->siglock); | 454 | spin_unlock_irq(¤t->sighand->siglock); |
| 455 | |||
| 456 | tracehook_signal_handler(sig, info, ka, regs, | ||
| 457 | test_thread_flag(TIF_SINGLESTEP)); | ||
| 456 | } | 458 | } |
| 457 | 459 | ||
| 458 | return ret; | 460 | return ret; |
