powerpc: ftrace: bugfix for test_24bit_addr
PATCH 1/1 powerpc: ftrace: bugfix for test_24bit_addr
The branch target should be the func addr, not the addr of func_descr_t. So using ppc_function_entry() to generate the right target addr.
---
This bug will make ftrace fail to work. It can be triggered when the kernel size grows up.
--- arch/powerpc/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/ftrace.c +1 -0
@@ -74,6 +74,7 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)*/ static int test_24bit_addr (unsigned long ip,unsigned long addr) { + addr =ppc_function_entry ((void *)addr);/* use the create_branch to verify that this offset can be branched */ return create_branch ((unsigned int *)ip, addr,0 );
Signature · 1 line
1.8.1.4
Quoted 16 lines · Liu Ping Fan
The branch target should be the func addr, not the addr of
func_descr_t. So usingppc_function_entry()to generate the right target addr.Signed-off-by Liu Ping Fan <[email protected]>---
This bug will make ftrace fail to work. It can be triggered when the kernel size grows up.--- arch/powerpc/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)arch/powerpc/kernel/ftrace.c +0
-0
arch/powerpc/kernel/ftrace.c ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new) · line 77
Quoted 4 lines
arch/powerpc/kernel/ftrace.c +1
-0@@ -74,6 +74,7 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)*/ static int test_24bit_addr (unsigned long ip,unsigned long addr) { + addr =ppc_function_entry ((void *)addr);
Won't this break on LE?
Quoted 12 lines · Ananth N Mavinakayanahalli
Quoted 11 lines · Liu Ping Fan
The branch target should be the func addr, not the addr of
func_descr_t. So usingppc_function_entry()to generate the right target addr.Signed-off-by Liu Ping Fan <[email protected]>---
This bug will make ftrace fail to work. It can be triggered when the kernel size grows up.--- arch/powerpc/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
arch/powerpc/kernel/ftrace.c ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new) · line 77
Quoted 9 lines
arch/powerpc/kernel/ftrace.c +1
-0@@ -74,6 +74,7 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)*/ static int test_24bit_addr (unsigned long ip,unsigned long addr) { + addr =ppc_function_entry ((void *)addr);Won't this break on LE?
How? I can not figure out it. Anyway, ppc_function_entry() is already used in other places with LE.
Thx,
Fan
Michael Ellerman
reviewerQuoted 12 lines · Ananth N Mavinakayanahalli
Quoted 11 lines · Liu Ping Fan
The branch target should be the func addr, not the addr of
func_descr_t. So usingppc_function_entry()to generate the right target addr.Signed-off-by Liu Ping Fan <[email protected]>---
This bug will make ftrace fail to work. It can be triggered when the kernel size grows up.--- arch/powerpc/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+)
Quoted 11 lines
arch/powerpc/kernel/ftrace.c ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new) · line 77
Quoted 9 lines
arch/powerpc/kernel/ftrace.c +1
-0@@ -74,6 +74,7 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)*/ static int test_24bit_addr (unsigned long ip,unsigned long addr) { + addr =ppc_function_entry ((void *)addr);Won't this break on LE?
ppc_function_entry() just needs to be a nop on LE, as it already is on 32-bit.
cheers
Quoted 1 line · Michael Ellerman
ppc_function_entry()just needs to be a nop on LE, as it already is on 32-bit.
Well on LE ABI2, but yes.
Yours Tony