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]
Date:   Sat, 9 Feb 2019 11:44:09 +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 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.

Permitting a function pointer to point to 'cold' functions only if it
is annotated as 'cold' itself makes no sense whatsoever, and there
could be valid cases where a function pointer may point at either cold
or non-cold functions.

For other attributes, the situation is clearly different, e.g., a
__pure function pointer to a non-pure function is obviously a bug,
since the compiler could make assumptions based on the function
pointer type that do not hold for the function it points to at
runtime.

I don't see how the 'cold' attribute could have any such effect, so I
wonder if it isn't simply a bug that we have to report to GCC?



>     void __alias("f") g(void);
>
> diagnoses:
>
>     warning: 'g' specifies less restrictive attribute than
>     its target 'f': 'cold' [-Wmissing-attributes]
>
> These patch series clean these new warnings. Most of them are caused
> by the module_init/exit macros.
>
> The first patch has been in -next for a long time already, and an alternative
> solution (only __cold) for module.h as well. However, since we decided
> to go with the new __copy attribute, I will leave the series for a few days
> again and send the PR for -rc7.
>
> Link: https://lore.kernel.org/lkml/20190125104353.2791-1-labbott@redhat.com/
>
> Miguel Ojeda (3):
>   lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
>   Compiler Attributes: add support for __copy (gcc >= 9)
>   include/linux/module.h: copy __init/__exit attrs to
>     init/cleanup_module
>
>  include/linux/compiler_attributes.h | 14 ++++++++++++++
>  include/linux/module.h              |  4 ++--
>  lib/crc32.c                         |  4 ++--
>  3 files changed, 18 insertions(+), 4 deletions(-)
>
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ