aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kprobes.h
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-01-06 17:41:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:21 -0500
commite8386a0cb22f4a2d439384212c494ad0bda848fe (patch)
tree84c462bccddead49c0e2c0dcfcc0f70cd9cf60f7 /include/linux/kprobes.h
parent017c39bdb1b3ac1da6db339474a77b528043c05a (diff)
kprobes: support probing module __exit function
Allows kprobes to probe __exit routine. This adds flags member to struct kprobe. When module is freed(kprobes hooks module_notifier to get this event), kprobes which probe the functions in that module are set to "Gone" flag to the flags member. These "Gone" probes are never be enabled. Users can check the GONE flag through debugfs. This also removes mod_refcounted, because we couldn't free a module if kprobe incremented the refcount of that module. [akpm@linux-foundation.org: document some locking] [mhiramat@redhat.com: bugfix: pass aggr_kprobe to arch_remove_kprobe] [mhiramat@redhat.com: bugfix: release old_p's insn_slot before error return] Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kprobes.h')
-rw-r--r--include/linux/kprobes.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index b93e44ce2284..d6ea19e314bb 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -69,9 +69,6 @@ struct kprobe {
69 /* list of kprobes for multi-handler support */ 69 /* list of kprobes for multi-handler support */
70 struct list_head list; 70 struct list_head list;
71 71
72 /* Indicates that the corresponding module has been ref counted */
73 unsigned int mod_refcounted;
74
75 /*count the number of times this probe was temporarily disarmed */ 72 /*count the number of times this probe was temporarily disarmed */
76 unsigned long nmissed; 73 unsigned long nmissed;
77 74
@@ -103,8 +100,19 @@ struct kprobe {
103 100
104 /* copy of the original instruction */ 101 /* copy of the original instruction */
105 struct arch_specific_insn ainsn; 102 struct arch_specific_insn ainsn;
103
104 /* Indicates various status flags. Protected by kprobe_mutex. */
105 u32 flags;
106}; 106};
107 107
108/* Kprobe status flags */
109#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
110
111static inline int kprobe_gone(struct kprobe *p)
112{
113 return p->flags & KPROBE_FLAG_GONE;
114}
115
108/* 116/*
109 * Special probe type that uses setjmp-longjmp type tricks to resume 117 * Special probe type that uses setjmp-longjmp type tricks to resume
110 * execution at a specified entry with a matching prototype corresponding 118 * execution at a specified entry with a matching prototype corresponding