RE: [patch] fix kvm_arch_vcpu_ioctl_[gs]et_regs()

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

 



Jes
   Good work!  I ever talked about the issue with Avi and wanted to enable the logic with the following patch, and Avi thought it may lead to security issues, so deferred to now :) 

One comment:  We still need the logic to save and restore the vcpu's stack for vcpu resuming to the guest in the same environment.  Maybe you can allocate one buf to save it in kvm_reg structure.
Xiantao


diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index cf0ab8e..9761a7e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1390,6 +1390,9 @@ static long kvm_vcpu_ioctl(struct file *filp,
                kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL);
                if (!kvm_regs)
                        goto out;
+               r = -EFAULT;
+               if (copy_from_user(kvm_regs, argp, sizeof(struct kvm_regs)))
+                       goto out_free1;
                r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs);
                if (r)
                        goto out_free1;

Xiantao


-----Original Message-----
From: Jes Sorensen [mailto:jes@xxxxxxx] 
Sent: Tuesday, December 09, 2008 11:36 PM
To: Avi Kivity; kvm-ia64@xxxxxxxxxxxxxxx; Zhang, Xiantao
Subject: [patch] fix kvm_arch_vcpu_ioctl_[gs]et_regs()

Hi,

This patch makes these two macros do something sensible on ia64 and
work the way qemu expects to use them. The old versions clearly couldn't
have worked since the get_regs() call expected pointers in the kvm_regs
struct which were never copied in.

Cheers,
Jes

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

[Index of Archives]     [Linux KVM Devel]     [Linux Virtualization]     [Big List of Linux Books]     [Linux SCSI]     [Yosemite Forum]

  Powered by Linux