This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] kprobes: NULL out non-relevant fields in struct kretprobe
- From: Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- To: lkml <linux-kernel at vger dot kernel dot org>
- Cc: Andrew Morton <akpm at osdl dot org>, Anil S Keshavamurthy <anil dot s dot keshavamurthy at intel dot com>, Prasanna S Panchamukhi <prasanna at in dot ibm dot com>, SystemTAP <systemtap at sources dot redhat dot com>, Jim Keniston <jkenisto at us dot ibm dot com>
- Date: Tue, 18 Apr 2006 14:39:50 +0530
- Subject: [PATCH] kprobes: NULL out non-relevant fields in struct kretprobe
- Reply-to: ananth at in dot ibm dot com
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
In cases where a struct kretprobe's *_handler fields are non-NULL, it
is possible to cause a system crash, due to the possibility of calls
ending up in zombie functions. Documentation clearly states that unused
*_handlers should be set to NULL, but kprobe users sometimes fail to
do so.
Fix it by setting the non-relevant fields of the struct kretprobe to NULL.
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Acked-by: Jim Keniston <jkenisto@us.ibm.com>
---
kernel/kprobes.c | 3 +++
1 files changed, 3 insertions(+)
Index: linux-2.6.17-rc1/kernel/kprobes.c
===================================================================
--- linux-2.6.17-rc1.orig/kernel/kprobes.c
+++ linux-2.6.17-rc1/kernel/kprobes.c
@@ -585,6 +585,9 @@ int __kprobes register_kretprobe(struct
int i;
rp->kp.pre_handler = pre_handler_kretprobe;
+ rp->kp.post_handler = NULL;
+ rp->kp.fault_handler = NULL;
+ rp->kp.break_handler = NULL;
/* Pre-allocate memory for max kretprobe instances */
if (rp->maxactive <= 0) {