lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 14 Jun 2024 18:14:04 +0200
From: Borislav Petkov <bp@...en8.de>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Alexey Makhalov <alexey.makhalov@...adcom.com>,
	linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev,
	hpa@...or.com, dave.hansen@...ux.intel.com, mingo@...hat.com,
	tglx@...utronix.de, 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 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ