Skip to content

Commit 4a6f316

Browse files
terencelimhiramat
authored andcommitted
kprobe: reverse kp->flags when arm_kprobe failed
In aggregate kprobe case, when arm_kprobe failed, we need set the kp->flags with KPROBE_FLAG_DISABLED again. If not, the 'kp' kprobe will been considered as enabled but it actually not enabled. Link: https://lore.kernel.org/all/[email protected]/ Fixes: 12310e3 ("kprobes: Propagate error from arm_kprobe_ftrace()") Cc: [email protected] Signed-off-by: Li Qiang <[email protected]> Acked-by: Masami Hiramatsu (Google) <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 0e792b8 commit 4a6f316

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/kprobes.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2429,8 +2429,11 @@ int enable_kprobe(struct kprobe *kp)
24292429
if (!kprobes_all_disarmed && kprobe_disabled(p)) {
24302430
p->flags &= ~KPROBE_FLAG_DISABLED;
24312431
ret = arm_kprobe(p);
2432-
if (ret)
2432+
if (ret) {
24332433
p->flags |= KPROBE_FLAG_DISABLED;
2434+
if (p != kp)
2435+
kp->flags |= KPROBE_FLAG_DISABLED;
2436+
}
24342437
}
24352438
out:
24362439
mutex_unlock(&kprobe_mutex);

0 commit comments

Comments
 (0)