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: <20190801230320.GA3711@rikard>
Date:   Fri, 2 Aug 2019 01:03:20 +0200
From:   Rikard Falkeborn <rikard.falkeborn@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Rikard Falkeborn <rikard.falkeborn@...il.com>,
        akpm@...ux-foundation.org, johannes@...solutions.net,
        linux-kernel@...r.kernel.org,
        "yamada.masahiro@...ionext.comhange-folder>?" 
        <toggle-mailboxes@...ard>
Subject: Re: [PATCH] linux/bits.h: Add compile time sanity check of GENMASK
 inputs

On Wed, Jul 31, 2019 at 12:27:38PM -0700, Joe Perches wrote:
> On Wed, 2019-07-31 at 21:03 +0200, Rikard Falkeborn wrote:
> > GENMASK() and GENMASK_ULL() are supposed to be called with the high bit
> > as the first argument and the low bit as the second argument. Mixing
> > them will return a mask with zero bits set.
> 
> A few things:
> 
> o Reading the final code is a bit confusing.
>   Perhaps add a comment description saying it's not checked
>   in asm .h uses.

Comment added.
 
> o Maybe use:
>   #define GENMASK_INPUT_CHECK(h, l) UL(0)

Sure.
 
> o The compiler error message when the arguments are in the
>   wrong order isn't obvious.  Is there some way to improve
>   the compiler error output, maybe by using BUILD_BUG_ON_MSG
>   or some other mechanism?

Not that I could find. BUILD_BUG_ON_MSG can not be used if the macros
should be usable in e.g. a structure initializer (this seems to be the
whole reason BUILD_BUG_ON_ZERO exists).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ