From: Gleb Natapov <gleb@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Avi Kivity <avi@redhat.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
kvm@vger.kernel.org,
Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Subject: Re: [RFC] KVM: x86: emulate movdqa
Date: Sun, 8 Jan 2012 18:36:10 +0200 [thread overview]
Message-ID: <20120108163610.GF2167@redhat.com> (raw)
In-Reply-To: <CAJSP0QV21UEJ2FJoj-VXQvUicyGAAUYQ-0a+H1S1ueLsWiLQ2Q@mail.gmail.com>
On Sun, Jan 08, 2012 at 04:21:56PM +0000, Stefan Hajnoczi wrote:
> On Sun, Jan 8, 2012 at 10:32 AM, Avi Kivity <avi@redhat.com> wrote:
> > On 01/07/2012 12:26 PM, Stefan Hajnoczi wrote:
> >>
> >> movdqa %xmm0,(%rdi)
> >>
> >> This patch adds movdqa to the emulator but does not implement #GP when
> >> the memory operand is unaligned to 16 bytes. I'm not sure whether
> >> alignment checking can be implemented as an opcode .flag or if it needs
> >> to be done in em_movdqa().
> >
> > It should actually be automatic when the Sse flag is present, since it's
> > the norm for almost all SSE instructions. There should be a .flag to
> > override it for movdqu.
>
> When writing a kvm-unit-test for movdqa I found that alignment
> checking happens before the page fault (makes sense). That means
> misalignment is detected by the CPU while still in guest mode. The
> emulator never sees the instruction because #GP is raised and handled
> in the guest.
>
> I also didn't see other instances of alignment checking in the
> emulator (e.g. eflags AC). I guess the same situation applies there.
>
> Can you think of a case where we need to perform alignment checking in
> the emulator?
>
Any instruction can be fed to emulator on smp guest. Make one vcpu
enter emulator by some instruction that does io and replace it by
another instruction on a second vcpu. If replacing will happen before
first vcpu emulates fetch, instruction written by the second vcpu will be
emulated. This is why emulator has to perform all security checks even
if cpu does them before exit. Alignment checking is probably not
security sensitive though.
--
Gleb.
next prev parent reply other threads:[~2012-01-08 16:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-07 10:26 [RFC] KVM: x86: emulate movdqa Stefan Hajnoczi
2012-01-08 10:32 ` Avi Kivity
2012-01-08 16:21 ` Stefan Hajnoczi
2012-01-08 16:36 ` Gleb Natapov [this message]
2012-01-08 16:41 ` Avi Kivity
2012-01-09 8:52 ` Takuya Yoshikawa
2012-01-09 10:02 ` Avi Kivity
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=20120108163610.GF2167@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=stefanha@gmail.com \
--cc=stefanha@linux.vnet.ibm.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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.