[PATCH 8/X] uprobes: kill sstep_complete()

From: Oleg Nesterov
Date: Wed Oct 19 2011 - 17:57:12 EST


Kill sstep_complete(), change uprobe_notify_resume() to use post_xol()
unconditionally.

As we already discussed, it is wrong to assume that regs->ip always
changes after the step. rep or jmp/call to self for example. We know
that this task has already done the step, we can rely on DIE_DEBUG
notification.
---
kernel/uprobes.c | 37 +++++++++----------------------------
1 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/kernel/uprobes.c b/kernel/uprobes.c
index a323e0a..135b9a2 100644
--- a/kernel/uprobes.c
+++ b/kernel/uprobes.c
@@ -1321,24 +1321,6 @@ static int pre_ssout(struct uprobe *uprobe, struct pt_regs *regs,
}

/*
- * Verify from Instruction Pointer if singlestep has indeed occurred.
- * If Singlestep has occurred, then do post singlestep fix-ups.
- */
-static bool sstep_complete(struct uprobe *uprobe, struct pt_regs *regs)
-{
- unsigned long vaddr = instruction_pointer(regs);
-
- /*
- * If we have executed out of line, Instruction pointer
- * cannot be same as virtual address of XOL slot.
- */
- if (vaddr == current->utask->xol_vaddr)
- return false;
- post_xol(uprobe, regs);
- return true;
-}
-
-/*
* uprobe_notify_resume gets called in task context just before returning
* to userspace.
*
@@ -1374,7 +1356,7 @@ void uprobe_notify_resume(struct pt_regs *regs)
if (!utask)
goto cleanup_ret;
}
- /* TODO Start queueing signals. */
+
utask->active_uprobe = u;
handler_chain(u, regs);
utask->state = UTASK_SSTEP;
@@ -1385,15 +1367,14 @@ void uprobe_notify_resume(struct pt_regs *regs)
goto cleanup_ret;
} else if (utask->state == UTASK_SSTEP) {
u = utask->active_uprobe;
- if (sstep_complete(u, regs)) {
- put_uprobe(u);
- utask->active_uprobe = NULL;
- utask->state = UTASK_RUNNING;
- user_disable_single_step(current);
- xol_free_insn_slot(current);
-
- /* TODO Stop queueing signals. */
- }
+
+ post_xol(u, regs); /* TODO: check result? */
+
+ put_uprobe(u);
+ utask->active_uprobe = NULL;
+ utask->state = UTASK_RUNNING;
+ user_disable_single_step(current);
+ xol_free_insn_slot(current);
}
return;

--
1.5.5.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/