[git pull] changes for tip, and a nasty x86 page table bug

Steven Rostedt
2009-02-20T01:15:33Z

Ingo,

The list of changes are to keep the kernel text read only when
CONFIG_DEBUG_RODATA is set, even when the DYNAMIC_FTRACE is configured.
What it does now is to change the kernel text to writable before
modifying the mcount call points, and changes it back to read only
when it is finished.

In doing this change, I stumbled upon a nasty bug in the page handling
of the x86 code, where we can fall into a state where the PTE
has the RW bit set, but the PMD does not. This will cause an
infinite loop of faults. The reason is that the fault handler
detects "spurious faults" when it hits a page fault but the permissions
show it as correct. This test only checks the PTE pages and not the
PMD level. Thus it will return just to fault again.

The first two patches deals with this bug directly, the rest are
ftrace related. I'm thinking ftrace may be the only user to cause
this bug, but if it is not, then we might want to consider those
changes for 29. Otherwise, the changes to hit the bug are for 30
and you can wait on fixing this bug until then.

Please pull the latest tip/tracing/ftrace tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/ftrace

Steven Rostedt (6):
x86: check PMD in spurious_fault handler
x86: keep pmd rw bit set when creating 4K level pages
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

----
arch/x86/include/asm/ftrace.h | 10 ++++++++++
arch/x86/kernel/ftrace.c | 24 ++++++++++++++++++++++++
arch/x86/mm/fault.c | 13 ++++++++++++-
arch/x86/mm/init_32.c | 27 ++++++++++++++++++++++++---
arch/x86/mm/init_64.c | 29 ++++++++++++++++++++++++-----
arch/x86/mm/pageattr.c | 4 +++-
include/linux/ftrace.h | 3 +++
kernel/trace/ftrace.c | 34 +++++++++++++++++++++++++++++++++-
8 files changed, 133 insertions(+), 11 deletions(-)
--