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: <CAMj1kXG49gt9OpYNDBh+LVSNyAzj71VC8Cb0S=ApcET+Ja7h5Q@mail.gmail.com>
Date:   Thu, 10 Feb 2022 20:29:12 +0100
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Victor Erminpour <victor.erminpour@...cle.com>
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

(cc Kees)

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ