All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	kvm@vger.kernel.org, "Simon Becherer" <simon@becherer.de>,
	"Iakov Karpov" <srid@rkmail.ru>,
	"Gabriele Balducci" <balducci@units.it>,
	"Antti Antinoja" <reader@fennosys.fi>,
	"Takashi Iwai" <tiwai@suse.com>, "Jiri Slaby" <jslaby@suse.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] KVM: x86: Whitelist port 0x7e for pre-incrementing %rip
Date: Sat, 27 Apr 2019 00:19:23 -0400 (EDT)	[thread overview]
Message-ID: <496631087.15675835.1556338763312.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20190426233846.3675-1-sean.j.christopherson@intel.com>



----- Original Message -----
> From: "Sean Christopherson" <sean.j.christopherson@intel.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>, "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: kvm@vger.kernel.org, "Simon Becherer" <simon@becherer.de>, "Iakov Karpov" <srid@rkmail.ru>, "Gabriele Balducci"
> <balducci@units.it>, "Antti Antinoja" <reader@fennosys.fi>, "Takashi Iwai" <tiwai@suse.com>, "Jiri Slaby"
> <jslaby@suse.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
> Sent: Saturday, April 27, 2019 1:38:46 AM
> Subject: [PATCH] KVM: x86: Whitelist port 0x7e for pre-incrementing %rip
> 
> KVM's recent bug fix to update %rip after emulating I/O broke userspace
> that relied on the previous behavior of incrementing %rip prior to
> exiting to userspace.  When running a Windows XP guest on AMD hardware,
> Qemu may patch "OUT 0x7E" instructions in reaction to the OUT itself.
> Because KVM's old behavior was to increment %rip before exiting to
> userspace to handle the I/O, Qemu manually adjusted %rip to account for
> the OUT instruction.
> 
> Arguably this is a userspace bug as KVM requires userspace to re-enter
> the kernel to complete instruction emulation before taking any other
> actions.  That being said, this is a bit of a grey area and breaking
> userspace that has worked for many years is bad.
> 
> Pre-increment %rip on OUT to port 0x7e before exiting to userspace to
> hack around the issue.
> 
> Fixes: 45def77ebf79e ("KVM: x86: update %rip after emulating IO")

The patch should probably be tweaked to use the quirks mechanism.  I'll post
an adjusted version next Monday.

Paolo

  reply	other threads:[~2019-04-27  4:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 23:38 [PATCH] KVM: x86: Whitelist port 0x7e for pre-incrementing %rip Sean Christopherson
2019-04-27  4:19 ` Paolo Bonzini [this message]
2019-04-29 14:16   ` Sean Christopherson

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=496631087.15675835.1556338763312.JavaMail.zimbra@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=balducci@units.it \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=reader@fennosys.fi \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=simon@becherer.de \
    --cc=srid@rkmail.ru \
    --cc=tiwai@suse.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 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.