From: Petre Ovidiu PIRCALABU <ppircalabu@bitdefender.com>
To: "JBeulich@suse.com" <JBeulich@suse.com>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>
Cc: "kevin.tian@intel.com" <kevin.tian@intel.com>,
"sstabellini@kernel.org" <sstabellini@kernel.org>,
"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
"George.Dunlap@eu.citrix.com" <George.Dunlap@eu.citrix.com>,
"tim@xen.org" <tim@xen.org>,
"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
"paul.durrant@citrix.com" <paul.durrant@citrix.com>,
"tamas@tklengyel.com" <tamas@tklengyel.com>,
"jun.nakajima@intel.com" <jun.nakajima@intel.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v9 1/2] x86emul: New return code for unimplemented instruction
Date: Tue, 5 Sep 2017 16:20:37 +0000 [thread overview]
Message-ID: <1504628436.4551.40.camel@bitdefender.com> (raw)
In-Reply-To: <59AEE3110200007800177A92@prv-mh.provo.novell.com>
On Ma, 2017-09-05 at 09:46 -0600, Jan Beulich wrote:
> >
> > >
> > > >
> > > > On 05.09.17 at 17:23, <ppircalabu@bitdefender.com> wrote:
> > On Lu, 2017-09-04 at 23:42 -0600, Jan Beulich wrote:
> > >
> > > >
> > > > >
> > > > >
> > > > > >
> > > > > >
> > > > > > @@ -5177,7 +5177,7 @@ x86_emulate(
> > > > > > goto done;
> > > > > > break;
> > > > > > default:
> > > > > > - goto cannot_emulate;
> > > > > > + goto unimplemented_insn;
> > > > > While I can see why you do this change, for many/all of the
> > > > > ones
> > > > > I'll leave in context below I think you rather want to switch
> > > > > to
> > > > > generate_exception(EXC_UD).
> > > > Some of the opcodes are valid but not supported by the
> > > > emulator. In
> > > > this case X86EMUL_UNIMPLEMENTED should be returned to allow the
> > > > monitor
> > > > app to handle this case. Also, in the worst case scenario, when
> > > > the
> > > > opcode doesn't correspond to a valid x86(-64) instruction, if
> > > > the
> > > > monitor app for example tries to single-step it on the real
> > > > hardware an
> > > > UD exception will also be reported.
> > > Please be more precise with "some of the opcodes are valid". When
> > > I
> > > looked through your change, I don't think I've seen any such case
> > > for
> > > the
> > > places I meant the comment to apply to. Also, as far as the
> > > emulator
> > > changes themselves go, please leave aside considerations of what
> > > a
> > > monitor app may or may not do. These changes need to be
> > > consistent
> > > all by themselves.
> > >
> > Sorry about the poor wording. I was under the impression that you
> > required the invalid opcodes to be handled differently from the
> > ones
> > which are valid but unimplemented (directly generate EXC_UD instead
> > of
> > returning X86EMUL_UNIMPLEMENTED and let the caller handle it).
> Yes, that's what I think would be best. I admit there is a potential
> problem with this, when one or more of them become defined. But
> that's something I'd like to also have Andrew's input on.
>
> >
> > e.g. for X86EMUL_OPC_VEX(0x0f38, 0xf3): /* Grp 17 */
> > the mod R/M possible values are 1,2,3 (source: http://sandpile.org/
> > x86/
> > opc_grp.htm).
> > From my perspective I wouldn't differentiate between those 2 cases
> > and
> > return X86EMUL_UNIMPLEMENTED.
> I must still be missing something: What two cases are you talking
> about? The three valid values have an implementation in the
> emulator. All others are undefined, i.e. at present would ideally
> produce #UD (see above).
Probably a better example it the handling of Grp7 (after applying
Andrew's patch).
if modrm is 0xd0 the instruction is xgetbv (valid but unimplemented)
if modrm value is corrupted (the encoding doesn't correspond to a valid
instruction it will also jump to emul_unimplemented.
>
> Jan
>
>
> ________________________
> This email was scanned by Bitdefender
Many thanks,
Petre
________________________
This email was scanned by Bitdefender
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-05 16:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 18:57 [PATCH v9 0/2] Notify monitor when emulating an unimplemented instruction Petre Pircalabu
2017-08-30 18:57 ` [PATCH v9 1/2] x86emul: New return code for " Petre Pircalabu
2017-09-01 10:33 ` Jan Beulich
2017-09-04 17:20 ` Petre Ovidiu PIRCALABU
2017-09-05 5:42 ` Jan Beulich
2017-09-05 15:23 ` Petre Ovidiu PIRCALABU
2017-09-05 15:46 ` Jan Beulich
2017-09-05 16:20 ` Petre Ovidiu PIRCALABU [this message]
2017-09-06 9:49 ` Jan Beulich
2017-08-30 18:57 ` [PATCH v9 2/2] x86/monitor: Notify monitor if an emulation fails Petre Pircalabu
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=1504628436.4551.40.camel@bitdefender.com \
--to=ppircalabu@bitdefender.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=paul.durrant@citrix.com \
--cc=rcojocaru@bitdefender.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.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.