From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [PATCH] KVM: X86: Fix the decoding of segment overrides in 64bit mode
Date: Thu, 22 Mar 2018 11:04:58 +0000 [thread overview]
Message-ID: <e9db6804-4881-be93-f570-e9631dbccac8@citrix.com> (raw)
In-Reply-To: <d1126eb9-7203-7044-f72b-174cac6607ab@redhat.com>
On 22/03/2018 10:42, Paolo Bonzini wrote:
> On 22/03/2018 11:19, Andrew Cooper wrote:
>> On 22/03/2018 10:07, Paolo Bonzini wrote:
>>> On 22/03/2018 09:34, Wanpeng Li wrote:
>>>> From: Wanpeng Li <wanpengli@tencent.com>
>>>>
>>>> Explicit segment overides other than %fs and %gs are documented as ignored by
>>>> both Intel and AMD.
>>>>
>>>> In practice, this means that:
>>>>
>>>> * Explicit uses of %ss don't actually yield #SS[0] for non-canonical
>>>> memory references.
>>>> * Explicit uses of %{e,c,d}s don't override %rbp/%rsp-based memory references
>>>> to yield #GP[0] for non-canonical memory references.
>>>>
>>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>>> Cc: Radim Krčmář <rkrcmar@redhat.com>
>>>> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
>> When porting fixes from other projects, it is customary to identify so
>> in the commit message. In this case, the fix you've ported is
>> http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=b7dce29d9faf3597d009c853ed1fcbed9f7a7f68
>>
>> Here is an example of how Xen ports fixes from Linux for the drivers
>> that we share.
>> http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=4e131596f1defec9407b6e60d584a696beaf5d7e
> Thanks Andrew. The code is of course completely different, but the
> commit message is 1:1. Wanpeng, please acknowledge Jan in v2!
Thanks, but it is actually my patch, which is why I was confused at
seeing my own commit message on LKML.
Also, the chances are that there are similar issues decoding the
instruction info field in the VMCS, which is how I stumbled onto this in
the first place. I haven't yet fixed that side of things for Xen.
>
>>> Testcase, please...
>> If you want to crib from one, this is the testcase I made for Xen.
>>
>> http://xenbits.xen.org/docs/xtf/test-memop-seg.html
> How does it ensure that the code is executed through the emulator and
> not by the processor?
This test, and most of the tests in general, deliberately set things up
to execute the test cases first on the main processor, and then via the
emulator, and complain when any result is unexpected.
We've got a Force Emulation Prefix (ud2a; .ascii "xen") for doing
magic. Originally, this was used for PV guests to explicitly request an
emulated CPUID, but I extended it to HVM guests for "emulate the next
instruction", after we had some guest user => guest kernel privilege
escalations because of incorrect emulation.
Fundamentally, any multi-vcpu guest can force an arbitrary instruction
through the emulator, because rewriting a couple of bytes of instruction
stream is far far far faster than a vmexit. I chose to introduce a
explicit way to force this to occur, for testing purposes.
>
>> With the impending KVM/PVH work which is ongoing, it will soon be easy
>> to run Xen's HVM test suite unmodified under KVM, but we're not quite
>> there yet.
> What does the test suite use for console I/O?
Depends on what it available as it boots, but one of the default
consoles is port 0x12. If things need to be tweaked to work more
cleanly, then that is entirely fine.
~Andrew
next prev parent reply other threads:[~2018-03-22 11:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 8:34 Wanpeng Li
2018-03-22 10:07 ` Paolo Bonzini
2018-03-22 10:19 ` Andrew Cooper
2018-03-22 10:42 ` Paolo Bonzini
2018-03-22 11:04 ` Andrew Cooper [this message]
2018-03-22 11:14 ` Wanpeng Li
2018-03-22 12:38 ` Paolo Bonzini
2018-03-22 13:39 ` Wanpeng Li
2018-03-22 13:53 ` Andrew Cooper
2018-03-23 14:27 ` Wanpeng Li
2018-03-23 14:43 ` Andrew Cooper
2018-03-23 15:04 ` Paolo Bonzini
2018-03-26 12:25 ` Wanpeng Li
2018-03-26 12:27 ` Paolo Bonzini
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=e9db6804-4881-be93-f570-e9631dbccac8@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/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
all inboxes | Powered by JetHome®