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, 19 Jun 2024 04:58:17 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "nik.borisov@...e.com" <nik.borisov@...e.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "Hansen, Dave" <dave.hansen@...el.com>, "Edgecombe, Rick P"
	<rick.p.edgecombe@...el.com>, "bp@...en8.de" <bp@...en8.de>, "x86@...nel.org"
	<x86@...nel.org>, "peterz@...radead.org" <peterz@...radead.org>,
	"hpa@...or.com" <hpa@...or.com>, "mingo@...hat.com" <mingo@...hat.com>,
	"Williams, Dan J" <dan.j.williams@...el.com>,
	"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>, "tglx@...utronix.de"
	<tglx@...utronix.de>, "seanjc@...gle.com" <seanjc@...gle.com>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "binbin.wu@...ux.intel.com"
	<binbin.wu@...ux.intel.com>, "Yamahata, Isaku" <isaku.yamahata@...el.com>
Subject: Re: [PATCH 8/9] x86/virt/tdx: Exclude memory region hole within CMR
 as TDMR's reserved area


> > > +/* Wrapper to read one metadata field to u8/u16/u32/u64 */
> > > +#define stbuf_read_sysmd_single(_field_id, _pdata)	\
> > > +	stbuf_read_sysmd_field(_field_id, _pdata, 0, sizeof(typeof(*(_pdata))))
> > 
> > What value does adding yet another level of indirection bring here?
> 
> We could use the raw version instead: read_sys_metadata_field().
> 
> This wrapper additionally checks the 'element size' encoded in the field
> ID matches the size that passed in, so it can catch potential kernel bug.
> 
> But I can remove this to simplify the code.
> 

Sorry I didn't finish my reply properly as I was interrupted.

Another advantage of this wrapper is, as mentioned in the comment of it,
it works with 'u8/u16/u32/u64' directly, while the raw
read_sys_metadata_field() always puts data to a 'u64'.

An example is, ...

> > > +
> > > +	ret = stbuf_read_sysmd_single(MD_FIELD_ID_NUM_CMRS,
> > > +			&cmr_info->num_cmrs);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > 

... here to read cmr_info->num_cmrs, which is a 'u16'.

So it is helpful to me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ