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

Commit 40102d4a authored by Harvey Harrison's avatar Harvey Harrison Committed by Ingo Molnar
Browse files

x86: add reenter_kprobe helper



[ mhiramat@redhat.com: updated it to latest x86.git ]

Factor common X86_32, X86_64 kprobe reenter logic from deeply
indented section to helper function.

Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
parent ddc66df8
Loading
Loading
Loading
Loading
+15 −11
Original line number Original line Diff line number Diff line
@@ -427,6 +427,20 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
	/* Replace the return addr with trampoline addr */
	/* Replace the return addr with trampoline addr */
	*sara = (unsigned long) &kretprobe_trampoline;
	*sara = (unsigned long) &kretprobe_trampoline;
}
}
/*
 * We have reentered the kprobe_handler(), since another probe was hit while
 * within the handler. We save the original kprobes variables and just single
 * step on the instruction of the new probe without calling any user handlers.
 */
static void __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs,
				     struct kprobe_ctlblk *kcb)
{
	save_previous_kprobe(kcb);
	set_current_kprobe(p, regs, kcb);
	kprobes_inc_nmissed_count(p);
	prepare_singlestep(p, regs);
	kcb->kprobe_status = KPROBE_REENTER;
}


/*
/*
 * Interrupts are disabled on entry as trap3 is an interrupt gate and they
 * Interrupts are disabled on entry as trap3 is an interrupt gate and they
@@ -471,17 +485,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
				goto no_kprobe;
				goto no_kprobe;
#endif
#endif
			}
			}
			/* We have reentered the kprobe_handler(), since
			reenter_kprobe(p, regs, kcb);
			 * another probe was hit while within the handler.
			 * We here save the original kprobes variables and
			 * just single step on the instruction of the new probe
			 * without calling any user handlers.
			 */
			save_previous_kprobe(kcb);
			set_current_kprobe(p, regs, kcb);
			kprobes_inc_nmissed_count(p);
			prepare_singlestep(p, regs);
			kcb->kprobe_status = KPROBE_REENTER;
			return 1;
			return 1;
		} else {
		} else {
			if (*addr != BREAKPOINT_INSTRUCTION) {
			if (*addr != BREAKPOINT_INSTRUCTION) {