The patch titled Subject: kprobes: makes kprobes/enabled works correctly for optimized kprobes. has been added to the -mm tree. Its filename is kprobes-makes-kprobes-enabled-works-correctly-for-optimized-kprobes.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kprobes-makes-kprobes-enabled-works-correctly-for-optimized-kprobes.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kprobes-makes-kprobes-enabled-works-correctly-for-optimized-kprobes.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Wang Nan <wangnan0@xxxxxxxxxx> Subject: kprobes: makes kprobes/enabled works correctly for optimized kprobes. debugfs/kprobes/enabled doesn't work correctly on optimized kprobes. Masami Hiramatsu has a test report on x86_64 platform: https://lkml.org/lkml/2015/1/19/274 This patch forces it to unoptimize kprobe if kprobes_all_disarmed is set. It also checks the flag in unregistering path for skipping unneeded disarming process when kprobes globally disarmed. Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/kprobes.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff -puN kernel/kprobes.c~kprobes-makes-kprobes-enabled-works-correctly-for-optimized-kprobes kernel/kprobes.c --- a/kernel/kprobes.c~kprobes-makes-kprobes-enabled-works-correctly-for-optimized-kprobes +++ a/kernel/kprobes.c @@ -869,7 +869,8 @@ static void __disarm_kprobe(struct kprob { struct kprobe *_p; - unoptimize_kprobe(p, false); /* Try to unoptimize */ + /* Try to unoptimize */ + unoptimize_kprobe(p, kprobes_all_disarmed); if (!kprobe_queued(p)) { arch_disarm_kprobe(p); @@ -1571,7 +1572,13 @@ static struct kprobe *__disable_kprobe(s /* Try to disarm and disable this/parent probe */ if (p == orig_p || aggr_kprobe_disabled(orig_p)) { - disarm_kprobe(orig_p, true); + /* + * If kprobes_all_disarmed is set, orig_p + * should have already been disarmed, so + * skip unneed disarming process. + */ + if (!kprobes_all_disarmed) + disarm_kprobe(orig_p, true); orig_p->flags |= KPROBE_FLAG_DISABLED; } } _ Patches currently in -mm which might be from wangnan0@xxxxxxxxxx are kprobes-set-kprobes_all_disarmed-earlier-to-enable-re-optimization.patch kprobes-makes-kprobes-enabled-works-correctly-for-optimized-kprobes.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html