Substitute panic(...) with printk(...) in dbi_unregister_uretprobe
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Tue, 19 Feb 2013 10:14:01 +0000 (14:14 +0400)
committerVasiliy Ulyanov <v.ulyanov@samsung.com>
Tue, 19 Feb 2013 10:14:01 +0000 (14:14 +0400)
Sometimes the stack cannot be recovered after userspace instrumentation
because the corresponding function does not save LR value. In this case
it is better to print a warning instead of calling panic (the worst that
can happen is the instrumented application crashing with segmentation
fault). Currently the function _start is known to cause such an error.
But actually it never returns so it is save to ignore this issue and
just recycle the coresponding retprobe instance.

kprobe/dbi_uprobes.c

index 3eebb7a..3937996 100644 (file)
@@ -328,12 +328,11 @@ void dbi_unregister_uretprobe(struct task_struct *task, struct kretprobe *rp, in
        spin_lock_irqsave (&kretprobe_lock, flags);
 
        while ((ri = get_used_rp_inst(rp)) != NULL) {
-               if (dbi_disarm_urp_inst(ri) == 0)
-                       recycle_rp_inst(ri);
-               else
-                       panic("%s (%d/%d): cannot disarm urp instance (%08lx)",
+               if (dbi_disarm_urp_inst(ri) != 0)
+                       /*panic*/printk("%s (%d/%d): cannot disarm urp instance (%08lx)\n",
                                        ri->task->comm, ri->task->tgid, ri->task->pid, 
                                        (unsigned long)rp->kp.addr);
+               recycle_rp_inst(ri);
        }
 
        if (hlist_empty(&rp->used_instances) || not_rp2) {