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: <3ec15b41754b01666d94b76ce51b9832c2dd577a.camel@perches.com>
Date:   Wed, 21 Oct 2020 11:35:23 -0700
From:   Joe Perches <joe@...ches.com>
To:     Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        lukas.bulwahn@...il.com,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        dwaipayanray1@...il.com, Aditya <yashsri421@...il.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Jakub Jelinek <jakub@...hat.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        kernel test robot <lkp@...el.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
        LKP <lkp@...ts.01.org>, Kees Cook <keescook@...omium.org>,
        "H.J. Lu" <hjl.tools@...il.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        linux-toolchains@...r.kernel.org
Subject: Re: GCC section alignment, and GCC-4.9 being a weird one

(adding cc's of kernel-mentees and a few checkpatch contributors)

On Wed, 2020-10-21 at 19:54 +0200, Miguel Ojeda wrote:
> On Wed, Oct 21, 2020 at 7:42 PM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> > If you used some of the macros from
> > include/linux/compiler_attributes.h like __section and __aligned, I
> > would prefer it.  Please consider spelling out __attribute__(()) an
> > antipattern.
> 
> +1, the shorthands should be used unless there is a reason not to (and
> please write the reason in a comment in that case).

Perhaps something to add as a generic test in checkpatch.

Right now it checks separately for each __attribute__
use with any of aligned, section, printf and scanf.

Likely it should include more of the #defines from
include/linux/compiler_attributes.h.

include/linux/compiler_attributes.h:#define __alias(symbol)                 __attribute__((__alias__(#symbol)))
include/linux/compiler_attributes.h:#define __aligned(x)                    __attribute__((__aligned__(x)))
include/linux/compiler_attributes.h:#define __aligned_largest               __attribute__((__aligned__))
include/linux/compiler_attributes.h:#define __always_inline                 inline __attribute__((__always_inline__))
include/linux/compiler_attributes.h:# define __assume_aligned(a, ...)       __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
include/linux/compiler_attributes.h:#define __cold                          __attribute__((__cold__))
include/linux/compiler_attributes.h:#define __attribute_const__             __attribute__((__const__))
include/linux/compiler_attributes.h:# define __copy(symbol)                 __attribute__((__copy__(symbol)))
include/linux/compiler_attributes.h:# define __designated_init              __attribute__((__designated_init__))
include/linux/compiler_attributes.h:# define __visible                      __attribute__((__externally_visible__))
include/linux/compiler_attributes.h:#define __printf(a, b)                  __attribute__((__format__(printf, a, b)))
include/linux/compiler_attributes.h:#define __scanf(a, b)                   __attribute__((__format__(scanf, a, b)))
include/linux/compiler_attributes.h:#define __gnu_inline                    __attribute__((__gnu_inline__))
include/linux/compiler_attributes.h:#define __malloc                        __attribute__((__malloc__))
include/linux/compiler_attributes.h:#define __mode(x)                       __attribute__((__mode__(x)))
include/linux/compiler_attributes.h:# define __no_caller_saved_registers        __attribute__((__no_caller_saved_registers__))
include/linux/compiler_attributes.h:# define __noclone                      __attribute__((__noclone__))
include/linux/compiler_attributes.h:# define fallthrough                    __attribute__((__fallthrough__))
include/linux/compiler_attributes.h:#define   noinline                      __attribute__((__noinline__))
include/linux/compiler_attributes.h:# define __nonstring                    __attribute__((__nonstring__))
include/linux/compiler_attributes.h:#define __noreturn                      __attribute__((__noreturn__))
include/linux/compiler_attributes.h:#define __packed                        __attribute__((__packed__))
include/linux/compiler_attributes.h:#define __pure                          __attribute__((__pure__))
include/linux/compiler_attributes.h:#define __section(S)                    __attribute__((__section__(#S)))
include/linux/compiler_attributes.h:#define __always_unused                 __attribute__((__unused__))
include/linux/compiler_attributes.h:#define __maybe_unused                  __attribute__((__unused__))
include/linux/compiler_attributes.h:#define __used                          __attribute__((__used__))
include/linux/compiler_attributes.h:#define __weak                          __attribute__((__weak__))


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ