Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76b0f133 authored by Paul Mackerras's avatar Paul Mackerras
Browse files

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: default avatarPaul Mackerras <paulus@samba.org>
parent 574cb248
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -304,15 +304,16 @@ int __kprobes single_step_dabr_instruction(struct die_args *args)
	if (!bp_info->extraneous_interrupt)
	if (!bp_info->extraneous_interrupt)
		perf_bp_event(bp, regs);
		perf_bp_event(bp, regs);


	set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
	current->thread.last_hit_ubp = NULL;

	/*
	/*
	 * Do not disable MSR_SE if the process was already in
	 * If the process was being single-stepped by ptrace, let the
	 * single-stepping mode.
	 * other single-step actions occur (e.g. generate SIGTRAP).
	 */
	 */
	if (!test_thread_flag(TIF_SINGLESTEP))
	if (test_thread_flag(TIF_SINGLESTEP))
		regs->msr &= ~MSR_SE;
		return NOTIFY_DONE;


	set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
	current->thread.last_hit_ubp = NULL;
	return NOTIFY_STOP;
	return NOTIFY_STOP;
}
}