From: Jan Beulich Date: Wed, 26 Apr 2017 07:49:24 +0000 (+0200) Subject: x86emul: correct stub invocation constraints X-Git-Tag: 4.9.0-rc3~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cd91ab08ea;p=xen.git x86emul: correct stub invocation constraints Stub invocations need to have the space the stub occupies as an input, to prevent the compiler from re-ordering (or omitting) writes to it. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Release-acked-by: Julien Grall --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index c822221d8a..a695d5a49d 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -837,7 +837,8 @@ do{ asm volatile ( \ ".popsection\n\t" \ _ASM_EXTABLE(.Lret%=, .Lfix%=) \ : [exn] "+g" (res_), constraints, \ - [stub] "rm" (stub.func) ); \ + [stub] "rm" (stub.func), \ + "m" (*(uint8_t(*)[MAX_INST_LEN + 1])stub.ptr) ); \ if ( unlikely(~res_.raw) ) \ { \ gprintk(XENLOG_WARNING, \ @@ -853,7 +854,8 @@ do{ asm volatile ( \ #else # define invoke_stub(pre, post, constraints...) \ asm volatile ( pre "\n\tcall *%[stub]\n\t" post \ - : constraints, [stub] "rm" (stub.func) ) + : constraints, [stub] "rm" (stub.func), \ + "m" (*(uint8_t(*)[MAX_INST_LEN + 1])stub.buf) ) #endif #define emulate_stub(dst, src...) do { \