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  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, 1 Sep 2018 00:10:04 +0200
From:   Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Eli Friedman <efriedma@...eaurora.org>,
        Christopher Li <sparse@...isli.org>,
        Kees Cook <keescook@...omium.org>,
        Ingo Molnar <mingo@...nel.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Joe Perches <joe@...ches.com>,
        Dominique Martinet <asmadeus@...ewreck.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH 2/7] Compiler Attributes: use the no-underscores syntax

Hi Ramus,

On Fri, Aug 31, 2018 at 11:49 PM, Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
> On 2018-08-31 19:05, Miguel Ojeda wrote:
>> The attribute syntax optionally allows to surround attribute names
>> with "__" in order to avoid collisions with macros of the same name
>> (see https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html).
>>
>> This homogenizes all attributes to use the syntax without underscores.
>
> At the risk of bikeshedding, why not the other way around, exactly
> because of what you write above? We have convenience macros anyway, so
> those verbose leading/trailing underscores would only be in compiler*.h,
> and some of the attribute names are common words that can appear as
> #defines. E.g. error is defined
> drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c ; if that used a
> BUILD_BUG_ON somewhere, the
>
> #define __compiletime_error(message) __attribute__((error(message)))
>
> would break.

Indeed, if we are afraid of such cases, we should go with the __name__
syntax. I was trying to go first for the "cleanest"/simplest way
first, considering no one should be defining many such macros as
"error" (and in lower case, at that). But indeed, good catch!

Grepping for those in compiler_attributes.h (which, as you point out,
are not all of them) yields:

arch/parisc/boot/compressed/misc.c:#define malloc       malloc_gzip
include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL)
lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL)
include/linux/compiler_types.h:#define noinline_for_stack noinline
include/linux/raid/pq.h:#define noinline __attribute__((noinline))
tools/include/linux/compiler.h:#define noinline
arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1);
                 /* Silence gcc.  */

Cheers,
Miguel

Powered by blists - more mailing lists