From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1hE53o-0002PR-Su for mharc-grub-devel@gnu.org; Wed, 10 Apr 2019 00:42:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hE53m-0002PK-JB for grub-devel@gnu.org; Wed, 10 Apr 2019 00:42:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hE53l-0001dO-3L for grub-devel@gnu.org; Wed, 10 Apr 2019 00:42:06 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:60889) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hE53k-0001aw-NG for grub-devel@gnu.org; Wed, 10 Apr 2019 00:42:05 -0400 Received: from mazu (prva10-snat226-2.provo.novell.com [137.65.226.36]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Tue, 09 Apr 2019 22:41:54 -0600 Date: Wed, 10 Apr 2019 12:41:50 +0800 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH 0/8] fix gcc9 build with -Werror=address-of-packed-member Message-ID: <20190410044150.GA2352@mazu> Mail-Followup-To: The development of GNU GRUB References: <20190409104659.4125-1-mchang@suse.com> <20190409113952.GA5098@mercury> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2019 04:42:07 -0000 On Tue, Apr 09, 2019 at 10:15:33PM +1000, Vladimir 'phcoder' Serbinenko wrote: > On Tue, Apr 9, 2019 at 9:40 PM Michael Chang wrote: > > > > On Tue, Apr 09, 2019 at 08:57:25PM +1000, Vladimir 'phcoder' Serbinenko wrote: > > > On Tue, Apr 9, 2019 at 8:48 PM Michael Chang wrote: > > > > > > > > This patch set attempts to resolve the build failure in openSUSE build > > > > service equipped with new gcc 9 compiler, which has added a new warning > > > > flag -Waddress-of-packed-member. > > > > > > > > The new warning performs the check for taking the address of packed > > > > member directly to a pointer variable with higher alignment requirement > > > > and the outcome is risky to memory alignment fault on some architecture > > > > when deferencing it. > > > The problem here is that there is no way to tell the compiler to > > > create a structure without padding but a pointer to which is aligned. > > > This is very common in GRUB. Consider a struct like following: > > > grub_uint16_t a; > > > grub_uint32_t b; > > > grub_uint16_t c[40]; > > > > > > This needs packed attribute as otherwise compiler will insert a > > > padding before b. Yet c is guaranteed to be aligned if the pointer to > > > the structure is aligned. > > > > But sometimes it is not easy to know as the packed structure could be > > embedded to another and also it could map to a specific portion in > > memory read from a file, with no guarantee where will be started (for eg > > via searching occurrence of specific magic number ..) > Yes. It's not easy. But that's why just following warnings isn't > always the good way to go [without going into specific details for > particular patches]. OK. Point taken. I'll go through the pathes again and ignore the warnings if the diagnostic is found to be false positive. Thanks, Michael > > > > Thanks, > > Michael > > > > > > > > > > Please help to review. > > > > > > > > Thanks. > > > > > > > > Michael Chang (8): > > > > cpio: fix gcc9 error address-of-packed-member > > > > jfs: fix gcc9 error address-of-packed-member > > > > hfs: fix gcc9 error address-of-packed-member > > > > hfsplus: fix gcc9 error address-of-packed-member > > > > acpi: fix gcc9 error address-of-packed-member > > > > usbtest: fix gcc9 error address-of-packed-member > > > > chainloader: fix gcc9 error address-of-packed-member > > > > efi: fix gcc9 error address-of-packed-member > > > > > > > > grub-core/commands/usbtest.c | 13 ++++++++- > > > > grub-core/fs/cpio.c | 5 ++-- > > > > grub-core/fs/cpio_be.c | 5 ++-- > > > > grub-core/fs/hfsplus.c | 57 ++++++++++++++++++++++++++------------ > > > > grub-core/fs/jfs.c | 5 ++-- > > > > grub-core/kern/efi/efi.c | 27 ++++++++++++++++-- > > > > grub-core/loader/efi/chainloader.c | 12 ++++++-- > > > > include/grub/acpi.h | 2 +- > > > > include/grub/hfs.h | 2 +- > > > > 9 files changed, 96 insertions(+), 32 deletions(-) > > > > > > > > -- > > > > 2.16.4 > > > > > > > > > > > > _______________________________________________ > > > > Grub-devel mailing list > > > > Grub-devel@gnu.org > > > > https://lists.gnu.org/mailman/listinfo/grub-devel > > > > > > > > > > > > -- > > > Regards > > > Vladimir 'phcoder' Serbinenko > > > > > > _______________________________________________ > > > Grub-devel mailing list > > > Grub-devel@gnu.org > > > https://lists.gnu.org/mailman/listinfo/grub-devel > > > > > > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > https://lists.gnu.org/mailman/listinfo/grub-devel > > > > -- > Regards > Vladimir 'phcoder' Serbinenko > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel