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

Commit b76e59d1 authored by Kumar Gala's avatar Kumar Gala
Browse files

powerpc/kprobes: Some minor fixes



* Mark __flush_icache_range as a function that can't be probed since its
  used by the kprobe code.

* Fix an issue with single stepping and async exceptions.  We need to
  ensure that we dont get an async exception (external, decrementer, etc)
  while we are attempting to single step the probe point.

  Added a check to ensure we only handle a single step if its really
  intended for the instruction in question.

Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent d14b3dd6
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -95,6 +95,11 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)


static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
{
{
	/* We turn off async exceptions to ensure that the single step will
	 * be for the instruction we have the kprobe on, if we dont its
	 * possible we'd get the single step reported for an exception handler
	 * like Decrementer or External Interrupt */
	regs->msr &= ~MSR_EE;
	regs->msr |= MSR_SE;
	regs->msr |= MSR_SE;


	/*
	/*
@@ -376,6 +381,10 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
	if (!cur)
	if (!cur)
		return 0;
		return 0;


	/* make sure we got here for instruction we have a kprobe on */
	if (((unsigned long)cur->ainsn.insn + 4) != regs->nip)
		return 0;

	if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
	if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
		kcb->kprobe_status = KPROBE_HIT_SSDONE;
		kcb->kprobe_status = KPROBE_HIT_SSDONE;
		cur->post_handler(cur, regs, 0);
		cur->post_handler(cur, regs, 0);
+1 −1
Original line number Original line Diff line number Diff line
@@ -489,7 +489,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
 *
 *
 * flush_icache_range(unsigned long start, unsigned long stop)
 * flush_icache_range(unsigned long start, unsigned long stop)
 */
 */
_GLOBAL(__flush_icache_range)
_KPROBE(__flush_icache_range)
BEGIN_FTR_SECTION
BEGIN_FTR_SECTION
	blr				/* for 601, do nothing */
	blr				/* for 601, do nothing */
END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)