[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <844ef200-aabe-4497-85c9-44fc46c9133a@intel.com>
Date: Fri, 14 Jun 2024 09:03:22 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Alexey Makhalov <alexey.makhalov@...adcom.com>,
linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev, bp@...en8.de,
hpa@...or.com, dave.hansen@...ux.intel.com, mingo@...hat.com,
tglx@...utronix.de
Cc: x86@...nel.org, netdev@...r.kernel.org, richardcochran@...il.com,
linux-input@...r.kernel.org, dmitry.torokhov@...il.com, zackr@...are.com,
linux-graphics-maintainer@...are.com, pv-drivers@...are.com,
timothym@...are.com, akaher@...are.com, dri-devel@...ts.freedesktop.org,
daniel@...ll.ch, airlied@...il.com, tzimmermann@...e.de, mripard@...nel.org,
maarten.lankhorst@...ux.intel.com, horms@...nel.org,
kirill.shutemov@...ux.intel.com, Tim Merrifield <tim.merrifield@...adcom.com>
Subject: Re: [PATCH v11 8/8] x86/vmware: Add TDX hypercall support
On 6/13/24 12:16, Alexey Makhalov wrote:
> +unsigned long vmware_tdx_hypercall(unsigned long cmd,
> + unsigned long in1, unsigned long in3,
> + unsigned long in4, unsigned long in5,
> + u32 *out1, u32 *out2, u32 *out3,
> + u32 *out4, u32 *out5)
> +{
> + struct tdx_module_args args;
> +
> + if (!hypervisor_is_type(X86_HYPER_VMWARE)) {
> + pr_warn_once("Incorrect usage\n");
> + return ULONG_MAX;
> + }
> +
> + if (cmd & ~VMWARE_CMD_MASK) {
> + pr_warn_once("Out of range command %lx\n", cmd);
> + return ULONG_MAX;
> + }
> +
> + args.rbx = in1;
> + args.rdx = in3;
> + args.rsi = in4;
> + args.rdi = in5;
> + args.r10 = VMWARE_TDX_VENDOR_LEAF;
> + args.r11 = VMWARE_TDX_HCALL_FUNC;
> + args.r12 = VMWARE_HYPERVISOR_MAGIC;
> + args.r13 = cmd;
> + args.r15 = 0; /* CPL */
I believe this leaks stack data into the hypervisor. Or did I miss the
zeroing of rcx/r8/r9/r14?
You need to zero out all of 'args' somehow.
Powered by blists - more mailing lists