aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/hw_breakpoint.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2010-06-23 01:46:55 -0400
committerPaul Mackerras <paulus@samba.org>2010-06-23 01:46:55 -0400
commit76b0f1337690d223811c852ad3a5078eb89276c5 (patch)
tree5deeecb1c815a97681ea548b226d38d369a51772 /arch/powerpc/kernel/hw_breakpoint.c
parent574cb24899d35e71be1d8fb1add2c3306804e4bf (diff)
powerpc, hw_breakpoint: Cooperate better with other single-steppers
The code we had to clear the MSR_SE bit was not doing anything because the caller (ultimately single_step_exception() in traps.c) had already cleared. Instead of trying to leave MSR_SE set if the TIF_SINGLESTEP flag is set (which indicates that the process is being single-stepped by ptrace), we instead return NOTIFY_DONE in that case, which means the caller will generate a SIGTRAP for the process. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/hw_breakpoint.c')
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 241e09712314..5a1d55d06a08 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -304,15 +304,16 @@ int __kprobes single_step_dabr_instruction(struct die_args *args)
304 if (!bp_info->extraneous_interrupt) 304 if (!bp_info->extraneous_interrupt)
305 perf_bp_event(bp, regs); 305 perf_bp_event(bp, regs);
306 306
307 set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
308 current->thread.last_hit_ubp = NULL;
309
307 /* 310 /*
308 * Do not disable MSR_SE if the process was already in 311 * If the process was being single-stepped by ptrace, let the
309 * single-stepping mode. 312 * other single-step actions occur (e.g. generate SIGTRAP).
310 */ 313 */
311 if (!test_thread_flag(TIF_SINGLESTEP)) 314 if (test_thread_flag(TIF_SINGLESTEP))
312 regs->msr &= ~MSR_SE; 315 return NOTIFY_DONE;
313 316
314 set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
315 current->thread.last_hit_ubp = NULL;
316 return NOTIFY_STOP; 317 return NOTIFY_STOP;
317} 318}
318 319