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: <20250513204031.26f50209@pumpkin>
Date: Tue, 13 May 2025 20:40:31 +0100
From: David Laight <david.laight.linux@...il.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: corbet@....net, workflows@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/9] CodingStyle: recommend static_assert/_Static_assert

On Fri,  9 May 2025 23:34:27 +0300
Alexey Dobriyan <adobriyan@...il.com> wrote:

> Linux's BUG_ON is done backwards (condition is inverted).
> But it is a long story.
> 
> However C11/C23 allow to partially transition to what all normal
> programmers are used to, namely assert().
> 
> Deprecate BUILD_BUG_ON, recommend static_assert/_Static_assert.
> And then some day BUG_ON will be flipped as well.

_Static_assert() is broken by design and only usable for trival tests.
clang also output the entire expansion of the conditional (even when
a message is specified) which can lead to very very very very long lines.

It isn't at all suitable for many of the checks in the kernel.

Look at the signedness test in min() as an example.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ