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: <20250918220106.75a8191b@pumpkin>
Date: Thu, 18 Sep 2025 22:01:06 +0100
From: David Laight <david.laight.linux@...il.com>
To: Eliav Farber <farbere@...zon.com>
Cc: <luc.vanoostenryck@...il.com>, <rostedt@...dmis.org>,
 <mingo@...hat.com>, <akpm@...ux-foundation.org>,
 <gregkh@...uxfoundation.org>, <sj@...nel.org>, <David.Laight@...LAB.COM>,
 <Jason@...c4.com>, <andriy.shevchenko@...ux.intel.com>,
 <bvanassche@....org>, <keescook@...omium.org>,
 <linux-sparse@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <jonnyc@...zon.com>, <stable@...r.kernel.org>
Subject: Re: [PATCH 0/7 5.10.y] Cherry pick of minmax.h commits from 5.15.y

On Tue, 16 Sep 2025 21:22:52 +0000
Eliav Farber <farbere@...zon.com> wrote:

> This series backports seven commits from v5.15.y that update minmax.h
> and related code:
> 
>  - ed6e37e30826 ("tracing: Define the is_signed_type() macro once")
>  - 998f03984e25 ("minmax: sanity check constant bounds when clamping")
>  - d470787b25e6 ("minmax: clamp more efficiently by avoiding extra
>    comparison")
>  - 1c2ee5bc9f11 ("minmax: fix header inclusions")
>  - d53b5d862acd ("minmax: allow min()/max()/clamp() if the arguments
>    have the same signedness.")
>  - 7ed91c5560df ("minmax: allow comparisons of 'int' against 'unsigned
>    char/short'")
>  - 22f7794ef5a3 ("minmax: relax check to allow comparison between
>    unsigned arguments and signed constants")

I think you need to pick up the later changes (from Linus) as well.
Without them nested min() and max() can generate very long lines from
the pre-processor (tens of megabytes) that cause very slow and/or
failing compilations on 32bit and other memory-limited systems.

There are a few other changes needed at the same time.
The current min() and max() can't be used in a few places because
they aren't 'constant enough' with constant arguments.

	David


> 
> The main motivation is commit d53b5d862acd, which removes the strict
> type check in min()/max() when both arguments have the same signedness.
> Without this, kernel 5.10 builds can emit warnings that become build
> failures when -Werror is used.
> 
> Additionally, commit ed6e37e30826 from tracing is required as a
> dependency; without it, compilation fails.
> 
> Andy Shevchenko (1):
>   minmax: fix header inclusions
> 
> Bart Van Assche (1):
>   tracing: Define the is_signed_type() macro once
> 
> David Laight (3):
>   minmax: allow min()/max()/clamp() if the arguments have the same
>     signedness.
>   minmax: allow comparisons of 'int' against 'unsigned char/short'
>   minmax: relax check to allow comparison between unsigned arguments and
>     signed constants
> 
> Jason A. Donenfeld (2):
>   minmax: sanity check constant bounds when clamping
>   minmax: clamp more efficiently by avoiding extra comparison
> 
>  include/linux/compiler.h     |  6 +++
>  include/linux/minmax.h       | 89 ++++++++++++++++++++++++++----------
>  include/linux/overflow.h     |  1 -
>  include/linux/trace_events.h |  2 -
>  4 files changed, 70 insertions(+), 28 deletions(-)
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ