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: Wed, 15 May 2024 16:22:57 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Nikolay Borisov <nik.borisov@...e.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>, 
	Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>, 
	x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>, linux-coco@...ts.linux.dev, 
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCHv4 3/4] x86/tdx: Dynamically disable SEPT violations from
 causing #VEs

On Wed, May 15, 2024 at 04:14:18PM +0300, Nikolay Borisov wrote:
> 
> 
> On 15.05.24 г. 12:30 ч., Kirill A. Shutemov wrote:
> > On Tue, May 14, 2024 at 05:56:21PM +0300, Nikolay Borisov wrote:
> > > > diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> > > > index 1ff571cb9177..ba37f4306f4e 100644
> > > > --- a/arch/x86/coco/tdx/tdx.c
> > > > +++ b/arch/x86/coco/tdx/tdx.c
> > > > @@ -77,6 +77,20 @@ static inline void tdcall(u64 fn, struct tdx_module_args *args)
> > > >    		panic("TDCALL %lld failed (Buggy TDX module!)\n", fn);
> > > >    }
> > > > +/* Read TD-scoped metadata */
> > > > +static inline u64 tdg_vm_rd(u64 field, u64 *value)
> > > > +{
> > > > +	struct tdx_module_args args = {
> > > > +		.rdx = field,
> > > > +	};
> > > > +	u64 ret;
> > > > +
> > > > +	ret = __tdcall_ret(TDG_VM_RD, &args);
> > > > +	*value = args.r8;
> > > > +
> > > > +	return ret;
> > > > +}
> > > 
> > > nit: Perhaps this function can be put in the first patch and the description
> > > there be made more generic, something along the lines of "introduce
> > > functions for tdg_rd/tdg_wr" ?
> > 
> > A static function without an user will generate a build warning. I don't
> > think it is good idea.
> > 
> 
> But are those 2 wrappers really static-worthy? Those two interfaces seem to
> be rather generic and could be used by more things in the future? OTOH when
> the time comes they can be exposed as needed.

Generally, functions have to static unless they used outside of the
translation unit.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ