From: Greg Kroah-Hartman Date: Thu, 2 Oct 2014 19:37:57 +0000 (-0700) Subject: 3.16-stable patches X-Git-Tag: v3.16.4~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c1c70e2ad7142e4cbcf31410f4d7b02687ef7e82;p=thirdparty%2Fkernel%2Fstable-queue.git 3.16-stable patches added patches: ftrace-use-current-addr-when-converting-to-nop-in-__ftrace_replace_code.patch --- diff --git a/queue-3.16/ftrace-use-current-addr-when-converting-to-nop-in-__ftrace_replace_code.patch b/queue-3.16/ftrace-use-current-addr-when-converting-to-nop-in-__ftrace_replace_code.patch new file mode 100644 index 00000000000..0efd82da984 --- /dev/null +++ b/queue-3.16/ftrace-use-current-addr-when-converting-to-nop-in-__ftrace_replace_code.patch @@ -0,0 +1,57 @@ +From 39b5552cd5090d4c210d278cd2732f493075f033 Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (Red Hat)" +Date: Sun, 17 Aug 2014 20:59:10 -0400 +Subject: ftrace: Use current addr when converting to nop in __ftrace_replace_code() + +From: "Steven Rostedt (Red Hat)" + +commit 39b5552cd5090d4c210d278cd2732f493075f033 upstream. + +In __ftrace_replace_code(), when converting the call to a nop in a function +it needs to compare against the "curr" (current) value of the ftrace ops, and +not the "new" one. It currently does not affect x86 which is the only arch +to do the trampolines with function graph tracer, but when other archs that do +depend on this code implement the function graph trampoline, it can crash. + +Here's an example when ARM uses the trampolines (in the future): + + ------------[ cut here ]------------ + WARNING: CPU: 0 PID: 9 at kernel/trace/ftrace.c:1716 ftrace_bug+0x17c/0x1f4() + Modules linked in: omap_rng rng_core ipv6 + CPU: 0 PID: 9 Comm: migration/0 Not tainted 3.16.0-test-10959-gf0094b28f303-dirty #52 + [] (unwind_backtrace) from [] (show_stack+0x20/0x24) + [] (show_stack) from [] (dump_stack+0x78/0x94) + [] (dump_stack) from [] (warn_slowpath_common+0x7c/0x9c) + [] (warn_slowpath_common) from [] (warn_slowpath_null+0x2c/0x34) + [] (warn_slowpath_null) from [] (ftrace_bug+0x17c/0x1f4) + [] (ftrace_bug) from [] (ftrace_replace_code+0x80/0x9c) + [] (ftrace_replace_code) from [] (ftrace_modify_all_code+0xb8/0x164) + [] (ftrace_modify_all_code) from [] (__ftrace_modify_code+0x14/0x1c) + [] (__ftrace_modify_code) from [] (multi_cpu_stop+0xf4/0x134) + [] (multi_cpu_stop) from [] (cpu_stopper_thread+0x54/0x130) + [] (cpu_stopper_thread) from [] (smpboot_thread_fn+0x1ac/0x1bc) + [] (smpboot_thread_fn) from [] (kthread+0xe0/0xfc) + [] (kthread) from [] (ret_from_fork+0x14/0x20) + ---[ end trace dc9ce72c5b617d8f ]--- +[ 65.047264] ftrace failed to modify [] asm_do_IRQ+0x10/0x1c +[ 65.054070] actual: 85:1b:00:eb + +Fixes: 7413af1fb70e7 "ftrace: Make get_ftrace_addr() and get_ftrace_addr_old() global" +Signed-off-by: Steven Rostedt +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/trace/ftrace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/trace/ftrace.c ++++ b/kernel/trace/ftrace.c +@@ -1809,7 +1809,7 @@ __ftrace_replace_code(struct dyn_ftrace + return ftrace_make_call(rec, ftrace_addr); + + case FTRACE_UPDATE_MAKE_NOP: +- return ftrace_make_nop(NULL, rec, ftrace_addr); ++ return ftrace_make_nop(NULL, rec, ftrace_old_addr); + + case FTRACE_UPDATE_MODIFY_CALL: + return ftrace_modify_call(rec, ftrace_old_addr, ftrace_addr); diff --git a/queue-3.16/series b/queue-3.16/series index c86126fe65e..8cc18e41f0c 100644 --- a/queue-3.16/series +++ b/queue-3.16/series @@ -50,3 +50,4 @@ i2c-rcar-fix-mnr-interrupt-handling.patch i2c-rcar-fix-rcar_irq_ack_-recv-send.patch i2c-rk3x-fix-divisor-calculation-for-scl-frequency.patch i2c-ismt-use-correct-length-when-copy-buffer.patch +ftrace-use-current-addr-when-converting-to-nop-in-__ftrace_replace_code.patch