Skip to contentSkip to conversation

Kprobes:Fix unloading of self probed module

PATCH New Keshavamurthy Anil S 1 participant 1 message Jan 9, 2006 kprobes

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Kprobes:Fix unloading of self probed module

[PATCH] Fix unloading of self probed module

When a kprobes modules is written in such a way that probes are inserted on itself, then unload of that moudle was not possible due to reference couning on the same module.

The below patch makes a check and incrementes the module refcount only if it is not a self probed module.

We need to allow modules to probe themself -e.g. kprobes performance measurements

This patch has been tested on several x86_64, ppc64 and IA64 architectures.

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy>
-------------------------------------------------------

 include/linux/kprobes.h |    3 +++
 kernel/kprobes.c        |   42 ++++++++++++++++++++++++++++++++----------
 2 files changed, 35 insertions(+), 10 deletions(-)
include/linux/kprobes.h +3 -0
Index: linux-2.6.15-mm1/include/linux/kprobes.h
===================================================================
@@ -67,6 +67,9 @@ struct kprobe {
 
 	/* list of kprobes for multi-handler support */
 	struct list_head list;
+	
+	/* Indicates that the corresponding module has been ref counted */
+	unsigned int mod_refcounted;
 
 	/*count the number of times this probe was temporarily disarmed */
 	unsigned long nmissed;
kernel/kprobes.c +32 -10

83 lines not on this page · raw message