]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
x86, paravirt: prevent gcc from generating the wrong addressing mode
authorJeremy Fitzhardinge <jeremy@goop.org>
Tue, 17 Mar 2009 00:24:34 +0000 (17:24 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 17 Mar 2009 01:36:31 +0000 (18:36 -0700)
Impact: fix crash on VMI (VMware)

When we generate a call sequence for calling a paravirtualized
function, we presume that the generated code is "call *0xXXXXX",
which is a 6 byte opcode; this is larger than a normal
direct call, and so we can patch a direct call over it.

At the moment, however we give gcc enough rope to hang us by
putting the address in a register and generating a two byte
indirect-via-register call.  Prevent this by explicitly
dereferencing the function pointer and passing it into the
asm as a constant.

This prevents crashes in VMI, as it cannot handle unpatchable
callsites.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Alok Kataria <akataria@vmware.com>
LKML-Reference: <49BEEDC2.2070809@goop.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/include/asm/paravirt.h

index e299287e8e3396d95b3169c5a9e9a1086e662a1a..0c212d528c0a489209a17c9961220488d76f9a29 100644 (file)
@@ -360,7 +360,7 @@ extern struct pv_lock_ops pv_lock_ops;
 
 #define paravirt_type(op)                              \
        [paravirt_typenum] "i" (PARAVIRT_PATCH(op)),    \
-       [paravirt_opptr] "m" (op)
+       [paravirt_opptr] "i" (&(op))
 #define paravirt_clobber(clobber)              \
        [paravirt_clobber] "i" (clobber)
 
@@ -412,7 +412,7 @@ int paravirt_disable_iospace(void);
  * offset into the paravirt_patch_template structure, and can therefore be
  * freely converted back into a structure offset.
  */
-#define PARAVIRT_CALL  "call *%[paravirt_opptr];"
+#define PARAVIRT_CALL  "call *%c[paravirt_opptr];"
 
 /*
  * These macros are intended to wrap calls through one of the paravirt