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: <74a88c3df6e51ab8dd92fdd147e4282bfa73615b.camel@intel.com>
Date: Tue, 1 Oct 2024 21:40:56 +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>, "kirill.shutemov@...ux.intel.com"
	<kirill.shutemov@...ux.intel.com>, "Williams, Dan J"
	<dan.j.williams@...el.com>, "pbonzini@...hat.com" <pbonzini@...hat.com>,
	"tglx@...utronix.de" <tglx@...utronix.de>
CC: "Yamahata, Isaku" <isaku.yamahata@...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>, "Edgecombe, Rick P"
	<rick.p.edgecombe@...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 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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ