]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
uprobes: Do not setup ->active_uprobe/state prematurely
authorOleg Nesterov <oleg@redhat.com>
Fri, 14 Sep 2012 16:23:51 +0000 (18:23 +0200)
committerOleg Nesterov <oleg@redhat.com>
Sat, 29 Sep 2012 19:21:52 +0000 (21:21 +0200)
handle_swbp() sets utask->active_uprobe before handler_chain(),
and UTASK_SSTEP before pre_ssout(). This complicates the code
for no reason,  arch_ hooks or consumer->handler() should not
(and can't) use this info.

Change handle_swbp() to initialize them after pre_ssout(), and
remove the no longer needed cleanup-utask code.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
cked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

kernel/events/uprobes.c

index 2c1ff05af6f55fffaa0c0b95c38701c47017fd32..41f048c91425c1c8a0ddcd11c8ec4feb22612cf9 100644 (file)
@@ -1496,22 +1496,19 @@ static void handle_swbp(struct pt_regs *regs)
                if (!utask)
                        goto cleanup_ret;
        }
-       utask->active_uprobe = uprobe;
+
        handler_chain(uprobe, regs);
        if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs))
                goto cleanup_ret;
 
-       utask->state = UTASK_SSTEP;
        if (!pre_ssout(uprobe, regs, bp_vaddr)) {
                arch_uprobe_enable_step(&uprobe->arch);
+               utask->active_uprobe = uprobe;
+               utask->state = UTASK_SSTEP;
                return;
        }
 
 cleanup_ret:
-       if (utask) {
-               utask->active_uprobe = NULL;
-               utask->state = UTASK_RUNNING;
-       }
        if (!(uprobe->flags & UPROBE_SKIP_SSTEP))
 
                /*