diff options
author | Ananth N Mavinakayanahalli <ananth@in.ibm.com> | 2007-05-08 03:34:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:19 -0400 |
commit | bf8f6e5b3e51ee0c64c2d1350c70198ddc8ad3f7 (patch) | |
tree | c48ebb92f836cfac58465eacc9658fbc2bac4783 /arch | |
parent | 4c4308cb93450989846ac49faeb6dab943e7657e (diff) |
Kprobes: The ON/OFF knob thru debugfs
This patch provides a debugfs knob to turn kprobes on/off
o A new file /debug/kprobes/enabled indicates if kprobes is enabled or
not (default enabled)
o Echoing 0 to this file will disarm all installed probes
o Any new probe registration when disabled will register the probe but
not arm it. A message will be printed out in such a case.
o When a value 1 is echoed to the file, all probes (including ones
registered in the intervening period) will be enabled
o Unregistration will happen irrespective of whether probes are globally
enabled or not.
o Update Documentation/kprobes.txt to reflect these changes. While there
also update the doc to make it current.
We are also looking at providing sysrq key support to tie to the disabling
feature provided by this patch.
[akpm@linux-foundation.org: Use bool like a bool!]
[akpm@linux-foundation.org: add printk facility levels]
[cornelia.huck@de.ibm.com: Add the missing arch_trampoline_kprobe() for s390]
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Srinivasa DS <srinivasa@in.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/kprobes.c | 5 | ||||
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 9 | ||||
-rw-r--r-- | arch/powerpc/kernel/kprobes.c | 8 | ||||
-rw-r--r-- | arch/s390/kernel/kprobes.c | 7 | ||||
-rw-r--r-- | arch/x86_64/kernel/kprobes.c | 8 |
5 files changed, 37 insertions, 0 deletions
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index b6a9d64c2251..dde828a333c3 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -743,6 +743,11 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
743 | return 0; | 743 | return 0; |
744 | } | 744 | } |
745 | 745 | ||
746 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
747 | { | ||
748 | return 0; | ||
749 | } | ||
750 | |||
746 | int __init arch_init_kprobes(void) | 751 | int __init arch_init_kprobes(void) |
747 | { | 752 | { |
748 | return 0; | 753 | return 0; |
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 0b72f0f94192..4f5fd0960ba7 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -1012,3 +1012,12 @@ int __init arch_init_kprobes(void) | |||
1012 | (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; | 1012 | (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; |
1013 | return register_kprobe(&trampoline_p); | 1013 | return register_kprobe(&trampoline_p); |
1014 | } | 1014 | } |
1015 | |||
1016 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
1017 | { | ||
1018 | if (p->addr == | ||
1019 | (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip) | ||
1020 | return 1; | ||
1021 | |||
1022 | return 0; | ||
1023 | } | ||
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index aed58e1cb91f..088b8c6defa0 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -550,3 +550,11 @@ int __init arch_init_kprobes(void) | |||
550 | { | 550 | { |
551 | return register_kprobe(&trampoline_p); | 551 | return register_kprobe(&trampoline_p); |
552 | } | 552 | } |
553 | |||
554 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
555 | { | ||
556 | if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) | ||
557 | return 1; | ||
558 | |||
559 | return 0; | ||
560 | } | ||
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index 9d0f0d09d473..e39333ae0fcf 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c | |||
@@ -661,3 +661,10 @@ int __init arch_init_kprobes(void) | |||
661 | { | 661 | { |
662 | return register_kprobe(&trampoline_p); | 662 | return register_kprobe(&trampoline_p); |
663 | } | 663 | } |
664 | |||
665 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
666 | { | ||
667 | if (p->addr == (kprobe_opcode_t *) & kretprobe_trampoline) | ||
668 | return 1; | ||
669 | return 0; | ||
670 | } | ||
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index f995bea6e2c1..d4a0d0ac9935 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -743,3 +743,11 @@ int __init arch_init_kprobes(void) | |||
743 | { | 743 | { |
744 | return register_kprobe(&trampoline_p); | 744 | return register_kprobe(&trampoline_p); |
745 | } | 745 | } |
746 | |||
747 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | ||
748 | { | ||
749 | if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline) | ||
750 | return 1; | ||
751 | |||
752 | return 0; | ||
753 | } | ||