x86: Fix fixmap page order for FIX_TEXT_POKE0,1
commitc242f9dd84db9159fd64b9d254660eabd90503b0
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 1 Jul 2009 21:37:22 +0000 (1 17:37 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 30 Jul 2009 21:39:42 +0000 (30 14:39 -0700)
tree1adf0ff3b2fba65bdf0ee33367f6a007d5ea4079
parent7a8f2ee411cc5ab729466f574da09ea8d74d709d
x86: Fix fixmap page order for FIX_TEXT_POKE0,1

commit 12b9d7ccb841805e347fec8f733f368f43ddba40 upstream.

Masami reported:

> Since the fixmap pages are assigned higher address to lower,
> text_poke() has to use it with inverted order (FIX_TEXT_POKE1
> to FIX_TEXT_POKE0).

I prefer to just invert the order of the fixmap declaration.
It's simpler and more straightforward.

Backward fixmaps seems to be used by both x86 32 and 64.

It's really rare but a nasty bug, because it only hurts when
instructions to patch are crossing a page boundary. If this
happens, the fixmap write accesses will spill on the following
fixmap, which may very well crash the system. And this does not
crash the system, it could leave illegal instructions in place.
Thanks Masami for finding this.

It seems to have crept into the 2.6.30-rc series, so this calls
for a -stable inclusion.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
LKML-Reference: <20090701213722.GH19926@Krystal>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/include/asm/fixmap.h