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:   Tue, 14 Sep 2021 09:04:43 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Joe Perches <joe@...ches.com>, Arnd Bergmann <arnd@...nel.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>, llvm@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/10] compiler.h: drop fallback overflow checkers

On 9/14/2021 8:33 AM, Nick Desaulniers wrote:
> On Fri, Sep 10, 2021 at 5:04 PM Nathan Chancellor <nathan@...nel.org> wrote:
>>
>> On Fri, Sep 10, 2021 at 04:40:39PM -0700, Nick Desaulniers wrote:
>>> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
>>> index 0f12345c21fb..4669632bd72b 100644
>>> --- a/include/linux/overflow.h
>>> +++ b/include/linux/overflow.h
>>> @@ -6,12 +6,9 @@
>>>   #include <linux/limits.h>
>>>
>>>   /*
>>> - * In the fallback code below, we need to compute the minimum and
>>> - * maximum values representable in a given type. These macros may also
>>> - * be useful elsewhere, so we provide them outside the
>>> - * COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW block.
>>> - *
>>> - * It would seem more obvious to do something like
>>> + * We need to compute the minimum and maximum values representable in a given
>>> + * type. These macros may also be useful elsewhere. It would seem more obvious
>>> + * to do something like:
>>>    *
>>>    * #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0)
>>>    * #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0)
>>
>> The signed and type macros right below this comment can be removed as
>> they were only used in the !COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW case.
> 
> Did you check for users outside of this header?
> 
> I see:
> type_min ->
> lib/test_scanf.c:189
> include/rdma/uverbs_ioctl.h:951
> include/rdma/uverbs_ioctl.h:973
> 
> type_max ->
> lib/test_scanf.c:189
> lib/test_scanf.c:190
> include/rdma/uverbs_ioctl.h:952
> include/rdma/uverbs_ioctl.h:962
> include/rdma/uverbs_ioctl.h:974
> include/rdma/uverbs_ioctl.h:985
> 
> is_signed_type has many many users throughout the kernel.
> 
> Or were you referring to other defines?

Ah, I did not even think to look outside this file, I figured they were 
intended to only be used here :/ good catch.

>>
>> Also applies to the tools/ version.
> 
> The version in tools/ should probably be "refreshed" ie. copy+pasted
> over.  Why there is a separate copy under tools/...
> 

Yes, they probably should, as I noted in commit d0ee23f9d78b ("tools: 
compiler-gcc.h: Guard error attribute use with __has_attribute"). At the 
same time, I don't really want to do it :)

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ