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: <230e4cc785ff49a38c028474dcfc9c36@AcuMS.aculab.com>
Date:   Thu, 30 Jul 2020 16:22:38 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Joerg Roedel' <joro@...tes.org>,
        Paolo Bonzini <pbonzini@...hat.com>
CC:     Sean Christopherson <sean.j.christopherson@...el.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Borislav Petkov <bp@...en8.de>, Joerg Roedel <jroedel@...e.de>
Subject: RE: [PATCH v2 4/4] KVM: SVM: Use __packed shorthand

From: Joerg Roedel
> Sent: 30 July 2020 16:44
> 
> From: Borislav Petkov <bp@...en8.de>
> 
> Use the shorthand to make it more readable.
...
> diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
> index 8744817358bf..6b4b43f68f4b 100644
> --- a/arch/x86/include/asm/svm.h
> +++ b/arch/x86/include/asm/svm.h
> @@ -150,14 +150,14 @@ struct __attribute__ ((__packed__)) vmcb_control_area {
>  #define SVM_NESTED_CTL_NP_ENABLE	BIT(0)
>  #define SVM_NESTED_CTL_SEV_ENABLE	BIT(1)
> 
> -struct __attribute__ ((__packed__)) vmcb_seg {
> +struct vmcb_seg {
>  	u16 selector;
>  	u16 attrib;
>  	u32 limit;
>  	u64 base;
> -};
> +} __packed;

Why are they marked 'packed' at all?
The above has no holes.
So it would only need to be 'packed' if it might exist at
an unaligned address.
That only tends to happed for network messages and compatibility
with old hardware definitions.

While you might want an attribute for 'error if has holes'
if definitely isn't __packed.

For larger structures in can be worth adding a compile-time
assert that the structure is the size of the associated
hardware registers/structure.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ