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:   Wed, 4 Apr 2018 17:20:14 -0700
From:   Kees Cook <>
To:     Linus Torvalds <>
Cc:     Matthias Kaehlcke <>,
        Arnd Bergmann <>,
        Peter Zijlstra <>,
        Ingo Molnar <>,
        Linux Kernel Mailing List <>,
        Thomas Gleixner <>,
        Andrew Morton <>,
        James Y Knight <>,
        Chandler Carruth <>,
        Stephen Hines <>,
        Nick Desaulniers <>,
        Guenter Roeck <>,
        Greg Hackmann <>,
        Greg Kroah-Hartman <>
Subject: Re: [GIT PULL] x86/build changes for v4.17

On Wed, Apr 4, 2018 at 5:05 PM, Linus Torvalds
<> wrote:
> On Wed, Apr 4, 2018 at 4:31 PM, Matthias Kaehlcke <> wrote:
>> From some experiments it looks like clang, in difference to gcc, does
>> not treat constant values passed as parameters to inline function as
>> constants.
> Yeah, I think gcc used to have those semantics a long time ago too.
> Many of our __builtin_constant_p() uses are indeed just in macros, but
> certainly not all.
> Other examples are found in our "fortified" string functions.
> There a clang build will likely simply miss some of the build-time
> fortification checks, and trigger them at runtime instead.
> Of course, we hopefully don't *have* any build-time failures, because
> gcc will have caught them, so you won't care as long as clang is a
> secondary compiler, but long-term they'd be good.

Yeah, it's used in inline functions in a lot of places. Some quickly
jump out: kmalloc, crypto, bitmaps, networking, uaccess, kvm, etc from
doing a dumb grep as:

git grep -B5 __builtin_constant_p | grep -A5 inline

FWIW, I prefer inline functions over macros just to keep type checking
a some level of sanity when reading build warnings/errors. ;)


Kees Cook
Pixel Security

Powered by blists - more mailing lists