xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>
Subject: Re: [PATCH] x86emul: correct stub invocation constraints
Date: Wed, 26 Apr 2017 10:01:25 -0400	[thread overview]
Message-ID: <7e4b5e1c-5950-c832-c994-43ece1e54d73@oracle.com> (raw)
In-Reply-To: <58FF2D540200007800153D5E@prv-mh.provo.novell.com>

On 04/25/2017 05:04 AM, Jan Beulich wrote:
> 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 <jbeulich@suse.com>
>
> --- 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 {                                  \
>


This breaks on old compilers:

FC-64
<build@build-mk2:~/xtt-x86_64/bootstrap/xen.git/tools/fuzz/x86_instruction_emulator>
gcc --version
gcc (GCC) 4.4.4 20100503 (Red Hat 4.4.4-2)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

FC-64
<build@build-mk2:~/xtt-x86_64/bootstrap/xen.git/tools/fuzz/x86_instruction_emulator>
pwd
/home/build/xtt-x86_64/bootstrap/xen.git/tools/fuzz/x86_instruction_emulator
FC-64
<build@build-mk2:~/xtt-x86_64/bootstrap/xen.git/tools/fuzz/x86_instruction_emulator>
gcc  -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement
-Wno-unused-but-set-variable   -g3 -O0 -fno-omit-frame-pointer
-D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -MMD -MF
.x86_emulate.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  
-I/home/build/xtt-x86_64/bootstrap/xen.git/tools/fuzz/x86_instruction_emulator/../../../tools/include
-D__XEN_TOOLS__ -I.  -c -o x86_emulate.o x86_emulate.c
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c: In function ‘x86_emulate’:
x86_emulate/x86_emulate.c:4085: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4161: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4226: error: memory input 5 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4229: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4279: error: memory input 5 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4288: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4353: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4402: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4465: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4516: error: memory input 5 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:4522: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:5632: error: memory input 5 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:5679: error: memory input 8 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:5863: error: memory input 3 is not directly
addressable
x86_emulate/x86_emulate.c:6069: error: memory input 4 is not directly
addressable
x86_emulate/x86_emulate.c:6213: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7029: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7178: error: memory input 6 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7328: error: memory input 7 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7362: error: memory input 6 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7482: error: memory input 3 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7603: error: memory input 9 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7607: error: memory input 9 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7676: error: memory input 6 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7715: error: memory input 6 is not directly
addressable
In file included from x86_emulate.c:157:
x86_emulate/x86_emulate.c:7795: error: memory input 4 is not directly
addressable
x86_emulate/x86_emulate.c:7798: error: memory input 3 is not directly
addressable
FC-64
<build@build-mk2:~/xtt-x86_64/bootstrap/xen.git/tools/fuzz/x86_instruction_emulator>



-boris

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-04-26 14:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  9:04 [PATCH] x86emul: correct stub invocation constraints Jan Beulich
2017-04-25 15:00 ` Andrew Cooper
2017-04-25 16:48   ` Julien Grall
2017-04-26 14:01 ` Boris Ostrovsky [this message]
2017-04-26 14:19   ` Jan Beulich
2017-04-26 14:29     ` Boris Ostrovsky
2017-04-27  8:07   ` Jan Beulich
2017-04-27  8:30     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e4b5e1c-5950-c832-c994-43ece1e54d73@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).