All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Chang <mchang@suse.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH 0/8] fix gcc9 build with -Werror=address-of-packed-member
Date: Wed, 10 Apr 2019 12:41:50 +0800	[thread overview]
Message-ID: <20190410044150.GA2352@mazu> (raw)
In-Reply-To: <CAEaD8JNVsL5dRrN2+XQQCxpz8FrZYn=4-uK8T+v1UF-xfxPWtQ@mail.gmail.com>

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 <mchang@suse.com> 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 <mchang@suse.com> 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


      reply	other threads:[~2019-04-10  4:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 10:46 [PATCH 0/8] fix gcc9 build with -Werror=address-of-packed-member Michael Chang
2019-04-09 10:46 ` [PATCH 1/8] cpio: fix gcc9 error address-of-packed-member Michael Chang
2019-04-09 10:46 ` [PATCH 2/8] jfs: " Michael Chang
2019-04-09 10:46 ` [PATCH 3/8] hfs: " Michael Chang
2019-04-09 10:46 ` [PATCH 4/8] hfsplus: " Michael Chang
2019-04-09 10:46 ` [PATCH 5/8] acpi: " Michael Chang
2019-04-09 10:46 ` [PATCH 6/8] usbtest: " Michael Chang
2019-04-09 10:46 ` [PATCH 7/8] chainloader: " Michael Chang
2019-04-09 10:46 ` [PATCH 8/8] efi: " Michael Chang
2019-04-09 10:57 ` [PATCH 0/8] fix gcc9 build with -Werror=address-of-packed-member Vladimir 'phcoder' Serbinenko
2019-04-09 11:39   ` Michael Chang
2019-04-09 12:15     ` Vladimir 'phcoder' Serbinenko
2019-04-10  4:41       ` Michael Chang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190410044150.GA2352@mazu \
    --to=mchang@suse.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.