public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Veirfy memory slot only for readability
@ 2011-12-01 19:42 Sasha Levin
  2011-12-02  1:15 ` Takuya Yoshikawa
  0 siblings, 1 reply; 9+ messages in thread
From: Sasha Levin @ 2011-12-01 19:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sasha Levin, Avi Kivity, Marcelo Tosatti, kvm

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.

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;
-- 
1.7.8.rc4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-04 19:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01 19:42 [PATCH] KVM: Veirfy memory slot only for readability Sasha Levin
2011-12-02  1:15 ` Takuya Yoshikawa
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox