From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Paul Durrant <Paul.Durrant@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH for-4.7] x86/hvm: Correct emulation of invlpg instruction
Date: Fri, 22 Apr 2016 14:40:11 +0100 [thread overview]
Message-ID: <571A29BB.90700@citrix.com> (raw)
In-Reply-To: <571A2B8F02000078000E4BF8@prv-mh.provo.novell.com>
On 22/04/16 12:47, Jan Beulich wrote:
>>>> On 22.04.16 at 13:18, <andrew.cooper3@citrix.com> wrote:
>> On 22/04/16 11:30, Jan Beulich wrote:
>>>>>> On 22.04.16 at 12:16, <andrew.cooper3@citrix.com> wrote:
>>>> On 22/04/16 10:57, Jan Beulich wrote:
>>>>>>>> On 22.04.16 at 11:48, <Paul.Durrant@citrix.com> wrote:
>>>>>>> From: Jan Beulich [mailto:JBeulich@suse.com]
>>>>>>> Sent: 22 April 2016 10:31
>>>>>>>>>> On 22.04.16 at 10:59, <andrew.cooper3@citrix.com> wrote:
>>>>>>>> --- a/xen/arch/x86/hvm/emulate.c
>>>>>>>> +++ b/xen/arch/x86/hvm/emulate.c
>>>>>>>> @@ -1598,8 +1598,27 @@ static int hvmemul_invlpg(
>>>>>>>> rc = hvmemul_virtual_to_linear(
>>>>>>>> seg, offset, 1, &reps, hvm_access_none, hvmemul_ctxt, &addr);
>>>>>>>>
>>>>>>>> - if ( rc == X86EMUL_OKAY )
>>>>>>>> + switch ( rc )
>>>>>>>> + {
>>>>>>>> + case X86EMUL_OKAY:
>>>>>>>> hvm_funcs.invlpg_intercept(addr);
>>>>>>>> + break;
>>>>>>>> +
>>>>>>>> + case X86EMUL_EXCEPTION:
>>>>>>>> + ASSERT(hvmemul_ctxt->trap.vector == TRAP_gp_fault);
>>>>>>>> + /*
>>>>>>>> + * `invlpg` and `invlpga` are specified to be NOPs when issued on a
>>>>>>>> + * non-canonical address. hvmemul_virtual_to_linear() latches a #GP
>>>>>>>> + * which is the useful behaviour for most of its callers.
>>>>>>> Here and in the description I'd prefer you to not exclusively refer
>>>>>>> to non-canonical addresses - segment limit violations in 32-bit or
>>>>>>> compatibility modes are affected as much.
>>>>>> ...in which case squashing the #GP would be incorrect, right?
>>>>> No, not according to the SDM.
>>>> I should check and only squash a #GP(0)
>>>>
>>>> #GP(sel) or #SS(sel) should not be squashed.
>>> Which also can't happen here (these only occur when selectors
>>> get loaded via some the various mechanisms allowing that).
>> #GP(sel) or #SS(sel) also occur for a memory access which causes a
>> segment limit violation. (SDM Vol 3, 5.3 "Limit Checking")
> I can't find any mention of error codes in this section at all. Not
> sure which version of it you're looking at, mine is 057US. And
> even if it said so, I'd be 99.999% certain this is in error, as all
> instruction pages always say #GP(0) and #SS(0) for limit
> violations.
Hmm - Section 6.15 is rather more clear, and does state #GP(0) and
#SS(0) for limit violations.
In which case I am going to have to untangle hvmemul_virtual_to_linear()
and hvm_virtual_to_linear_addr() to distinguish the two cases, and also
to raise #SS for %ss limit violations.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-04-22 13:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 8:59 [PATCH for-4.7] x86/hvm: Correct emulation of invlpg instruction Andrew Cooper
2016-04-22 9:31 ` Jan Beulich
2016-04-22 9:48 ` Paul Durrant
2016-04-22 9:57 ` Jan Beulich
2016-04-22 10:16 ` Andrew Cooper
2016-04-22 10:30 ` Jan Beulich
2016-04-22 11:18 ` Andrew Cooper
2016-04-22 11:47 ` Jan Beulich
2016-04-22 13:40 ` Andrew Cooper [this message]
2016-04-22 13:59 ` 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=571A29BB.90700@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=Paul.Durrant@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.