mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: linux-kernel@vger.kernel.org, Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: Veirfy memory slot only for readability
Date: Fri, 02 Dec 2011 10:15:54 +0900	[thread overview]
Message-ID: <4ED826CA.5030502@oss.ntt.co.jp> (raw)
In-Reply-To: <1322768576-9242-1-git-send-email-levinsasha928@gmail.com>

(2011/12/02 4:42), Sasha Levin wrote:
> It's enough for memory slot to be readable, as the comment above the check
> states.
> 
> A user should be able to create read-only memory slot.

I submitted the original patch like you to speed up page table walking,
a hot path in KVM, and Avi applied the patch with changing the VERIFY_READ
to VERIFY_WRITE:  on x86, both do the same check.  You can see that on the
commit.

After that, Xiao started to write with __xxx_user() based on this check IIRC.
So you should keep the code as is and change the comment if you like!

Thanks,
	Takuya

> 
> Cc: Avi Kivity<avi@redhat.com>
> Cc: Marcelo Tosatti<mtosatti@redhat.com>
> Cc: kvm@vger.kernel.org
> Signed-off-by: Sasha Levin<levinsasha928@gmail.com>
> ---
>   virt/kvm/kvm_main.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index e289486..b92883f 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -727,7 +727,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
>   	/* We can read the guest memory with __xxx_user() later on. */
>   	if (user_alloc&&
>   	((mem->userspace_addr&  (PAGE_SIZE - 1)) ||
> -	     !access_ok(VERIFY_WRITE,
> +	     !access_ok(VERIFY_READ,
>   			(void __user *)(unsigned long)mem->userspace_addr,
>   			mem->memory_size)))
>   		goto out;


  reply	other threads:[~2011-12-02  1:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 19:42 Sasha Levin
2011-12-02  1:15 ` Takuya Yoshikawa [this message]
2011-12-02  3:16   ` Takuya Yoshikawa
2011-12-02  5:46     ` Sasha Levin
2011-12-02  6:39       ` Takuya Yoshikawa
2011-12-04 16:53       ` Avi Kivity
2011-12-04 17:29         ` Sasha Levin
2011-12-04 17:34           ` Avi Kivity
2011-12-04 19:10             ` Sasha Levin

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=4ED826CA.5030502@oss.ntt.co.jp \
    --to=yoshikawa.takuya@oss.ntt.co.jp \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome