diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-02-15 00:17:45 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-02-15 00:17:45 -0500 |
commit | 4b505db9c4c72dbd2a8e66b8d681640101325af6 (patch) | |
tree | edf6aed9194684935e8f88b9501ae3f4ed33f54d /arch | |
parent | 724e6d3fe8003c3f60bf404bf22e4e331327c596 (diff) |
sh64: fix tracing of signals.
This follows the parisc change to ensure that tracehook_signal_handler()
is aware of when we are single-stepping in order to ptrace_notify()
appropriately. While this was implemented for 32-bit SH, sh64 neglected
to make use of TIF_SINGLESTEP when it was folded in with the 32-bit code,
resulting in ptrace_notify() never being called.
As sh64 uses all of the other abstractions already, this simply plugs in
the thread flag in the appropriate enable/disable paths and fixes up the
tracehook notification accordingly. With this in place, sh64 is brought
in line with what 32-bit is already doing.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/kernel/ptrace_64.c | 11 | ||||
-rw-r--r-- | arch/sh/kernel/signal_64.c | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c index 873ebdc4f98e..b063eb8b18e3 100644 --- a/arch/sh/kernel/ptrace_64.c +++ b/arch/sh/kernel/ptrace_64.c | |||
@@ -133,6 +133,8 @@ void user_enable_single_step(struct task_struct *child) | |||
133 | struct pt_regs *regs = child->thread.uregs; | 133 | struct pt_regs *regs = child->thread.uregs; |
134 | 134 | ||
135 | regs->sr |= SR_SSTEP; /* auto-resetting upon exception */ | 135 | regs->sr |= SR_SSTEP; /* auto-resetting upon exception */ |
136 | |||
137 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
136 | } | 138 | } |
137 | 139 | ||
138 | void user_disable_single_step(struct task_struct *child) | 140 | void user_disable_single_step(struct task_struct *child) |
@@ -140,6 +142,8 @@ void user_disable_single_step(struct task_struct *child) | |||
140 | struct pt_regs *regs = child->thread.uregs; | 142 | struct pt_regs *regs = child->thread.uregs; |
141 | 143 | ||
142 | regs->sr &= ~SR_SSTEP; | 144 | regs->sr &= ~SR_SSTEP; |
145 | |||
146 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
143 | } | 147 | } |
144 | 148 | ||
145 | static int genregs_get(struct task_struct *target, | 149 | static int genregs_get(struct task_struct *target, |
@@ -454,6 +458,8 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs) | |||
454 | 458 | ||
455 | asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) | 459 | asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) |
456 | { | 460 | { |
461 | int step; | ||
462 | |||
457 | if (unlikely(current->audit_context)) | 463 | if (unlikely(current->audit_context)) |
458 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]), | 464 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]), |
459 | regs->regs[9]); | 465 | regs->regs[9]); |
@@ -461,8 +467,9 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) | |||
461 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | 467 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) |
462 | trace_sys_exit(regs, regs->regs[9]); | 468 | trace_sys_exit(regs, regs->regs[9]); |
463 | 469 | ||
464 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 470 | step = test_thread_flag(TIF_SINGLESTEP); |
465 | tracehook_report_syscall_exit(regs, 0); | 471 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) |
472 | tracehook_report_syscall_exit(regs, step); | ||
466 | } | 473 | } |
467 | 474 | ||
468 | /* Called with interrupts disabled */ | 475 | /* Called with interrupts disabled */ |
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c index ce76dbdef294..580e97d46ca5 100644 --- a/arch/sh/kernel/signal_64.c +++ b/arch/sh/kernel/signal_64.c | |||
@@ -118,7 +118,9 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
118 | * clear the TS_RESTORE_SIGMASK flag. | 118 | * clear the TS_RESTORE_SIGMASK flag. |
119 | */ | 119 | */ |
120 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | 120 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
121 | tracehook_signal_handler(signr, &info, &ka, regs, 0); | 121 | |
122 | tracehook_signal_handler(signr, &info, &ka, regs, | ||
123 | test_thread_flag(TIF_SINGLESTEP)); | ||
122 | return 1; | 124 | return 1; |
123 | } | 125 | } |
124 | } | 126 | } |