All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Paul Durrant <paul.durrant@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, TimDeegan <tim@xen.org>
Subject: Re: [PATCH] x86: always supply .cpuid() handler to x86_emulate()
Date: Fri, 11 Nov 2016 07:58:08 -0700	[thread overview]
Message-ID: <5825EA90020000780011E04F@prv-mh.provo.novell.com> (raw)
In-Reply-To: <d0f96d55-dd38-9283-2f4b-f6aa36c3ec80@citrix.com>

>>> On 11.11.16 at 15:16, <andrew.cooper3@citrix.com> wrote:
> On 10/11/16 12:30, Jan Beulich wrote:
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -2755,6 +2755,24 @@ static int priv_op_write_msr(unsigned in
>>      return X86EMUL_UNHANDLEABLE;
>>  }
>>  
>> +int pv_emul_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
>> +                  unsigned int *edx, struct x86_emulate_ctxt *ctxt)
>> +{
>> +    struct cpu_user_regs regs = *ctxt->regs;
> 
> You need a CPUID faulting check here, matching the hvm side of things,
> or you will leave a latent bug which gets exposed when switching to
> using full x86_emulate() for PV guests.

That addition is part of the patch actually switching to x86_emulate().
I don't think it belongs here, as for now we don't mean to emulate
CPUID insns.

> Would it be wise to add a fail_if(!ops->cpuid) to x86_emulate() to catch
> other misuses?

I don't think so - there may be cases where it's indeed unneeded
(and I foresee such arising quickly once the ->validate() hooks is
in place, addition of which is now too part of aforementioned patch).

Jan


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

  reply	other threads:[~2016-11-11 14:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 12:30 [PATCH] x86: always supply .cpuid() handler to x86_emulate() Jan Beulich
2016-11-11 13:54 ` Wei Liu
2016-11-11 16:21   ` Jan Beulich
2016-11-12  6:42     ` Wei Liu
2016-11-11 14:05 ` Paul Durrant
2016-11-11 14:16 ` Andrew Cooper
2016-11-11 14:58   ` Jan Beulich [this message]
2016-11-11 15:09     ` Andrew Cooper

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=5825EA90020000780011E04F@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=paul.durrant@citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.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 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.