lkml.org 
[lkml]   [2009]   [Feb]   [28]   [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 Fri, Feb 27, 2009 at 10:08:56PM +0100, Pavel Machek wrote:
    > On Sun 2009-02-22 18:50:00, Andi Kleen wrote:
    > > Steven Rostedt <rostedt@goodmis.org> writes:
    > >
    > > > From: Steven Rostedt <srostedt@redhat.com>
    > > >
    > > > 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.
    > >
    > > The very old text poke code I had for this just used a dynamic
    > > mapping elsewhere instead to modify the code. That's much less
    > > intrusive than changing the complete mappings. Any reason you can't use
    > > that too?
    >
    > Is it legal to have two mappings of same page with different
    > attributes? IIRC some processors did not like that...

    If you mean PAT caching attributes: correct it is not legal in x86 and
    causes problems including data corruption.
    If you mean other attributes like large page vs small page: it's normally legal,
    with a few exceptions.

    -Andi

    --
    ak@linux.intel.com -- Speaking for myself only.


    \
     
     \ /
      Last update: 2009-02-28 17:41    [W:5.150 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site