From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Andy Honig <ahonig@google.com>, kvm <kvm@vger.kernel.org>
Subject: Re: KVM: x86: drop alignment checks from KVM_MSR_SYSTEM_TIME address
Date: Fri, 22 Mar 2013 23:57:08 +0200 [thread overview]
Message-ID: <20130322215708.GB9382@redhat.com> (raw)
In-Reply-To: <20130322211947.GA2685@amt.cnet>
On Fri, Mar 22, 2013 at 06:19:47PM -0300, Marcelo Tosatti wrote:
>
> The alignment check is not necessary given that "KVM: x86: Convert
> MSR_KVM_SYSTEM_TIME to use gfn_to_hva_cache" (0b79459b482e85cb742)
> uses kvm_write_guest which is able to handle data across page
> properly.
>
It uses kvm_write_guest_cached which calls to copy_to_user() directly.
While this will not allow to overwrite page that does not belong to qemu
process, it is possible to write outside of memory slot. May be we
should use kvm_write_guest to do system time updates.
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index f19ac0a..ec830fa 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1952,10 +1952,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>
> gpa_offset = data & ~(PAGE_MASK | 1);
>
> - /* Check that the address is 32-byte aligned. */
> - if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1))
> - break;
> -
> if (kvm_gfn_to_hva_cache_init(vcpu->kvm,
> &vcpu->arch.pv_time, data & ~1ULL))
> vcpu->arch.pv_time_enabled = false;
--
Gleb.
next prev parent reply other threads:[~2013-03-22 21:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 19:14 KVM: x86: relax MSR_KVM_SYSTEM_TIME alignment check Marcelo Tosatti
2013-03-22 19:21 ` Gleb Natapov
2013-03-22 19:47 ` Marcelo Tosatti
2013-03-22 21:19 ` KVM: x86: drop alignment checks from KVM_MSR_SYSTEM_TIME address Marcelo Tosatti
2013-03-22 21:57 ` Gleb Natapov [this message]
2013-03-23 0:17 ` Andrew Honig
2013-03-23 14:12 ` Gleb Natapov
2013-04-11 16:05 ` 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=20130322215708.GB9382@redhat.com \
--to=gleb@redhat.com \
--cc=ahonig@google.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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.