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: <CAKv+Gu9a=W6Fg+ai_W-HB1gL5oUg=FKcGdLk_15CdbHLWt6gMg@mail.gmail.com>
Date:   Sat, 9 Feb 2019 12:25:42 +0100
From:   Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:     Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Laura Abbott <labbott@...hat.com>,
        Arnd Bergmann <arnd@...db.de>,
        Martin Sebor <msebor@....gnu.org>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Jessica Yu <jeyu@...nel.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        James Morris <james.morris@...rosoft.com>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Borislav Petkov <bp@...e.de>, Matt Mullins <mmullins@...com>,
        Vincent Whitchurch <vincent.whitchurch@...s.com>,
        WANG Chao <chao.wang@...oud.cn>
Subject: Re: [PATCH 0/3] Clean the new GCC 9 -Wmissing-attributes warnings

On Sat, 9 Feb 2019 at 12:19, Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> On Sat, Feb 9, 2019 at 11:44 AM Ard Biesheuvel
> <ard.biesheuvel@...aro.org> wrote:
> >
> > On Sat, 9 Feb 2019 at 01:09, Miguel Ojeda
> > <miguel.ojeda.sandonis@...il.com> wrote:
> > >
> > > The upcoming GCC 9 release extends the -Wmissing-attributes warnings
> > > (enabled by -Wall) to C and aliases: it warns when particular function
> > > attributes are missing in the aliases but not in their target, e.g.:
> > >
> > >     void __cold f(void) {}
> >
> > Apologies if I missed any discussions on this topic, but I would argue
> > that 'cold' is not an attribute that has to be applied to the function
> > pointer as well as each of its targets, since it basically decides the
> > placement in the binary, and it doesn't affect the nature of the code
> > being referenced.
>
> It also affects the optimizer in two different ways AFAIK:
>
>   * For the function itself, it gets optimized for size instead of speed.
>   * For callers, the paths that lead to the calls are treated as unlikely.
>

That seems reasonable, but that still does not mean it is necessarily
a problem if you apply 'cold' to one but not the other.

So to me, it makes perfect sense to permit 'cold' on the target, but
not on the function pointer itself, in which case you get 1) but not
2)

> So GCC reports it because you would be (likely) missing the
> optimizations you expected if you are using the alias instead of the
> target.
>

I see how that could be reasonable for extern declarations that do not
match the definition, since in that case, it is assumed that there is
only one instance of the function. For function pointers, I don't
think this assumption is valid.

> In our case in patch 3, we do not want the optimization for callers,
> which is why we don't mark the extern declaration as __cold (see the
> commit message).
>

You did not cc me on the whole set, so I don't have the patch. But in
any case, GCC 9 has not been released so we should still have time to
talk sense into the GCC guys.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ