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: <CAPAsAGwTxU7SjK2o7ohdZxeFF5j_7UF-TUyXmOzndE8Z177kzw@mail.gmail.com>
Date:   Mon, 16 Jan 2017 16:09:45 +0300
From:   Andrey Ryabinin <ryabinin.a.a@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Anton Blanchard <anton@...ba.org>, behanw@...verseincode.com,
        kernel test robot <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Segher Boessenkool <segher@...nel.crashing.org>,
        Ingo Molnar <mingo@...e.hu>,
        LKML <linux-kernel@...r.kernel.org>,
        linuxppc-dev@...ts.ozlabs.org
Subject: Re: llist code relies on undefined behaviour, upsets llvm/clang

2017-01-16 15:53 GMT+03:00 Peter Zijlstra <peterz@...radead.org>:
> On Mon, Jan 16, 2017 at 10:42:29PM +1100, Anton Blanchard wrote:
>> Hi Peter,
>>
>> > Last I checked I couldn't build a x86_64 kernel with llvm. So no, not
>> > something I've ever ran into.
>> >
>> > Also, I would argue that this is broken in llvm, the kernel very much
>> > relies on things like this all over the place. Sure, we're way outside
>> > of what the C language spec says, but who bloody cares ;-)
>>
>> True, but is there anything preventing gcc from implementing this
>> optimisation in the future? If we are relying on undefined behaviour we
>> should have a -fno-strict-* option to cover it.
>>
>> > If llvm wants to compile the kernel, it needs to learn the C dialect
>> > the kernel uses.
>>
>> LLVM has done that before (eg adding -fno-strict-overflow). I don't
>> think that option covers this case however.
>
> Our comment there states:
>
> # disable invalid "can't wrap" optimizations for signed / pointers
> KBUILD_CFLAGS   += $(call cc-option,-fno-strict-overflow)
>
> So this option should apply to pointer arithmetic, therefore I would
> expect -fno-strict-overflow to actually apply here, or am I missing
> something?

That case is null pointer check optimization.  '->member' has non-zero
offset in struct, so LLVM assumes that pos->member != NULL
and optimize away this check.
LLVM/clang currently doesn't have -fno-delete-null-pointer-checks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ