The patch titled Subject: kprobes: set kprobes_all_disarmed earlier to enable re-optimization. has been added to the -mm tree. Its filename is kprobes-set-kprobes_all_disarmed-earlier-to-enable-re-optimization.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kprobes-set-kprobes_all_disarmed-earlier-to-enable-re-optimization.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kprobes-set-kprobes_all_disarmed-earlier-to-enable-re-optimization.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: set kprobes_all_disarmed earlier to enable re-optimization. In original code, the probed instruction doesn't get optimized after echo 0 > /sys/kernel/debug/kprobes/enabled echo 1 > /sys/kernel/debug/kprobes/enabled This is because original code checks kprobes_all_disarmed in optimize_kprobe(), but this flag is turned off after calling that function. Therefore, optimize_kprobe() will see kprobes_all_disarmed == true and doesn't do the optimization. This patch simply turns off kprobes_all_disarmed earlier to enable optimization. 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff -puN kernel/kprobes.c~kprobes-set-kprobes_all_disarmed-earlier-to-enable-re-optimization kernel/kprobes.c --- a/kernel/kprobes.c~kprobes-set-kprobes_all_disarmed-earlier-to-enable-re-optimization +++ a/kernel/kprobes.c @@ -2320,6 +2320,12 @@ static void arm_all_kprobes(void) if (!kprobes_all_disarmed) goto already_enabled; + /* + * optimize_kprobe() called by arm_kprobe() checks + * kprobes_all_disarmed, so set kprobes_all_disarmed before + * arm_kprobe. + */ + kprobes_all_disarmed = false; /* Arming kprobes doesn't optimize kprobe itself */ for (i = 0; i < KPROBE_TABLE_SIZE; i++) { head = &kprobe_table[i]; @@ -2328,7 +2334,6 @@ static void arm_all_kprobes(void) arm_kprobe(p); } - kprobes_all_disarmed = false; printk(KERN_INFO "Kprobes globally enabled\n"); already_enabled: _ 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