[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111019215226.GC16395@redhat.com>
Date: Wed, 19 Oct 2011 23:52:26 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
Steven Rostedt <rostedt@...dmis.org>,
Linux-mm <linux-mm@...ck.org>,
Arnaldo Carvalho de Melo <acme@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Hugh Dickins <hughd@...gle.com>,
Christoph Hellwig <hch@...radead.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andi Kleen <andi@...stfloor.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
Roland McGrath <roland@...k.frob.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 9/X] uprobes: introduce UTASK_SSTEP_ACK state
Introduce the new state, UTASK_SSTEP_ACK. uprobe_post_notifier()
sets this state like uprobe_bkpt_notifier() sets UTASK_BP_HIT.
Change uprobe_notify_resume() to always do the post_xol() logic
if state != UTASK_BP_HIT and WARN() if the utask->state is wrong.
This makes the state transitions more explicit. The current code
returns silently if, say, state == UTASK_RUNNING. But this must
not happen, we should complain in this case. And, with the new
state we know for sure that DIE_DEBUG was triggered.
---
include/linux/uprobes.h | 3 ++-
kernel/uprobes.c | 15 ++++++++-------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index a407d17..1591c7c 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -74,7 +74,8 @@ struct uprobe {
enum uprobe_task_state {
UTASK_RUNNING,
UTASK_BP_HIT,
- UTASK_SSTEP
+ UTASK_SSTEP,
+ UTASK_SSTEP_ACK,
};
/*
diff --git a/kernel/uprobes.c b/kernel/uprobes.c
index 135b9a2..5fd72b8 100644
--- a/kernel/uprobes.c
+++ b/kernel/uprobes.c
@@ -1365,10 +1365,13 @@ void uprobe_notify_resume(struct pt_regs *regs)
else
/* Cannot Singlestep; re-execute the instruction. */
goto cleanup_ret;
- } else if (utask->state == UTASK_SSTEP) {
+ } else {
u = utask->active_uprobe;
- post_xol(u, regs); /* TODO: check result? */
+ if (utask->state == UTASK_SSTEP_ACK)
+ post_xol(u, regs); /* TODO: check result? */
+ else
+ WARN_ON_ONCE(1);
put_uprobe(u);
utask->active_uprobe = NULL;
@@ -1416,15 +1419,13 @@ int uprobe_bkpt_notifier(struct pt_regs *regs)
*/
int uprobe_post_notifier(struct pt_regs *regs)
{
- struct uprobe *uprobe;
- struct uprobe_task *utask;
+ struct uprobe_task *utask = current->utask;
- if (!current->mm || !current->utask || !current->utask->active_uprobe)
+ if (!current->mm || !utask || !utask->active_uprobe)
/* task is currently not uprobed */
return 0;
- utask = current->utask;
- uprobe = utask->active_uprobe;
+ utask->state = UTASK_SSTEP_ACK;
set_thread_flag(TIF_UPROBE);
return 1;
}
--
1.5.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists