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]
Message-ID: <271368d1cf0d3b3167038a01ba9e9d1e940cb507.camel@intel.com>
Date: Mon, 7 Oct 2024 03:07:08 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Hansen, Dave" <dave.hansen@...el.com>, "seanjc@...gle.com"
	<seanjc@...gle.com>, "bp@...en8.de" <bp@...en8.de>, "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>
CC: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>, "kvm@...r.kernel.org"
	<kvm@...r.kernel.org>, "nik.borisov@...e.com" <nik.borisov@...e.com>,
	"Hunter, Adrian" <adrian.hunter@...el.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
	"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v4 3/8] x86/virt/tdx: Prepare to support reading other
 global metadata fields

On Tue, 2024-10-01 at 21:40 +0000, Huang, Kai wrote:
> On Tue, 2024-10-01 at 08:19 -0700, Dave Hansen wrote:
> > On 10/1/24 03:44, Huang, Kai wrote:
> > > Please let me know if you have any concern?  Otherwise I will go with
> > > this route.
> > I still see some long unwieldy #defines in the mail thread.  That's my
> > biggest worry.
> 
> I suppose you mean the read_sys_metadata_field() macro?
> 
> We can split that into two smaller macros by moving BUILD_BUG_ON() out:
> 
> /* Don't use this directly, use read_sys_metadata_read() instead. */
> #define __read_sys_metadata_field(_field_id, _valptr)   \
> ({                                                      \
>         u64 ___tmp;                                     \
>         int ___ret;                                     \
>                                                         \
>         ___ret = tdh_sys_rd(_field_id, &___tmp);        \
>         *_valptr = ___tmp;                              \
>                                                         \
>         ___ret;                                         \
> })
> 
> /* @_valptr must be pointer of u8/u16/u32/u64. */
> #define read_sys_metadata_field(_field_id, _valptr)     \
> ({                                                      \
>         BUILD_BUG_ON(MD_FIELD_ELE_SIZE(_field_id) !=    \
>                         sizeof(*_valptr));              \
>         __read_sys_metadata_field(_field_id, _valptr);  \
> })
> 
> Does this look good to you?

Hi Dave,

Would you let me know are you OK with this?

If not, I will revert back to what you suggested:

https://lore.kernel.org/lkml/cover.1727173372.git.kai.huang@intel.com/T/#m3874080ef158a4704c4082259d3594aa0a322fc8

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ