qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-ppc@nongnu.org, qemu-stable@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] pseries: Synchronize qemu and KVM state on hypercalls
Date: Thu, 20 Sep 2012 21:54:19 +1000	[thread overview]
Message-ID: <20120920115419.GK24695@truffula.fritz.box> (raw)
In-Reply-To: <505AC84C.9060500@siemens.com>

On Thu, Sep 20, 2012 at 09:39:56AM +0200, Jan Kiszka wrote:
> On 2012-09-20 09:08, David Gibson wrote:
> > Currently the KVM exit path for PAPR hypercalls does not synchronize the
> > qemu cpu state with the KVM state.  Mostly this works, because the actual
> > hypercall arguments and return values are explicitly passed through the
> > kvm_run structure.  However, the hypercall path includes a privilege check,
> > to ensure that only the guest kernel can invoke hypercalls, not the guest
> > userspace.  Because of the lack of sync, this privilege check will use an
> > out of date copy of the MSR, which could lead either to guest userspace
> > being able to invoke hypercalls (a security hole for the guest) or to the
> > guest kernel being incorrectly refused privilege leading to various other
> > failures.
> > 
> > This patch fixes the bug by forcing a synchronization on the hypercall exit
> > path.  This does mean we have a potentially quite expensive get and set of
> > the state, however performance critical hypercalls are generally already
> > implemented inside KVM so this probably won't matter.  If it is a
> > performance problem we can optimize it later by having the kernel perform
> > the privilege check.  That will need a new capability, however, since qemu
> > will still need the privilege check for older kernels.
> 
> If it's just about reading a small subset of the state (a single MSR?)
> to allow the privilege check, you can also open-code only that in HCALL
> exit. If it really matters.

We could, don't think it's worth the trouble.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2012-09-20 12:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20  7:08 [Qemu-devel] [0/2] Bugfixes for ppc KVM David Gibson
2012-09-20  7:08 ` [Qemu-devel] [PATCH 1/2] pseries: Synchronize qemu and KVM state on hypercalls David Gibson
2012-09-20  7:38   ` Alexander Graf
2012-09-20 11:53     ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-09-20 12:44       ` Alexander Graf
2012-09-21  0:22         ` David Gibson
2012-09-24 14:27           ` Alexander Graf
2012-09-25  7:05             ` David Gibson
2012-09-20  7:39   ` [Qemu-devel] " Jan Kiszka
2012-09-20 11:54     ` David Gibson [this message]
2012-09-20  7:08 ` [Qemu-devel] [PATCH 2/2] target-ppc: KVM: Fix some kernel version edge cases for kvmppc_reset_htab() David Gibson
2012-09-20  8:58   ` Alexander Graf

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=20120920115419.GK24695@truffula.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-stable@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).