i386: Make patching more robust, fix paravirt issue
authorAndi Kleen <ak@suse.de>
Fri, 10 Aug 2007 20:31:03 +0000 (22:31 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 11 Aug 2007 22:58:13 +0000 (15:58 -0700)
commitab144f5ec64c42218a555ec1dbde6b60cf2982d6
treee3a4532e1db116e87060c9b18f4cfbf6258fdba3
parentd3f3c9346979bfa074c64eac5fc3ed5bba4f40ed
i386: Make patching more robust, fix paravirt issue

Commit 19d36ccdc34f5ed444f8a6af0cbfdb6790eb1177 "x86: Fix alternatives
and kprobes to remap write-protected kernel text" uses code which is
being patched for patching.

In particular, paravirt_ops does patching in two stages: first it
calls paravirt_ops.patch, then it fills any remaining instructions
with nop_out().  nop_out calls text_poke() which calls
lookup_address() which calls pgd_val() (aka paravirt_ops.pgd_val):
that call site is one of the places we patch.

If we always do patching as one single call to text_poke(), we only
need make sure we're not patching the memcpy in text_poke itself.
This means the prototype to paravirt_ops.patch needs to change, to
marshal the new code into a buffer rather than patching in place as it
does now.  It also means all patching goes through text_poke(), which
is known to be safe (apply_alternatives is also changed to make a
single patch).

AK: fix compilation on x86-64 (bad rusty!)
AK: fix boot on x86-64 (sigh)
AK: merged with other patches

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/i386/kernel/alternative.c
arch/i386/kernel/paravirt.c
arch/i386/kernel/vmi.c
arch/i386/xen/enlighten.c
drivers/lguest/lguest.c
include/asm-i386/paravirt.h