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: <CAK8P3a1zWTj=Q6T0mSBYnk4qVMQfua1ZZTyAvfiZXpufkb_Hbw@mail.gmail.com>
Date:   Mon, 26 Oct 2020 17:31:45 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Mark Rutland <mark.rutland@....com>
Cc:     Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Christoffer Dall <christoffer.dall@...aro.org>,
        Marc Zyngier <marc.zyngier@....com>,
        Peter Maydell <peter.maydell@...aro.org>,
        Will Deacon <will.deacon@....com>,
        Dave Martin <Dave.Martin@....com>,
        Mark Brown <broonie@...nel.org>,
        Dmitry Safonov <0x7f454c46@...il.com>,
        James Morse <james.morse@....com>,
        Amit Daniel Kachhap <amit.kachhap@....com>,
        Gavin Shan <gshan@...hat.com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] arm64: traps: fix -Woverride-init warnings

On Mon, Oct 26, 2020 at 5:23 PM Mark Rutland <mark.rutland@....com> wrote:
> On Mon, Oct 26, 2020 at 05:03:31PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > There are many warnings in this file when we re-enable the
> > Woverride-init flag:
> >
> > arch/arm64/kernel/traps.c:704:26: warning: initialized field overwritten [-Woverride-init]
> >   704 |  [ESR_ELx_EC_UNKNOWN]  = "Unknown/Uncategorized",
> >       |                          ^~~~~~~~~~~~~~~~~~~~~~~
> > arch/arm64/kernel/traps.c:704:26: note: (near initialization for 'esr_class_str[0]')
> > arch/arm64/kernel/traps.c:705:22: warning: initialized field overwritten [-Woverride-init]
> >   705 |  [ESR_ELx_EC_WFx]  = "WFI/WFE",
> >       |                      ^~~~~~~~~
> >
> > This is harmless since they are only informational strings,
> > but it's easy to change the code to ignore missing initialization
> > and instead warn about possible duplicate initializers.
>
> This has come up before, and IMO the warning is more hindrance than
> helpful, given the prevalance of spurious warnings, and the (again IMO)
> the rework needed to avoid those making the code harder to reason about.
>
> We use this pattern all througout the kernel (e.g. in the syscall
> wrappers), so unless the plan is to avoid this everywhere, I don't think
> that we should alter individual cases.

I have patches for all instances, yes.

> I also don't think that the Fixes tag is appropriate given the code is correct.

I tend to add fixes tags even for false-positive warnings, as they
are helpful whenever someone tries to backport the warning
suppression patch to older kernels. That could easily be dropped
here of course.

> Could we instead convince the compiler folk to give us better tools to
> deal with this? For example, if we could annotate assignmments as
> overridable or being an override, it'd be possible to distinguish the
> benign cases from bad ones, without forcing us to have dynamic checks.

There are only a handful of instances that need this, and half of these
are in arch/arm64/. I have another patch that disables the warning
locally in arch/arm64/kernel/{perf_event,sys,sys32}.c and
arch/arm64/kvm/handle_exit.c, but this needs some extra
infrastructure to make it possible to disable it for both gcc
and clang (which use different warning flags for it), so I did not
include the patch in this series.

I had also considered disabling the two warning flags for the
entire arch/arm64/kernel/ directory, but that seemed wrong
after I noticed the cpu_errata.c warnings that are indeed suspicious
and could lead to bugs when additional changes are made to
that file.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ