Messages in this thread | | | Date | Fri, 20 Feb 2009 18:30:35 +0100 | From | Ingo Molnar <> | Subject | Re: [PATCH 2/5] ftrace, x86: make kernel text writable only for conversions |
| |
* Steven Rostedt <rostedt@goodmis.org> wrote:
> diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h > index b55b4a7..5564cf3 100644 > --- a/arch/x86/include/asm/ftrace.h > +++ b/arch/x86/include/asm/ftrace.h > @@ -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__ */
The proper place for this is where the other pagetable attribute functions reside: arch/x86/include/asm/cacheflush.h.
> +/* 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.
> +/* 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
| |