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] [day] [month] [year] [list]
Message-ID: <CH0PR18MB5433D33DA8E0066EB0FEB5D7C6E0A@CH0PR18MB5433.namprd18.prod.outlook.com>
Date: Tue, 7 Oct 2025 20:43:19 +0000
From: "Farber, Eliav" <farbere@...zon.com>
To: David Laight <david.laight.linux@...il.com>, Greg KH
	<gregkh@...uxfoundation.org>
CC: "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
	"peterz@...radead.org" <peterz@...radead.org>, "tglx@...utronix.de"
	<tglx@...utronix.de>, "mingo@...hat.com" <mingo@...hat.com>, "bp@...en8.de"
	<bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>, "hpa@...or.com"
	<hpa@...or.com>, "james.morse@....com" <james.morse@....com>,
	"rric@...nel.org" <rric@...nel.org>, "daniel@...ll.ch" <daniel@...ll.ch>,
	"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
	"mripard@...nel.org" <mripard@...nel.org>, "tzimmermann@...e.de"
	<tzimmermann@...e.de>, "sean@...rly.run" <sean@...rly.run>,
	"jdelvare@...e.com" <jdelvare@...e.com>, "linux@...ck-us.net"
	<linux@...ck-us.net>, "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
	"dmitry.torokhov@...il.com" <dmitry.torokhov@...il.com>, "maz@...nel.org"
	<maz@...nel.org>, "wens@...e.org" <wens@...e.org>, "jernej.skrabec@...il.com"
	<jernej.skrabec@...il.com>, "agk@...hat.com" <agk@...hat.com>,
	"snitzer@...hat.com" <snitzer@...hat.com>, "dm-devel@...hat.com"
	<dm-devel@...hat.com>, "davem@...emloft.net" <davem@...emloft.net>,
	"kuba@...nel.org" <kuba@...nel.org>, "mcoquelin.stm32@...il.com"
	<mcoquelin.stm32@...il.com>, "krzysztof.kozlowski@...onical.com"
	<krzysztof.kozlowski@...onical.com>, "malattia@...ux.it" <malattia@...ux.it>,
	"hdegoede@...hat.com" <hdegoede@...hat.com>, "mgross@...ux.intel.com"
	<mgross@...ux.intel.com>, "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
	"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
	"sakari.ailus@...ux.intel.com" <sakari.ailus@...ux.intel.com>, "clm@...com"
	<clm@...com>, "josef@...icpanda.com" <josef@...icpanda.com>,
	"dsterba@...e.com" <dsterba@...e.com>, "jack@...e.com" <jack@...e.com>,
	"tytso@....edu" <tytso@....edu>, "adilger.kernel@...ger.ca"
	<adilger.kernel@...ger.ca>, "dushistov@...l.ru" <dushistov@...l.ru>,
	"luc.vanoostenryck@...il.com" <luc.vanoostenryck@...il.com>,
	"rostedt@...dmis.org" <rostedt@...dmis.org>, "pmladek@...e.com"
	<pmladek@...e.com>, "senozhatsky@...omium.org" <senozhatsky@...omium.org>,
	"andriy.shevchenko@...ux.intel.com" <andriy.shevchenko@...ux.intel.com>,
	"linux@...musvillemoes.dk" <linux@...musvillemoes.dk>, "minchan@...nel.org"
	<minchan@...nel.org>, "ngupta@...are.org" <ngupta@...are.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"yoshfuji@...ux-ipv6.org" <yoshfuji@...ux-ipv6.org>, "dsahern@...nel.org"
	<dsahern@...nel.org>, "pablo@...filter.org" <pablo@...filter.org>,
	"kadlec@...filter.org" <kadlec@...filter.org>, "fw@...len.de" <fw@...len.de>,
	"jmaloy@...hat.com" <jmaloy@...hat.com>, "ying.xue@...driver.com"
	<ying.xue@...driver.com>, "shuah@...nel.org" <shuah@...nel.org>,
	"willy@...radead.org" <willy@...radead.org>, "sashal@...nel.org"
	<sashal@...nel.org>, "quic_akhilpo@...cinc.com" <quic_akhilpo@...cinc.com>,
	"ruanjinjie@...wei.com" <ruanjinjie@...wei.com>, "David.Laight@...lab.com"
	<David.Laight@...lab.com>, "herve.codina@...tlin.com"
	<herve.codina@...tlin.com>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-um@...ts.infradead.org"
	<linux-um@...ts.infradead.org>, "linux-edac@...r.kernel.org"
	<linux-edac@...r.kernel.org>, "amd-gfx@...ts.freedesktop.org"
	<amd-gfx@...ts.freedesktop.org>, "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>, "linux-arm-msm@...r.kernel.org"
	<linux-arm-msm@...r.kernel.org>, "freedreno@...ts.freedesktop.org"
	<freedreno@...ts.freedesktop.org>, "linux-hwmon@...r.kernel.org"
	<linux-hwmon@...r.kernel.org>, "linux-input@...r.kernel.org"
	<linux-input@...r.kernel.org>, "linux-sunxi@...ts.linux.dev"
	<linux-sunxi@...ts.linux.dev>, "linux-media@...r.kernel.org"
	<linux-media@...r.kernel.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-stm32@...md-mailman.stormreply.com"
	<linux-stm32@...md-mailman.stormreply.com>,
	"platform-driver-x86@...r.kernel.org" <platform-driver-x86@...r.kernel.org>,
	"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
	"linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
	"linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>,
	"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
	"linux-sparse@...r.kernel.org" <linux-sparse@...r.kernel.org>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>, "netfilter-devel@...r.kernel.org"
	<netfilter-devel@...r.kernel.org>, "coreteam@...filter.org"
	<coreteam@...filter.org>, "tipc-discussion@...ts.sourceforge.net"
	<tipc-discussion@...ts.sourceforge.net>, "linux-kselftest@...r.kernel.org"
	<linux-kselftest@...r.kernel.org>, "stable@...r.kernel.org"
	<stable@...r.kernel.org>, Linus Torvalds <torvalds@...ux-foundation.org>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Subject: RE: [PATCH v2 07/19 5.15.y] minmax: simplify and clarify
 min_t()/max_t() implementation

> On Mon, 6 Oct 2025 12:47:45 +0200
> Greg KH <gregkh@...uxfoundation.org> wrote:
>
> (I've had to trim the 'To' list to send this...)
>
> > On Fri, Oct 03, 2025 at 12:59:54PM +0000, Eliav Farber wrote:
> > > From: Linus Torvalds <torvalds@...ux-foundation.org>
> > >
> > > [ Upstream commit 017fa3e89187848fd056af757769c9e66ac3e93d ]
> > >
> > > This simplifies the min_t() and max_t() macros by no longer making 
> > > them work in the context of a C constant expression.
> > >
> > > That means that you can no longer use them for static initializers 
> > > or for array sizes in type definitions, but there were only a couple 
> > > of such uses, and all of them were converted (famous last words) to 
> > > use MIN_T/MAX_T instead.
> > >
> > > Cc: David Laight <David.Laight@...lab.com>
> > > Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> > > Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
> > > Signed-off-by: Eliav Farber <farbere@...zon.com>
> >
> > Eliav, your testing infrastructure needs some work, this patch breaks 
> > the build on this kernel tree:
> >
> > In file included from ./include/linux/kernel.h:16,
> >                  from ./include/linux/list.h:9,
> >                  from ./include/linux/wait.h:7,
> >                  from ./include/linux/wait_bit.h:8,
> >                  from ./include/linux/fs.h:6,
> >                  from fs/erofs/internal.h:10,
> >                  from fs/erofs/zdata.h:9,
> >                  from fs/erofs/zdata.c:6:
> > fs/erofs/zdata.c: In function ‘z_erofs_decompress_pcluster’:
> > fs/erofs/zdata.h:185:61: error: ISO C90 forbids variable length array ‘pages_onstack’ [-Werror=vla]
> >   185 |         min_t(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U)
> >       |                                                             ^~~~
>
> That constant seems to get (renamed and) changed to 32 in a later patch.
> I'm not sure of the rational for the min() at all.
> I think THREAD_SIZE is the size of the kernel stack? Or at least related to it.
> The default seems to be 8k on x86-64 and 4k or 8k on i386.
> So it is pretty much always going to be 96.
>
> Linus added MIN() that can be used for array sizes.
> But I'd guess this could just be changed to 32 - need to ask the erofs guys.

Changing the definition of Z_EROFS_VMAP_ONSTACK_PAGES to use
  MIN_T(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U)
instead of
  min_t(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U).
fixes the build failure.

This aligns with the change made in upstream commit
4477b39c32fd("minmax: add a few more MIN_T/MAX_T users"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4477b39c32fdc03363affef4b11d48391e6dc9ff

---
Regards, Eliav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ