diff options
Diffstat (limited to 'include/linux/kprobes.h')
-rw-r--r-- | include/linux/kprobes.h | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 2ec6cc14a114..bcd9c07848be 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -94,12 +94,16 @@ struct kprobe { | |||
94 | /* Called after addr is executed, unless... */ | 94 | /* Called after addr is executed, unless... */ |
95 | kprobe_post_handler_t post_handler; | 95 | kprobe_post_handler_t post_handler; |
96 | 96 | ||
97 | /* ... called if executing addr causes a fault (eg. page fault). | 97 | /* |
98 | * Return 1 if it handled fault, otherwise kernel will see it. */ | 98 | * ... called if executing addr causes a fault (eg. page fault). |
99 | * Return 1 if it handled fault, otherwise kernel will see it. | ||
100 | */ | ||
99 | kprobe_fault_handler_t fault_handler; | 101 | kprobe_fault_handler_t fault_handler; |
100 | 102 | ||
101 | /* ... called if breakpoint trap occurs in probe handler. | 103 | /* |
102 | * Return 1 if it handled break, otherwise kernel will see it. */ | 104 | * ... called if breakpoint trap occurs in probe handler. |
105 | * Return 1 if it handled break, otherwise kernel will see it. | ||
106 | */ | ||
103 | kprobe_break_handler_t break_handler; | 107 | kprobe_break_handler_t break_handler; |
104 | 108 | ||
105 | /* Saved opcode (which has been replaced with breakpoint) */ | 109 | /* Saved opcode (which has been replaced with breakpoint) */ |
@@ -108,18 +112,28 @@ struct kprobe { | |||
108 | /* copy of the original instruction */ | 112 | /* copy of the original instruction */ |
109 | struct arch_specific_insn ainsn; | 113 | struct arch_specific_insn ainsn; |
110 | 114 | ||
111 | /* Indicates various status flags. Protected by kprobe_mutex. */ | 115 | /* |
116 | * Indicates various status flags. | ||
117 | * Protected by kprobe_mutex after this kprobe is registered. | ||
118 | */ | ||
112 | u32 flags; | 119 | u32 flags; |
113 | }; | 120 | }; |
114 | 121 | ||
115 | /* Kprobe status flags */ | 122 | /* Kprobe status flags */ |
116 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ | 123 | #define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ |
124 | #define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */ | ||
117 | 125 | ||
126 | /* Has this kprobe gone ? */ | ||
118 | static inline int kprobe_gone(struct kprobe *p) | 127 | static inline int kprobe_gone(struct kprobe *p) |
119 | { | 128 | { |
120 | return p->flags & KPROBE_FLAG_GONE; | 129 | return p->flags & KPROBE_FLAG_GONE; |
121 | } | 130 | } |
122 | 131 | ||
132 | /* Is this kprobe disabled ? */ | ||
133 | static inline int kprobe_disabled(struct kprobe *p) | ||
134 | { | ||
135 | return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE); | ||
136 | } | ||
123 | /* | 137 | /* |
124 | * Special probe type that uses setjmp-longjmp type tricks to resume | 138 | * Special probe type that uses setjmp-longjmp type tricks to resume |
125 | * execution at a specified entry with a matching prototype corresponding | 139 | * execution at a specified entry with a matching prototype corresponding |
@@ -279,6 +293,9 @@ void unregister_kretprobes(struct kretprobe **rps, int num); | |||
279 | void kprobe_flush_task(struct task_struct *tk); | 293 | void kprobe_flush_task(struct task_struct *tk); |
280 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | 294 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); |
281 | 295 | ||
296 | int disable_kprobe(struct kprobe *kp); | ||
297 | int enable_kprobe(struct kprobe *kp); | ||
298 | |||
282 | #else /* !CONFIG_KPROBES: */ | 299 | #else /* !CONFIG_KPROBES: */ |
283 | 300 | ||
284 | static inline int kprobes_built_in(void) | 301 | static inline int kprobes_built_in(void) |
@@ -345,5 +362,30 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num) | |||
345 | static inline void kprobe_flush_task(struct task_struct *tk) | 362 | static inline void kprobe_flush_task(struct task_struct *tk) |
346 | { | 363 | { |
347 | } | 364 | } |
365 | static inline int disable_kprobe(struct kprobe *kp) | ||
366 | { | ||
367 | return -ENOSYS; | ||
368 | } | ||
369 | static inline int enable_kprobe(struct kprobe *kp) | ||
370 | { | ||
371 | return -ENOSYS; | ||
372 | } | ||
348 | #endif /* CONFIG_KPROBES */ | 373 | #endif /* CONFIG_KPROBES */ |
374 | static inline int disable_kretprobe(struct kretprobe *rp) | ||
375 | { | ||
376 | return disable_kprobe(&rp->kp); | ||
377 | } | ||
378 | static inline int enable_kretprobe(struct kretprobe *rp) | ||
379 | { | ||
380 | return enable_kprobe(&rp->kp); | ||
381 | } | ||
382 | static inline int disable_jprobe(struct jprobe *jp) | ||
383 | { | ||
384 | return disable_kprobe(&jp->kp); | ||
385 | } | ||
386 | static inline int enable_jprobe(struct jprobe *jp) | ||
387 | { | ||
388 | return enable_kprobe(&jp->kp); | ||
389 | } | ||
390 | |||
349 | #endif /* _LINUX_KPROBES_H */ | 391 | #endif /* _LINUX_KPROBES_H */ |