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: <73b375c3-97a7-5f25-5abf-48d9ec6be2db@linux.intel.com>
Date:   Mon, 29 Aug 2022 13:09:36 -0700
From:   Sathyanarayanan Kuppuswamy 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Dave Hansen <dave.hansen@...el.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        Shuah Khan <shuah@...nel.org>,
        "H . Peter Anvin" <hpa@...or.com>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Tony Luck <tony.luck@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Kai Huang <kai.huang@...el.com>,
        Wander Lairson Costa <wander@...hat.com>,
        Isaku Yamahata <isaku.yamahata@...il.com>,
        marcelo.cerri@...onical.com, tim.gardner@...onical.com,
        khalid.elmously@...onical.com, philip.cox@...onical.com,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-doc@...r.kernel.org
Subject: Re: [PATCH v11 1/3] x86/tdx: Add TDX Guest attestation interface
 driver

Hi,

On 8/28/22 10:30 PM, Greg Kroah-Hartman wrote:
>> struct tdx_report_req {
>>         __u64 reportdata;;
>>         __u64 tdreport;
>>         __u32 rpd_len
>>         __u32 tdr_len;
>>         __u8 subtype;
>> };
> That's better, but again, please use pahole.

Following are the pahole dump of both formats.

With previous format, compiler adds 11 bytes in holes and 4 bytes of
padding.

Total size of struct is 40 bytes.

struct tdx_report_req {
	__u8                       subtype;              /*     0     1 */

	/* XXX 7 bytes hole, try to pack */

	__u64                      reportdata;           /*     8     8 */
	__u32                      rpd_len;              /*    16     4 */

	/* XXX 4 bytes hole, try to pack */

	__u64                      tdreport;             /*    24     8 */
	__u32                      tdr_len;              /*    32     4 */

	/* size: 40, cachelines: 1, members: 5 */
	/* sum members: 25, holes: 2, sum holes: 11 */
	/* padding: 4 */
	/* last cacheline: 40 bytes */
};

With the changed format, we avoided the holes, but it still adds 7 bytes of padding.

Total size of struct is 32 bytes.

struct tdx_report_req {
	__u64                      reportdata;           /*     0     8 */
	__u64                      tdreport;             /*     8     8 */
	__u32                      rpd_len;              /*    16     4 */
	__u32                      tdr_len;              /*    20     4 */
	__u8                       subtype;              /*    24     1 */

	/* size: 32, cachelines: 1, members: 5 */
	/* padding: 7 */
	/* last cacheline: 32 bytes */
};



-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ