lkml.org 
[lkml]   [2009]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] ftrace, x86: make kernel text writable only for conversions
On Thu, 19 Feb 2009 20:13:20 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> +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;
> +}

It would be prudent to avoid using system_state. People can change the
point at which it transitions and can unexpectedly insert (or move)
code to sites where system_state has new values, etc. It was a bad
idea.

It would be clearer and more robust to create your own little flag for
this purpose and set to it true and false at the places where that is
appropriate for this application. It's just one more byte...


\
 
 \ /
  Last update: 2009-02-20 02:35    [W:0.164 / U:1.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site