Re: [PATCH v11 8/8] x86/vmware: Add TDX hypercall support

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

 



On Fri, Jun 14, 2024 at 09:03:22AM -0700, Dave Hansen wrote:
> 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.

You mean like this:

	struct tdx_module_args args = {};

?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux