[PATCH 6/7] kprobes: Check kprobes_all_disarmed in kprobe_disarmed()

Petr Mladek
2015-02-26T16:13:26Z

The global kprobes_all_disarmed flag says that all Kprobes are disarmed
even when they are marked as enabled. Therefore the flag should get
checked by kprobe_disarmed().

Signed-off-by: Petr Mladek <pmladek@suse.cz>
---
kernel/kprobes.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 54bc2a6960b4..799f56a50cf9 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -391,6 +391,9 @@ static inline int kprobe_disarmed(struct kprobe *p)
{
struct optimized_kprobe *op;

+ if (kprobes_all_disarmed)
+ return 1;
+
/* If kprobe is not aggr/opt probe, just return kprobe is disabled */
if (!kprobe_aggrprobe(p))
return kprobe_disabled(p);
@@ -890,9 +893,17 @@ static void __disarm_kprobe(struct kprobe *p, bool reopt)
#define try_to_optimize_kprobe(p) do {} while (0)
#define __arm_kprobe(p) arch_arm_kprobe(p)
#define __disarm_kprobe(p, o) arch_disarm_kprobe(p)
-#define kprobe_disarmed(p) kprobe_disabled(p)
#define wait_for_kprobe_optimizer() do {} while (0)

+/* Return true(!0) if the kprobe is disarmed. Note: p must be on hash list */
+static inline int kprobe_disarmed(struct kprobe *p)
+{
+ if (kprobes_all_disarmed)
+ return 1;
+
+ return kprobe_disabled(p);
+}
+
/* There should be no unused kprobes can be reused without optimization */
static void reuse_unused_kprobe(struct kprobe *ap)
{
--
1.8.5.6