Re: [PATCH 4/6] ftrace, x86: make kernel text writable only forconversions

From: Steven Rostedt
Date: Sun Feb 22 2009 - 17:53:21 EST





On Sun, 22 Feb 2009, Andi Kleen wrote:

> Steven Rostedt <rostedt@xxxxxxxxxxx> writes:
>
> > From: Steven Rostedt <srostedt@xxxxxxxxxx>
> >
> > 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?
>

We are changing over 19000 locations in the kernel. This touches almost
all kernel text pages anyway. You want to map a page in and out for over
19000 locations?

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/