updates for tip
Steven Rostedt
maintainerIngo,
This is based off of your tip/x86/urgent branch.
Please pull the latest tip/x86/ftrace tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/x86/ftrace
Steven Rostedt (5):
ftrace: allow archs to preform pre and post process for code modification ftrace, x86: make kernel text writable only for conversions
ftrace: immediately stop code modification if failure is detected
ftrace: break out modify loop immediately on detection of error ftrace, x86: do not depend on system state for kernel text info
----
arch/x86/include/asm/ftrace.h | 10 ++++++++++ arch/x86/kernel/ftrace.c | 16 ++++++++++++++++ arch/x86/mm/init_32.c | 37 ++++++++++++++++++++++++++++++++++--- arch/x86/mm/init_64.c | 39 ++++++++++++++++++++++++++++++++++----- include/linux/ftrace.h | 3 +++ kernel/trace/ftrace.c | 34 +++++++++++++++++++++++++++++++++- 6 files changed, 130 insertions(+), 9 deletions(-)
Steven Rostedt
maintainerPATCH 1/5 ftrace: allow archs to preform pre and post process for code modification
From: Steven Rostedt <[email protected]>
This patch creates the weak functions: ftrace_arch_modify_prepare and ftrace_arch_modify_post_process that are called before and after the stop machine is called to modify the kernel text.
If the arch needs to do pre or post processing, it only needs to define these functions.
--- include/linux/ftrace.h | 3 +++ kernel/trace/ftrace.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-)
include/linux/ftrace.h +3 -0
@@ -99,6 +99,9 @@ stack_trace_sysctl(struct ctl_table *table, int write,/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ #include <asm/ftrace.h> +int ftrace_arch_modify_prepare (void ); +int ftrace_arch_modify_post_process (void ); +enum {FTRACE_FL_FREE = (1 <<0 ),FTRACE_FL_FAILED = (1 <<1 ),
kernel/trace/ftrace.c +28 -0
@@ -585,6 +585,24 @@ ftrace_code_disable(struct module *mod, struct dyn_ftrace *rec)return 1 ; } +/* +* archs can override this function if they must do something +* before the modifying code is performed. +*/ +int __weak ftrace_arch_modify_prepare (void ) +{ +return 0 ; +} + +/* +* archs can override this function if they must do something +* after the modifying code is performed. +*/ +int __weak ftrace_arch_modify_post_process (void ) +{ +return 0 ; +} +static int __ftrace_modify_code (void *data) {int *command = data;
@@ -607,7 +625,17 @@ static int __ftrace_modify_code(void *data)static void ftrace_run_update_code (int command) { +int ret; + + ret =ftrace_arch_modify_prepare (); +FTRACE_WARN_ON (ret); +if (ret) +return ; +stop_machine (__ftrace_modify_code, &command,NULL ); + + ret =ftrace_arch_modify_post_process (); +FTRACE_WARN_ON (ret); }static ftrace_func_t saved_ftrace_func;
Signature · 3 lines
1.5.6.5 --
Re: [PATCH 1/5] ftrace: allow archs to preform pre and post process for code modification
include/linux/ftrace.h stack_trace_sysctl(struct ctl_table *table, int write, · line 103
Quoted 2 lines · Steven Rostedt
include/linux/ftrace.h +2
-0+int ftrace_arch_modify_prepare (void ); +int ftrace_arch_modify_post_process (void );
i think it would be clearer to name it:
extern int ftrace_arch_code_modify_prepare(void);
extern int ftrace_arch_code_modify_finish(void);
?
Ingo
Steven Rostedt
maintainerRe: [PATCH 1/5] ftrace: allow archs to preform pre and post process for code modification
Quoted 8 lines · Ingo Molnar
include/linux/ftrace.h stack_trace_sysctl(struct ctl_table *table, int write, · line 103
Quoted 2 lines · Steven Rostedt
include/linux/ftrace.h +2
-0+int ftrace_arch_modify_prepare (void ); +int ftrace_arch_modify_post_process (void );i think it would be clearer to name it:
Quoted 4 lines
extern int
ftrace_arch_code_modify_prepare(void);
extern intftrace_arch_code_modify_finish(void);?
Sure, I'll write up a patch.
-- Steve
Steven Rostedt
maintainerPATCH 2/5 ftrace, x86: make kernel text writable only for conversions
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: keep kernel text read only
Because dynamic ftrace converts the calls to mcount into and out of nops at run time, we needed to always keep the kernel text writable.
But this defeats the point of CONFIG_DEBUG_RODATA. This patch converts the kernel code to writable before ftrace modifies the text, and converts it back to read only afterward.
The conversion is done via stop_machine and no IPIs may be executed at that time. The kernel text is set to write just before calling stop_machine and set to read only again right afterward.
--- arch/x86/include/asm/ftrace.h | 10 ++++++++++ arch/x86/kernel/ftrace.c | 20 ++++++++++++++++++++ arch/x86/mm/init_32.c | 27 ++++++++++++++++++++++++--- arch/x86/mm/init_64.c | 29 ++++++++++++++++++++++++----- 4 files changed, 78 insertions(+), 8 deletions(-)
arch/x86/include/asm/ftrace.h +10 -0
@@ -80,4 +80,14 @@ extern void return_to_handler(void);#endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ +#ifndef __ASSEMBLY__ +#ifdef CONFIG_DEBUG_RODATA +void set_kernel_text_rw (void ); +void set_kernel_text_ro (void ); +#else +static inline void set_kernel_text_rw (void ) { } +static inline void set_kernel_text_ro (void ) { } +#endif +#endif /* __ASSEMBLY__ */ +#endif /* _ASM_X86_FTRACE_H */
arch/x86/kernel/ftrace.c +20 -0
@@ -26,6 +26,26 @@ #ifdef CONFIG_DYNAMIC_FTRACE +int ftrace_arch_modify_prepare(void) +{ + /* at boot up, we are still writable */ + if (system_state != SYSTEM_RUNNING) + return 0; + + set_kernel_text_rw(); + return 0; +} + +int ftrace_arch_modify_post_process(void) +{ + /* at boot up, we are still writable */ + if (system_state != SYSTEM_RUNNING) + return 0; + + set_kernel_text_ro(); + return 0; +} + union ftrace_code_union { char code[MCOUNT_INSN_SIZE]; struct {
arch/x86/mm/init_32.c +24 -3
@@ -1155,13 +1155,35 @@ static noinline int do_test_wp_bit(void)const int rodata_test_data =0xC3 ;EXPORT_SYMBOL_GPL (rodata_test_data); +/* used by ftrace */ +void set_kernel_text_rw (void ) +{ +unsigned long start =PFN_ALIGN (_text); +unsigned long size =PFN_ALIGN (_etext) - start; + +printk (KERN_INFO "Set kernel text: %lx - %lx for read write\n" , + start, start+size); + +set_pages_rw (virt_to_page (start), size >>PAGE_SHIFT ); +} + +/* used by ftrace */ +void set_kernel_text_ro (void ) +{ +unsigned long start =PFN_ALIGN (_text); +unsigned long size =PFN_ALIGN (_etext) - start; + +printk (KERN_INFO "Set kernel text: %lx - %lx for read only\n" , + start, start+size); + +set_pages_ro (virt_to_page (start), size >>PAGE_SHIFT ); +} +void mark_rodata_ro (void ) {unsigned long start =PFN_ALIGN (_text);unsigned long size =PFN_ALIGN (_etext) - start; -#ifndef CONFIG_DYNAMIC_FTRACE -/* Dynamic tracing modifies the kernel text section */ set_pages_ro (virt_to_page (start), size >>PAGE_SHIFT );printk (KERN_INFO "Write protecting the kernel text: %luk\n" , size >>10 );
@@ -1174,7 +1196,6 @@ void mark_rodata_ro(void)printk (KERN_INFO "Testing CPA: write protecting again\n" );set_pages_ro (virt_to_page (start), size>>PAGE_SHIFT );#endif -#endif /* CONFIG_DYNAMIC_FTRACE */ start += size; size = (unsigned long )__end_rodata - start;
arch/x86/mm/init_64.c +24 -5
@@ -986,17 +986,36 @@ void free_initmem(void)const int rodata_test_data =0xC3 ;EXPORT_SYMBOL_GPL (rodata_test_data); +/* used by ftrace */ +void set_kernel_text_rw (void ) +{ +unsigned long start =PFN_ALIGN (_stext); +unsigned long end =PFN_ALIGN (__start_rodata); + +printk (KERN_INFO "Set kernel text: %lx - %lx for read write\n" , + start, end); + +set_memory_rw (start, (end - start) >>PAGE_SHIFT ); +} + +/* used by ftrace */ +void set_kernel_text_ro (void ) +{ +unsigned long start =PFN_ALIGN (_stext); +unsigned long end =PFN_ALIGN (__start_rodata); + +printk (KERN_INFO "Set kernel text: %lx - %lx for read only\n" , + start, end); + +set_memory_ro (start, (end - start) >>PAGE_SHIFT ); +} +void mark_rodata_ro (void ) {unsigned long start =PFN_ALIGN (_stext), end =PFN_ALIGN (__end_rodata);unsigned long rodata_start = ((unsigned long )__start_rodata +PAGE_SIZE -1 ) &PAGE_MASK ; -#ifdef CONFIG_DYNAMIC_FTRACE -/* Dynamic tracing modifies the kernel text section */ - start = rodata_start; -#endif -printk (KERN_INFO "Write protecting the kernel read-only data: %luk\n" , (end - start) >>10 );set_memory_ro (start, (end - start) >>PAGE_SHIFT );
Signature · 3 lines
1.5.6.5 --
Re: [PATCH 2/5] ftrace, x86: make kernel text writable only for conversions
Quoted 7 lines · Steven Rostedt
arch/x86/include/asm/ftrace.h +0
-0@@ -80,4 +80,14 @@ extern void return_to_handler(void);#endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
arch/x86/include/asm/ftrace.h extern void return_to_handler(void); · line 91
Quoted 10 lines
arch/x86/include/asm/ftrace.h +9
-0+#ifndef __ASSEMBLY__ +#ifdef CONFIG_DEBUG_RODATA +void set_kernel_text_rw (void ); +void set_kernel_text_ro (void ); +#else +static inline void set_kernel_text_rw (void ) { } +static inline void set_kernel_text_ro (void ) { } +#endif +#endif /* __ASSEMBLY__ */
The proper place for this is where the other pagetable attribute functions reside: arch/x86/include/asm/cacheflush.h.
arch/x86/include/asm/ftrace.h extern void return_to_handler(void);
Quoted 10 lines
arch/x86/include/asm/ftrace.h +10
-0+/* used by ftrace */ +void set_kernel_text_rw (void ) +{ +unsigned long start =PFN_ALIGN (_text); +unsigned long size =PFN_ALIGN (_etext) - start; + +printk (KERN_INFO "Set kernel text: %lx - %lx for read write\n" , + start, start+size); + +set_pages_rw (virt_to_page (start), size >>PAGE_SHIFT );
Wont this be executed by every suspend/resume cycle? I'm not sure we want a KERN_INFO printout every time.
arch/x86/include/asm/ftrace.h
Quoted 2 lines
arch/x86/include/asm/ftrace.h +2
-0+/* used by ftrace */ +void set_kernel_text_rw (void )
i'd leave out the 'used by ftrace' bit - more uses might arise. How does kprobes get around readonly pages, it uses these APIs too, right?
Ingo
Steven Rostedt
maintainerRe: [PATCH 2/5] ftrace, x86: make kernel text writable only for conversions
Quoted 11 lines · Ingo Molnar
Quoted 8 lines · Steven Rostedt
arch/x86/include/asm/ftrace.h +0
-0@@ -80,4 +80,14 @@ extern void return_to_handler(void);#endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
Quoted 12 lines
arch/x86/include/asm/ftrace.h extern void return_to_handler(void); · line 91
Quoted 9 lines
arch/x86/include/asm/ftrace.h +9
-0+#ifndef __ASSEMBLY__ +#ifdef CONFIG_DEBUG_RODATA +void set_kernel_text_rw (void ); +void set_kernel_text_ro (void ); +#else +static inline void set_kernel_text_rw (void ) { } +static inline void set_kernel_text_ro (void ) { } +#endif +#endif /* __ASSEMBLY__ */ The proper place for this is where the other pagetable attribute functions reside:
arch/x86/include/asm/cacheflush.h.
Heh, I put it there because I was not sure where the proper place should go. I figured someone would comment and tell me where to put it ;-)
Quoted 14 lines
arch/x86/include/asm/ftrace.h extern void return_to_handler(void);
Quoted 11 lines
arch/x86/include/asm/ftrace.h +10
-0+/* used by ftrace */ +void set_kernel_text_rw (void ) +{ +unsigned long start =PFN_ALIGN (_text); +unsigned long size =PFN_ALIGN (_etext) - start; + +printk (KERN_INFO "Set kernel text: %lx - %lx for read write\n" , + start, start+size); + +set_pages_rw (virt_to_page (start), size >>PAGE_SHIFT );Wont this be executed by every suspend/resume cycle? I'm not sure we want a
KERN_INFOprintout every time.
Yeah, agreed. My original thought was to allow a sysadmin to know when something was changing the kernel text to read/write. But it does fill up the logs quite a bit. I'll switch it to a pr_debug.
Quoted 7 lines
arch/x86/include/asm/ftrace.h
Quoted 3 lines
arch/x86/include/asm/ftrace.h +2
-0+/* used by ftrace */ +void set_kernel_text_rw (void )i'd leave out the 'used by ftrace' bit - more uses might arise. How does kprobes get around readonly pages, it uses these APIs too, right?
kprobes uses text_poke. text_poke uses vmap to create its own page table pointers to the text memory, does the modification and then removes the pointers. This is quite heavy weight and since ftrace needs to modify 10s of thousands of areas, converting all of kernel text page tables is much more efficient.
Note, if kprobes did change the original page tables, then it too would have hit the split_large_page bug too.
-- Steve
Re: [PATCH 2/5] ftrace, x86: make kernel text writable only for conversions
Quoted 14 lines · Steven Rostedt
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+/* used by ftrace */ +void set_kernel_text_rw(void)i'd leave out the 'used by ftrace' bit - more uses might arise. How does kprobes get around readonly pages, it uses these APIs too, right?
kprobes uses
text_poke.text_pokeuses vmap to create its own page table pointers to the text memory, does the modification and then removes the pointers. This is quite heavy weight and since ftrace needs to modify 10s of thousands of areas, converting all of kernel text page tables is much more efficient.
Quoted 2 lines
Note, if kprobes did change the original page tables, then it too would have hit the
split_large_pagebug too.
i think the real reason is that kprobes was written before we had this more flexible and more usable CPA code.
Ingo
Steven Rostedt
maintainerRe: [PATCH 2/5] ftrace, x86: make kernel text writable only for conversions
Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Steven Rostedt
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+/* used by ftrace */ +void set_kernel_text_rw(void)i'd leave out the 'used by ftrace' bit - more uses might arise. How does kprobes get around readonly pages, it uses these APIs too, right?
kprobes uses
text_poke.text_pokeuses vmap to create its own page table pointers to the text memory, does the modification and then removes the pointers. This is quite heavy weight and since ftrace needs to modify 10s of thousands of areas, converting all of kernel text page tables is much more efficient.
Quoted 5 lines
Quoted 2 lines
Note, if kprobes did change the original page tables, then it too would have hit the
split_large_pagebug too.i think the real reason is that kprobes was written before we had this more flexible and more usable CPA code.
I'm not saying that was the reason kprobes did it that way. I was just answering your question about how kprobes does it today ;-)
Perhaps it may be more efficient to convert kprobes to use the set_memory_rw/ro API now.
-- Steve
Steven Rostedt
maintainerPATCH 3/5 ftrace: immediately stop code modification if failure is detected
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: fix to prevent NMI lockup
If the page fault handler produces a WARN_ON in the modifying of text, and the system is setup to have a high frequency of NMIs, we can lock up the system on a failure to modify code.
The modifying of code with NMIs allows all NMIs to modify the code if it is about to run. This prevents a modifier on one CPU from modifying code running in NMI context on another CPU. The modifying is done through stop_machine, so only NMIs must be considered.
But if the write causes the page fault handler to produce a warning, the print can slow it down enough that as soon as it is done it will take another NMI before going back to the process context. The new NMI will perform the write again causing another print and this will hang the box.
This patch turns off the writing as soon as a failure is detected and does not wait for it to be turned off by the process context. This will keep NMIs from getting stuck in this back and forth of print outs.
--- arch/x86/kernel/ftrace.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/kernel/ftrace.c +4 -0
@@ -131,6 +131,10 @@ static void ftrace_mod_code(void)*/ mod_code_status =probe_kernel_write (mod_code_ip, mod_code_newcode,MCOUNT_INSN_SIZE ); + +/* if we fail, then kill any new writers */ +if (mod_code_status) + mod_code_write =0 ; }void ftrace_nmi_enter (void )
Signature · 3 lines
1.5.6.5 --
Steven Rostedt
maintainerPATCH 4/5 ftrace: break out modify loop immediately on detection of error
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Impact: added precaution on failure detection
Break out of the modifying loop as soon as a failure is detected. This is just an added precaution found by code review and was not found by any bug chasing.
--- kernel/trace/ftrace.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +5 -1
@@ -561,11 +561,15 @@ static void ftrace_replace_code(int enable)if ((system_state ==SYSTEM_BOOTING ) || !core_kernel_text (rec->ip)) {ftrace_free_rec (rec); - }else + }else {ftrace_bug (failed, rec->ip); + goto out; + } } } } + out: +return ; } static int
Signature · 3 lines
1.5.6.5 --
Re: [PATCH 4/5] ftrace: break out modify loop immediately on detection of error
Quoted 6 lines · Steven Rostedt
kernel/trace/ftrace.c +0
-0@@ -561,11 +561,15 @@ static void ftrace_replace_code(int enable)if ((system_state ==SYSTEM_BOOTING ) || !core_kernel_text (rec->ip)) {ftrace_free_rec (rec);
kernel/trace/ftrace.c static void ftrace_replace_code(int enable) · line 572
Quoted 10 lines
kernel/trace/ftrace.c +5
-1- }else + }else {ftrace_bug (failed, rec->ip); + goto out; + } } } } + out: +return ;
wouldnt a simple 'break' suffice? Hm, nope,do_for_each_ftrace_rec() is a double loop.
Then perhaps a 'return' would perhaps be cleaner in this case. (even though it does make the flow a bit assymetric - the out label and the empty return looks a bit ugly.)
Ingo
Steven Rostedt
maintainerRe: [PATCH 4/5] ftrace: break out modify loop immediately on detection of error
Quoted 23 lines · Ingo Molnar
Quoted 6 lines · Steven Rostedt
kernel/trace/ftrace.c +0
-0@@ -561,11 +561,15 @@ static void ftrace_replace_code(int enable)if ((system_state ==SYSTEM_BOOTING ) || !core_kernel_text (rec->ip)) {ftrace_free_rec (rec);kernel/trace/ftrace.c static void ftrace_replace_code(int enable) · line 572
Quoted 10 lines
kernel/trace/ftrace.c +5
-1- }else + }else {ftrace_bug (failed, rec->ip); + goto out; + } } } } + out: +return ;wouldnt a simple 'break' suffice? Hm, nope,
do_for_each_ftrace_rec()is a double loop.
Quoted 3 lines
Then perhaps a 'return' would perhaps be cleaner in this case. (even though it does make the flow a bit assymetric - the out label and the empty return looks a bit ugly.)
I guess a return would work too. I did the out jump to annotate the escape a bit more. Both are ugly IMHO. I'll switch it to return in the else statement.
-- Steve
Steven Rostedt
maintainerPATCH 5/5 ftrace, x86: do not depend on system state for kernel text info
In reply to Steven RostedtFrom: Steven Rostedt <[email protected]>
Andrew Morton pointed out that using SYSTEM_STATE is a bad idea since there is no guarantee to what its state will actually be.
Instead, I moved the check into the set_kernel_text_* functions themselves, and use a local variable to determine when it is OK to change the kernel text RW permissions.
--- arch/x86/kernel/ftrace.c | 8 -------- arch/x86/mm/init_32.c | 10 ++++++++++ arch/x86/mm/init_64.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-)
arch/x86/kernel/ftrace.c +0 -8
@@ -28,20 +28,12 @@int ftrace_arch_modify_prepare (void ) { -/* at boot up, we are still writable */ -if (system_state !=SYSTEM_RUNNING ) -return 0 ; -set_kernel_text_rw ();return 0 ; }int ftrace_arch_modify_post_process (void ) { -/* at boot up, we are still writable */ -if (system_state !=SYSTEM_RUNNING ) -return 0 ; -set_kernel_text_ro ();return 0 ; }
arch/x86/mm/init_32.c +10 -0
@@ -1155,12 +1155,17 @@ static noinline int do_test_wp_bit(void)const int rodata_test_data =0xC3 ;EXPORT_SYMBOL_GPL (rodata_test_data); +static int kernel_set_to_readonly; +/* used by ftrace */ void set_kernel_text_rw (void ) {unsigned long start =PFN_ALIGN (_text);unsigned long size =PFN_ALIGN (_etext) - start; +if (!kernel_set_to_readonly) +return ; +printk (KERN_INFO "Set kernel text: %lx - %lx for read write\n" , start, start+size);
@@ -1173,6 +1178,9 @@ void set_kernel_text_ro(void)unsigned long start =PFN_ALIGN (_text);unsigned long size =PFN_ALIGN (_etext) - start; +if (!kernel_set_to_readonly) +return ; +printk (KERN_INFO "Set kernel text: %lx - %lx for read only\n" , start, start+size);
@@ -1188,6 +1196,8 @@ void mark_rodata_ro(void)printk (KERN_INFO "Write protecting the kernel text: %luk\n" , size >>10 ); + kernel_set_to_readonly =1 ; +#ifdef CONFIG_CPA_DEBUG printk (KERN_INFO "Testing CPA: Reverting %lx-%lx\n" , start, start+size);
arch/x86/mm/init_64.c +10 -0
@@ -986,12 +986,17 @@ void free_initmem(void)const int rodata_test_data =0xC3 ;EXPORT_SYMBOL_GPL (rodata_test_data); +static int kernel_set_to_readonly; +/* used by ftrace */ void set_kernel_text_rw (void ) {unsigned long start =PFN_ALIGN (_stext);unsigned long end =PFN_ALIGN (__start_rodata); +if (!kernel_set_to_readonly) +return ; +printk (KERN_INFO "Set kernel text: %lx - %lx for read write\n" , start, end);
@@ -1004,6 +1009,9 @@ void set_kernel_text_ro(void)unsigned long start =PFN_ALIGN (_stext);unsigned long end =PFN_ALIGN (__start_rodata); +if (!kernel_set_to_readonly) +return ; +printk (KERN_INFO "Set kernel text: %lx - %lx for read only\n" , start, end);
@@ -1020,6 +1028,8 @@ void mark_rodata_ro(void) (end - start) >> 10);set_memory_ro (start, (end - start) >>PAGE_SHIFT ); + kernel_set_to_readonly =1 ; +/* * The rodata section (but not the kernel text!) should also be * not-executable.
Signature · 3 lines
1.5.6.5 --
Re: [PATCH 5/5] ftrace, x86: do not depend on system state for kernel text info
Quoted 22 lines · Steven Rostedt
From: Steven Rostedt <[email protected]>
Andrew Morton pointed out that using
SYSTEM_STATEis a bad idea since there is no guarantee to what its state will actually be.Instead, I moved the check into the set_kernel_text_* functions themselves, and use a local variable to determine when it is OK to change the kernel text RW permissions.
Reported-by Andrew Morton <[email protected]>Signed-off-by Steven Rostedt <[email protected]>--- arch/x86/kernel/ftrace.c | 8 -------- arch/x86/mm/init_32.c | 10 ++++++++++ arch/x86/mm/init_64.c | 10 ++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-)arch/x86/kernel/ftrace.c +0
-0
arch/x86/kernel/ftrace.c line 34
Quoted 7 lines
arch/x86/kernel/ftrace.c +0
-4@@ -28,20 +28,12 @@int ftrace_arch_modify_prepare (void ) { -/* at boot up, we are still writable */ -if (system_state !=SYSTEM_RUNNING ) -return 0 ; -
Since i suspect you'll rebase anyway, i'd suggest to squash this patch into patch #2, with credit to Andrew added.
Ingo
Steven Rostedt
maintainerRe: [PATCH 5/5] ftrace, x86: do not depend on system state for kernel text info
Quoted 3 lines · Ingo Molnar
Since i suspect you'll rebase anyway, i'd suggest to squash this patch into patch #2, with credit to Andrew added.
Yeah, there's enough things to fix to warrant a rebase.
Thanks,
-- Steve