[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200903130325.GC2778029@kroah.com>
Date: Thu, 3 Sep 2020 15:03:25 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: shuo.a.liu@...el.com
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Yu Wang <yu1.wang@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Zhi Wang <zhi.a.wang@...el.com>,
Zhenyu Wang <zhenyuw@...ux.intel.com>
Subject: Re: [PATCH v2 07/17] virt: acrn: Introduce an ioctl to set vCPU
registers state
On Thu, Sep 03, 2020 at 08:41:51PM +0800, shuo.a.liu@...el.com wrote:
> From: Shuo Liu <shuo.a.liu@...el.com>
>
> A virtual CPU of User VM has different context due to the different
> registers state. ACRN userspace needs to set the virtual CPU
> registers state (e.g. giving a initial registers state to a virtual
> BSP of a User VM).
>
> HSM provides an ioctl ACRN_IOCTL_SET_VCPU_REGS to do the virtual CPU
> registers state setting. The ioctl passes the registers state from ACRN
> userspace to the hypervisor directly.
>
> Signed-off-by: Shuo Liu <shuo.a.liu@...el.com>
> Reviewed-by: Zhi Wang <zhi.a.wang@...el.com>
> Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>
> Cc: Zhi Wang <zhi.a.wang@...el.com>
> Cc: Zhenyu Wang <zhenyuw@...ux.intel.com>
> Cc: Yu Wang <yu1.wang@...el.com>
> Cc: Reinette Chatre <reinette.chatre@...el.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> drivers/virt/acrn/hsm.c | 14 +++++++
> drivers/virt/acrn/hypercall.h | 13 +++++++
> include/uapi/linux/acrn.h | 71 +++++++++++++++++++++++++++++++++++
> 3 files changed, 98 insertions(+)
>
> diff --git a/drivers/virt/acrn/hsm.c b/drivers/virt/acrn/hsm.c
> index 6ec6aa9053d3..13df76d0206e 100644
> --- a/drivers/virt/acrn/hsm.c
> +++ b/drivers/virt/acrn/hsm.c
> @@ -12,6 +12,7 @@
> #define pr_fmt(fmt) "acrn: " fmt
> #define dev_fmt(fmt) "acrn: " fmt
>
> +#include <linux/io.h>
> #include <linux/miscdevice.h>
> #include <linux/mm.h>
> #include <linux/module.h>
> @@ -49,6 +50,7 @@ static long acrn_dev_ioctl(struct file *filp, unsigned int cmd,
> {
> struct acrn_vm *vm = filp->private_data;
> struct acrn_vm_creation *vm_param;
> + struct acrn_vcpu_regs *cpu_regs;
> int ret = 0;
>
> if (vm->vmid == ACRN_INVALID_VMID && cmd != ACRN_IOCTL_CREATE_VM) {
> @@ -96,6 +98,18 @@ static long acrn_dev_ioctl(struct file *filp, unsigned int cmd,
> case ACRN_IOCTL_DESTROY_VM:
> ret = acrn_vm_destroy(vm);
> break;
> + case ACRN_IOCTL_SET_VCPU_REGS:
> + cpu_regs = memdup_user((void __user *)ioctl_param,
> + sizeof(struct acrn_vcpu_regs));
> + if (IS_ERR(cpu_regs))
> + return PTR_ERR(cpu_regs);
> +
> + ret = hcall_set_vcpu_regs(vm->vmid, virt_to_phys(cpu_regs));
No sanity checking of any arguments?
Wow, fuzzers are going to have a fun time with your hypervisor, good
luck! :)
Powered by blists - more mailing lists