public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] Kprobes: Temporary disarming of reentrant probe
@ 2005-05-24 10:15 Prasanna S Panchamukhi
  2005-05-24 10:17 ` [PATCH 2/5] Kprobes: Temporary disarming of reentrant probe for i386 Prasanna S Panchamukhi
  2005-05-24 18:15 ` [PATCH 1/5] Kprobes: Temporary disarming of reentrant probe Andi Kleen
  0 siblings, 2 replies; 9+ messages in thread
From: Prasanna S Panchamukhi @ 2005-05-24 10:15 UTC (permalink / raw)
  To: akpm, ak, davem; +Cc: linux-kernel, systemtap

Hi,

Please provide your feedback on this patchset.

Thanks
Prasanna

In situations where a kprobes handler calls a routine which has a probe on it,
then kprobes_handler() disarms the new probe forever. This patch removes the
above limitation by temporarily disarming the new probe. When the another probe
hits while handling the old probe, the kprobes_handler() saves previous kprobes
state and handles the new probe without calling the new kprobes registered
handlers. kprobe_post_handler() restores back the previous kprobes state and the
normal execution continues.
However on x86_64 architecture, re-rentrancy is provided only through
pre_handler(). If a routine having probe is referenced through post_handler(),
then the probes on that routine are disarmed forever, since the exception stack
is gets changed after the processor single steps the instruction of the new
probe.

This patch includes generic changes to support temporary disarming on
reentrancy of probes.

Signed-of-by: Prasanna S Panchamukhi <prasanna@in.ibm.com>
---


---

 linux-2.6.12-rc4-mm2-prasanna/include/linux/kprobes.h |    9 +++++++++
 linux-2.6.12-rc4-mm2-prasanna/kernel/kprobes.c        |    1 +
 2 files changed, 10 insertions(+)

diff -puN include/linux/kprobes.h~kprobes-temporary-disarming-on-reentrancy-generic include/linux/kprobes.h
--- linux-2.6.12-rc4-mm2/include/linux/kprobes.h~kprobes-temporary-disarming-on-reentrancy-generic	2005-05-24 15:28:08.000000000 +0530
+++ linux-2.6.12-rc4-mm2-prasanna/include/linux/kprobes.h	2005-05-24 15:28:08.000000000 +0530
@@ -36,6 +36,12 @@
 
 #include <asm/kprobes.h>
 
+/* kprobe_status settings */
+#define KPROBE_HIT_ACTIVE	0x00000001
+#define KPROBE_HIT_SS		0x00000002
+#define KPROBE_REENTER		0x00000004
+#define KPROBE_HIT_SSDONE	0x00000008
+
 struct kprobe;
 struct pt_regs;
 struct kretprobe;
@@ -55,6 +61,9 @@ struct kprobe {
 	/* list of kprobes for multi-handler support */
 	struct list_head list;
 
+	/*count the number of times this probe was temporarily disarmed */
+	unsigned long nmissed;
+
 	/* location of the probe point */
 	kprobe_opcode_t *addr;
 
diff -puN kernel/kprobes.c~kprobes-temporary-disarming-on-reentrancy-generic kernel/kprobes.c
--- linux-2.6.12-rc4-mm2/kernel/kprobes.c~kprobes-temporary-disarming-on-reentrancy-generic	2005-05-24 15:28:08.000000000 +0530
+++ linux-2.6.12-rc4-mm2-prasanna/kernel/kprobes.c	2005-05-24 15:28:08.000000000 +0530
@@ -334,6 +334,7 @@ int register_kprobe(struct kprobe *p)
 	}
 	spin_lock_irqsave(&kprobe_lock, flags);
 	old_p = get_kprobe(p->addr);
+	p->nmissed = 0;
 	if (old_p) {
 		ret = register_aggr_kprobe(old_p, p);
 		goto out;

_
-- 

Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<prasanna@in.ibm.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-25 15:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-24 10:15 [PATCH 1/5] Kprobes: Temporary disarming of reentrant probe Prasanna S Panchamukhi
2005-05-24 10:17 ` [PATCH 2/5] Kprobes: Temporary disarming of reentrant probe for i386 Prasanna S Panchamukhi
2005-05-24 10:18   ` [PATCH 3/5] Kprobes: Temporary disarming of reentrant probe for x86_64 Prasanna S Panchamukhi
2005-05-24 10:19     ` [PATCH 4/5] Kprobes: Temporary disarming of reentrant probe for ppc64 Prasanna S Panchamukhi
2005-05-24 10:20       ` [PATCH 5/5] Kprobes: Temporary disarming of reentrant probe for sparc64 Prasanna S Panchamukhi
2005-05-24 18:13     ` [PATCH 3/5] Kprobes: Temporary disarming of reentrant probe for x86_64 Andi Kleen
2005-05-25 15:19   ` [PATCH 2/5] Kprobes: Temporary disarming of reentrant probe for i386 Andi Kleen
2005-05-24 18:15 ` [PATCH 1/5] Kprobes: Temporary disarming of reentrant probe Andi Kleen
2005-05-24 18:21   ` Ananth N Mavinakayanahalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox