aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2009-03-16 20:24:34 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-03-16 21:36:31 -0400
commit42854dc0a6320ff36722749acafa0697522d9556 (patch)
treed85b34e78479e5b726cbe7f5632033dfc8b269a2 /arch
parent895791dac6946d535991edd11341046f8e85ea77 (diff)
x86, paravirt: prevent gcc from generating the wrong addressing mode
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/paravirt.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index e299287e8e33..0c212d528c0a 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -360,7 +360,7 @@ extern struct pv_lock_ops pv_lock_ops;
360 360
361#define paravirt_type(op) \ 361#define paravirt_type(op) \
362 [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \ 362 [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \
363 [paravirt_opptr] "m" (op) 363 [paravirt_opptr] "i" (&(op))
364#define paravirt_clobber(clobber) \ 364#define paravirt_clobber(clobber) \
365 [paravirt_clobber] "i" (clobber) 365 [paravirt_clobber] "i" (clobber)
366 366
@@ -412,7 +412,7 @@ int paravirt_disable_iospace(void);
412 * offset into the paravirt_patch_template structure, and can therefore be 412 * offset into the paravirt_patch_template structure, and can therefore be
413 * freely converted back into a structure offset. 413 * freely converted back into a structure offset.
414 */ 414 */
415#define PARAVIRT_CALL "call *%[paravirt_opptr];" 415#define PARAVIRT_CALL "call *%c[paravirt_opptr];"
416 416
417/* 417/*
418 * These macros are intended to wrap calls through one of the paravirt 418 * These macros are intended to wrap calls through one of the paravirt