Re: [PATCH v7 13/14] KVM: Enable and expose KVM_MEM_PRIVATE

From
Chao Peng <hidden>
Date
2022-07-19 14:31:05
Also in
kvm, linux-doc, linux-fsdevel, linux-kselftest, linux-mm, lkml, qemu-devel
Reply to
Gupta, Pankaj, 2022-07-19
On Tue, Jul 19, 2022 at 11:55:24AM +0200, Gupta, Pankaj wrote:

...
quoted
@@ -4712,12 +4813,10 @@ static long kvm_vm_ioctl(struct file *filp,
  			(u32 __user *)(argp + offsetof(typeof(mem), flags))))
  			goto out;
-		if (flags & KVM_MEM_PRIVATE) {
-			r = -EINVAL;
-			goto out;
-		}
-
-		size = sizeof(struct kvm_userspace_memory_region);
+		if (flags & KVM_MEM_PRIVATE)
+			size = sizeof(struct kvm_userspace_memory_region_ext);
Not sure if we use kvm_userspace_memory_region_ext or kvm_user_mem_region,
just for readability.
Somehow, but majorly for code maintainability, kvm_user_mem_region is
designed to be the alias of kvm_userspace_memory_region_ext so in the
code we can access the 'unpacked' fields using something like
'mem.usersapce_addr' instead of 'mem.region.userspace_addr'.

Chao
quoted
+		else
+			size = sizeof(struct kvm_userspace_memory_region);
  		if (copy_from_user(&mem, argp, size))
  			goto out;
Thread (164 messages) 164 messages, 20 authors, last reply 2023-05-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help