Re: [PATCH] KVM: Veirfy memory slot only for readability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(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@xxxxxxxxxx>
> Cc: Marcelo Tosatti<mtosatti@xxxxxxxxxx>
> Cc: kvm@xxxxxxxxxxxxxxx
> Signed-off-by: Sasha Levin<levinsasha928@xxxxxxxxx>
> ---
>   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;

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux