Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3661999a17b0397c7a93c200b280c55958ba3593
Commit:     3661999a17b0397c7a93c200b280c55958ba3593
Parent:     965d747264c91ed206846d74ae09f757a36a373b
Author:     Shaohua Li <[EMAIL PROTECTED]>
AuthorDate: Tue Nov 13 14:55:20 2007 +0800
Committer:  Tony Luck <[EMAIL PROTECTED]>
CommitDate: Fri Dec 7 16:12:50 2007 -0800

    [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: Shaohua Li <[EMAIL PROTECTED]>
    Signed-off-by: Tony Luck <[EMAIL PROTECTED]>
---
 arch/ia64/kernel/kprobes.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 90518e4..fc4d267 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -435,6 +435,23 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, 
struct pt_regs *regs)
                        /* 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 */
+                       continue;
+
                if (ri->rp && ri->rp->handler)
                        ri->rp->handler(ri, regs);
 
@@ -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();
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to