public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	"Nadav Har'El" <nyh@math.technion.ac.il>
Subject: Re: [PATCH] KVM: nVMX: Trap unconditionally if msr bitmap access fails
Date: Sun, 17 Feb 2013 10:56:36 +0200	[thread overview]
Message-ID: <20130217085636.GR9817@redhat.com> (raw)
In-Reply-To: <511D3103.2040005@siemens.com>

On Thu, Feb 14, 2013 at 07:46:27PM +0100, Jan Kiszka wrote:
> This avoids basing decisions on uninitialized variables, potentially
> leaking kernel data to the L1 guest.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>

> ---
>  arch/x86/kvm/vmx.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 2633199..81a25de 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5991,7 +5991,8 @@ static bool nested_vmx_exit_handled_msr(struct kvm_vcpu *vcpu,
>  	/* Then read the msr_index'th bit from this bitmap: */
>  	if (msr_index < 1024*8) {
>  		unsigned char b;
> -		kvm_read_guest(vcpu->kvm, bitmap + msr_index/8, &b, 1);
> +		if (kvm_read_guest(vcpu->kvm, bitmap + msr_index/8, &b, 1))
> +			return 1;
>  		return 1 & (b >> (msr_index & 7));
>  	} else
>  		return 1; /* let L1 handle the wrong parameter */
> -- 
> 1.7.3.4

--
			Gleb.

  reply	other threads:[~2013-02-17  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 18:46 [PATCH] KVM: nVMX: Trap unconditionally if msr bitmap access fails Jan Kiszka
2013-02-17  8:56 ` Gleb Natapov [this message]
2013-02-19  2:20   ` Marcelo Tosatti

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=20130217085636.GR9817@redhat.com \
    --to=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=nyh@math.technion.ac.il \
    /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