diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-04-06 22:01:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 11:31:08 -0400 |
commit | de5bd88d5a5cce3cacea904d3503e5ebdb3852a2 (patch) | |
tree | da24ac8b38d371ee03a21ed0f3647c518689ebd3 /Documentation | |
parent | e579abeb58eb4b8d7321c6eb44dd9e2d0cbaebaa (diff) |
kprobes: support per-kprobe disabling
Add disable_kprobe() and enable_kprobe() to disable/enable kprobes
temporarily.
disable_kprobe() asynchronously disables probe handlers of specified
kprobe. So, after calling it, some handlers can be called at a while.
enable_kprobe() enables specified kprobe.
aggr_pre_handler and aggr_post_handler check disabled probes. On the
other hand aggr_break_handler and aggr_fault_handler don't check it
because these handlers will be called while executing pre or post handlers
and usually those help error handling.
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>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/kprobes.txt | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index 48b3de90eb1e..f609af242d6c 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt | |||
@@ -212,7 +212,9 @@ hit, Kprobes calls kp->pre_handler. After the probed instruction | |||
212 | is single-stepped, Kprobe calls kp->post_handler. If a fault | 212 | is single-stepped, Kprobe calls kp->post_handler. If a fault |
213 | occurs during execution of kp->pre_handler or kp->post_handler, | 213 | occurs during execution of kp->pre_handler or kp->post_handler, |
214 | or during single-stepping of the probed instruction, Kprobes calls | 214 | or during single-stepping of the probed instruction, Kprobes calls |
215 | kp->fault_handler. Any or all handlers can be NULL. | 215 | kp->fault_handler. Any or all handlers can be NULL. If kp->flags |
216 | is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled, | ||
217 | so, it's handlers aren't hit until calling enable_kprobe(kp). | ||
216 | 218 | ||
217 | NOTE: | 219 | NOTE: |
218 | 1. With the introduction of the "symbol_name" field to struct kprobe, | 220 | 1. With the introduction of the "symbol_name" field to struct kprobe, |
@@ -363,6 +365,22 @@ probes) in the specified array, they clear the addr field of those | |||
363 | incorrect probes. However, other probes in the array are | 365 | incorrect probes. However, other probes in the array are |
364 | unregistered correctly. | 366 | unregistered correctly. |
365 | 367 | ||
368 | 4.7 disable_kprobe | ||
369 | |||
370 | #include <linux/kprobes.h> | ||
371 | int disable_kprobe(struct kprobe *kp); | ||
372 | |||
373 | Temporarily disables the specified kprobe. You can enable it again by using | ||
374 | enable_kprobe(). You must specify the kprobe which has been registered. | ||
375 | |||
376 | 4.8 enable_kprobe | ||
377 | |||
378 | #include <linux/kprobes.h> | ||
379 | int enable_kprobe(struct kprobe *kp); | ||
380 | |||
381 | Enables kprobe which has been disabled by disable_kprobe(). You must specify | ||
382 | the kprobe which has been registered. | ||
383 | |||
366 | 5. Kprobes Features and Limitations | 384 | 5. Kprobes Features and Limitations |
367 | 385 | ||
368 | Kprobes allows multiple probes at the same address. Currently, | 386 | Kprobes allows multiple probes at the same address. Currently, |
@@ -500,10 +518,14 @@ the probe. If the probed function belongs to a module, the module name | |||
500 | is also specified. Following columns show probe status. If the probe is on | 518 | is also specified. Following columns show probe status. If the probe is on |
501 | a virtual address that is no longer valid (module init sections, module | 519 | a virtual address that is no longer valid (module init sections, module |
502 | virtual addresses that correspond to modules that've been unloaded), | 520 | virtual addresses that correspond to modules that've been unloaded), |
503 | such probes are marked with [GONE]. | 521 | such probes are marked with [GONE]. If the probe is temporarily disabled, |
522 | such probes are marked with [DISABLED]. | ||
504 | 523 | ||
505 | /debug/kprobes/enabled: Turn kprobes ON/OFF | 524 | /debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. |
506 | 525 | ||
507 | Provides a knob to globally turn registered kprobes ON or OFF. By default, | 526 | Provides a knob to globally and forcibly turn registered kprobes ON or OFF. |
508 | all kprobes are enabled. By echoing "0" to this file, all registered probes | 527 | By default, all kprobes are enabled. By echoing "0" to this file, all |
509 | will be disarmed, till such time a "1" is echoed to this file. | 528 | registered probes will be disarmed, till such time a "1" is echoed to this |
529 | file. Note that this knob just disarms and arms all kprobes and doesn't | ||
530 | change each probe's disabling state. This means that disabled kprobes (marked | ||
531 | [DISABLED]) will be not enabled if you turn ON all kprobes by this knob. | ||