[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMj1kXGh_qbZQ+L5syVs8C9Vsf=x5xMr=j-r=8Ep7PuwR0nqEA@mail.gmail.com>
Date: Thu, 10 Feb 2022 20:39:39 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Victor Erminpour <victor.erminpour@...cle.com>,
Kees Cook <keescook@...omium.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Hanjun Guo <guohanjun@...wei.com>,
Sudeep Holla <sudeep.holla@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
trivial@...nel.org, Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH] ACPI/IORT: Fix GCC 12 warning
On Thu, 10 Feb 2022 at 20:29, Ard Biesheuvel <ardb@...nel.org> wrote:
>
> (cc Kees)
>
... for real this time :-)
> On Thu, 10 Feb 2022 at 18:36, Victor Erminpour
> <victor.erminpour@...cle.com> wrote:
> >
> >
> > On 2/10/22 1:11 AM, Ard Biesheuvel wrote:
> > > On Thu, 10 Feb 2022 at 01:34, Victor Erminpour
> > > <victor.erminpour@...cle.com> wrote:
> > >> When building with automatic stack variable initialization, GCC 12
> > >> complains about variables defined outside of switch case statements.
> > >> Move the variable into the case that uses it, which silences the warning:
> > >>
> > >> ./drivers/acpi/arm64/iort.c:1670:59: error: statement will never be executed [-Werror=switch-unreachable]
> > >> 1670 | struct acpi_iort_named_component *ncomp;
> > >> | ^~~~~
> > >>
> > >> Signed-off-by: Victor Erminpour <victor.erminpour@...cle.com>
> > > GCC 12 is not released yet, and this is clearly a compiler bug (a
> > > declaration is not a statement, and the hidden offending statement
> > > [the zero-init] is emitted by the compiler itself), so please report
> > > this to the GCC folks instead.
> >
> > Hi Ard,
> >
> > Thanks for the reply.
> > This fix is similar to the following commits that have been integrated
> > upstream:
> > https://lore.kernel.org/linux-hardening/20211209043456.1377875-1-keescook@chromium.org/
> > https://lore.kernel.org/linux-hardening/20211209043915.1378393-1-keescook@chromium.org/
> >
>
> If GCC 12 rejects valid C with this feature enabled, the compiler is
> broken and needs to be fixed. Papering over this by making changes to
> perfectly valid C code is a slippery slope that we should avoid.
>
> Since GCC 12 is not released yet, there is time to get this fixed properly.
>
> > You're not obligated to integrate this commit,
>
> Why, thank you :-)
>
> > but you may run into this
> > issue once
> > upstream starts using GCC 12 (or a patched version of GCC 11 in my case)
> > with the
> > CONFIG_INIT_STACK_ALL_ZERO option enabled.
> >
>
> Yes, that part was perfectly clear.
Powered by blists - more mailing lists