diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-09-14 12:23:51 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2012-09-29 15:21:52 -0400 |
commit | 746a9e6ba24af2ccf03279c99d435a1b88ca5d17 (patch) | |
tree | 7ee4399b90c952520c492fea64cb2d841341d0d4 /kernel | |
parent | 79d54b249c176ba4abb9a580951400246dd974b1 (diff) |
uprobes: Do not setup ->active_uprobe/state prematurely
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/uprobes.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 2c1ff05af6f5..41f048c91425 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -1496,22 +1496,19 @@ static void handle_swbp(struct pt_regs *regs) | |||
1496 | if (!utask) | 1496 | if (!utask) |
1497 | goto cleanup_ret; | 1497 | goto cleanup_ret; |
1498 | } | 1498 | } |
1499 | utask->active_uprobe = uprobe; | 1499 | |
1500 | handler_chain(uprobe, regs); | 1500 | handler_chain(uprobe, regs); |
1501 | if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs)) | 1501 | if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs)) |
1502 | goto cleanup_ret; | 1502 | goto cleanup_ret; |
1503 | 1503 | ||
1504 | utask->state = UTASK_SSTEP; | ||
1505 | if (!pre_ssout(uprobe, regs, bp_vaddr)) { | 1504 | if (!pre_ssout(uprobe, regs, bp_vaddr)) { |
1506 | arch_uprobe_enable_step(&uprobe->arch); | 1505 | arch_uprobe_enable_step(&uprobe->arch); |
1506 | utask->active_uprobe = uprobe; | ||
1507 | utask->state = UTASK_SSTEP; | ||
1507 | return; | 1508 | return; |
1508 | } | 1509 | } |
1509 | 1510 | ||
1510 | cleanup_ret: | 1511 | cleanup_ret: |
1511 | if (utask) { | ||
1512 | utask->active_uprobe = NULL; | ||
1513 | utask->state = UTASK_RUNNING; | ||
1514 | } | ||
1515 | if (!(uprobe->flags & UPROBE_SKIP_SSTEP)) | 1512 | if (!(uprobe->flags & UPROBE_SKIP_SSTEP)) |
1516 | 1513 | ||
1517 | /* | 1514 | /* |