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

Commit 3661999a authored by Shaohua Li's avatar Shaohua Li Committed by Tony Luck
Browse files

[IA64] kprobe: make kreturn probe handler stack unwind correct

Restore regs->ccr_iip before kreturn probe handler runs. In this way, if
probe handler does unwind, unwind can correctly get the stack trace.

Fixes: http://sourceware.org/bugzilla/show_bug.cgi?id=5051



Signed-off-by: default avatarShaohua Li <shaohua.li@intel.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 965d7472
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -430,6 +430,23 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
	 *       real return address, and all the rest will point to
	 *       kretprobe_trampoline
	 */
	hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
		if (ri->task != current)
			/* another task is sharing our hash bucket */
			continue;

		orig_ret_address = (unsigned long)ri->ret_addr;
		if (orig_ret_address != trampoline_address)
			/*
			 * This is the real return address. Any other
			 * instances associated with this task are for
			 * other calls deeper on the call stack
			 */
			break;
	}

	regs->cr_iip = orig_ret_address;

	hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
		if (ri->task != current)
			/* another task is sharing our hash bucket */
@@ -452,8 +469,6 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)

	kretprobe_assert(ri, orig_ret_address, trampoline_address);

	regs->cr_iip = orig_ret_address;

	reset_current_kprobe();
	spin_unlock_irqrestore(&kretprobe_lock, flags);
	preempt_enable_no_resched();