ftrace/x86: Call text_ip_addr() instead of the duplicated code
PATCH 1/1 ftrace/x86: Call text_ip_addr() instead of the duplicated code
I just went over this when looking at some Xen-related ftrace initialization problems. They were related to Xen code that is not upstream but this clean up would make sense here.
I think that this was already the intention when text_ip_addr() was introduced in the commit 87fbb2ac6073a703930 (ftrace/x86: Use breakpoints for converting function graph caller). Anyway, better do it now before it shots people into their leg ;-)
--- arch/x86/kernel/ftrace.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
arch/x86/kernel/ftrace.c +1 -10
@@ -297,16 +297,7 @@ int ftrace_int3_handler(struct pt_regs *regs)static int ftrace_write (unsigned long ip,const char *val,int size) { -/* -* On x86_64, kernel text mappings are mapped read-only with -* CONFIG_DEBUG_RODATA. So we use the kernel identity mapping instead -* of the kernel text mapping to modify the kernel text. -* -* For 32bit kernels, these mappings are same and we can use -* kernel identity mapping to modify code. -*/ -if (within (ip, (unsigned long )_text, (unsigned long )_etext)) - ip = (unsigned long )__va (__pa_symbol (ip)); + ip =text_ip_addr (ip);if (probe_kernel_write ((void *)ip, val, size))return -EPERM ;
Signature · 1 line
1.8.4
Steven Rostedt
maintainerQuoted 8 lines · On Tue, 3 Jun 2014 18:23:21 +0200 Petr Mladek <[email protected]> wrote:
I just went over this when looking at some Xen-related ftrace initialization problems. They were related to Xen code that is not upstream but this clean up would make sense here.
I think that this was already the intention when
text_ip_addr()was introduced in the commit87fbb2ac6073a703930(ftrace/x86: Use breakpoints for converting function graph caller). Anyway, better do it now before it shots people into their leg ;-)
You know, I made this change. It somehow got lost :-/
I better analyze this a bit to make sure it was just lost and I didn't find some odd ball reason not to apply it. But I doubt I'll find anything. If not, I'll get it enqueued for 3.16.
Thanks!
-- Steve
Quoted 28 lines
Signed-off-by Petr Mladek <[email protected]>--- arch/x86/kernel/ftrace.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)arch/x86/kernel/ftrace.c +1
-10@@ -297,16 +297,7 @@ int ftrace_int3_handler(struct pt_regs *regs)static int ftrace_write (unsigned long ip,const char *val,int size) { -/* -* On x86_64, kernel text mappings are mapped read-only with -* CONFIG_DEBUG_RODATA. So we use the kernel identity mapping instead -* of the kernel text mapping to modify the kernel text. -* -* For 32bit kernels, these mappings are same and we can use -* kernel identity mapping to modify code. -*/ -if (within (ip, (unsigned long )_text, (unsigned long )_etext)) - ip = (unsigned long )__va (__pa_symbol (ip)); + ip =text_ip_addr (ip);if (probe_kernel_write ((void *)ip, val, size))return -EPERM ;