[PATCH 7/7] kprobes: Mark globally disabled Kprobes in debugfs interface

From: Petr Mladek
Date: Thu Feb 26 2015 - 11:13:39 EST


Kprobes might get globally disabled by writing to
/sys/kernel/debug/kprobes/enabled but this situation
is not visible in /sys/kernel/debug/kprobes/list.

This patch updates the list, so that it shows [GLOBALLY DISABLED]
when the related Kprobe is enabled but globally disabled.

It also updates the Kprobes documentation.

Signed-off-by: Petr Mladek <pmladek@xxxxxxx>
---
Documentation/kprobes.txt | 5 +++--
kernel/kprobes.c | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
index 4227ec2e3ab2..8de83af9cccb 100644
--- a/Documentation/kprobes.txt
+++ b/Documentation/kprobes.txt
@@ -701,8 +701,9 @@ is also specified. Following columns show probe status. If the probe is on
a virtual address that is no longer valid (module init sections, module
virtual addresses that correspond to modules that've been unloaded),
such probes are marked with [GONE]. If the probe is temporarily disabled,
-such probes are marked with [DISABLED]. If the probe is optimized, it is
-marked with [OPTIMIZED].
+such probes are marked with [DISABLED]. It the probe is enabled but all probes
+are globally disabled, such probes are marked with [GLOBALLY DISABLED].
+If the probe is optimized, it is marked with [OPTIMIZED].

/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly.

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 799f56a50cf9..7fc77c9cdd3b 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2259,9 +2259,11 @@ static void report_probe(struct seq_file *pi, struct kprobe *p,

if (!pp)
pp = p;
- seq_printf(pi, "%s%s%s%s\n",
+ seq_printf(pi, "%s%s%s%s%s\n",
(kprobe_gone(p) ? "[GONE]" : ""),
((kprobe_disabled(p) && !kprobe_gone(p)) ? "[DISABLED]" : ""),
+ ((!kprobe_disabled(p) && !kprobe_gone(p) &&
+ kprobes_all_disarmed) ? "[GLOBALLY DISABLED]" : ""),
(kprobe_optimized(pp) ? "[OPTIMIZED]" : ""),
(kprobe_ftrace(pp) ? "[FTRACE]" : ""));
}
--
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/