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: <cc72d070-4225-4256-9745-320b7bb669d8@lucifer.local>
Date: Mon, 1 Sep 2025 16:55:25 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: David Hildenbrand <david@...hat.com>
Cc: Vlastimil Babka <vbabka@...e.cz>,
        Max Kellermann <max.kellermann@...os.com>, akpm@...ux-foundation.org,
        axelrasmussen@...gle.com, yuanchu@...gle.com, willy@...radead.org,
        hughd@...gle.com, mhocko@...e.com, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, Liam.Howlett@...cle.com, rppt@...nel.org,
        surenb@...gle.com, vishal.moola@...il.com, linux@...linux.org.uk,
        James.Bottomley@...senpartnership.com, deller@....de,
        agordeev@...ux.ibm.com, gerald.schaefer@...ux.ibm.com,
        hca@...ux.ibm.com, gor@...ux.ibm.com, borntraeger@...ux.ibm.com,
        svens@...ux.ibm.com, davem@...emloft.net, andreas@...sler.com,
        dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
        hpa@...or.com, chris@...kel.net, jcmvbkbc@...il.com,
        viro@...iv.linux.org.uk, brauner@...nel.org, jack@...e.cz,
        weixugc@...gle.com, baolin.wang@...ux.alibaba.com, rientjes@...gle.com,
        shakeel.butt@...ux.dev, thuth@...hat.com, broonie@...nel.org,
        osalvador@...e.de, jfalempe@...hat.com, mpe@...erman.id.au,
        nysal@...ux.ibm.com, linux-arm-kernel@...ts.infradead.org,
        linux-parisc@...r.kernel.org, linux-s390@...r.kernel.org,
        sparclinux@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v5 02/12] mm: constify pagemap related test functions for
 improved const-correctness

On Mon, Sep 01, 2025 at 05:52:47PM +0200, David Hildenbrand wrote:
> On 01.09.25 17:47, Vlastimil Babka wrote:
> > On 9/1/25 17:14, Lorenzo Stoakes wrote:
> > > On Mon, Sep 01, 2025 at 04:50:50PM +0200, Max Kellermann wrote:
> > > > On Mon, Sep 1, 2025 at 4:25 PM Lorenzo Stoakes
> > > > <lorenzo.stoakes@...cle.com> wrote:
> > > > > 1. (most useful) Const pointer (const <type> *<param>) means that the dereffed
> > > > >     value is const, so *<param> = <val> or <param>-><field> = <val> are prohibited.
> > > >
> > > > Only this was what my initial patch was about.
> > >
> > > Right agreed then.
> > >
> > > >
> > > > > 2. (less useful) We can't modify the actual pointer value either, so
> > > > >     e.g. <param> = <new param> is prohibited.
> > > >
> > > > This wasn't my idea, it was Andrew Morton's idea, supported by Yuanchu Xie:
> > > >   https://lore.kernel.org/lkml/CAJj2-QHVC0QW_4X95LLAnM=1g6apH==-OXZu65SVeBj0tSUcBg@mail.gmail.com/
> > >
> > > Andrew said:
> > >
> > > "Not that I'm suggesting that someone go in and make this change."
> > >
> > > And Yuanchu said:
> > >
> > > "Longer function readability would benefit from that, but it's IMO infeasible to
> > > do so everywhere."
> > >
> > > (he also mentions it'd be good if gcc could wran on it).
> > >
> > > So this isn't quite true actually.
> >
> > I understood it the same, that it would be nice if gcc treated incoming
> > params (i.e. pointers, not pointed-to values) as const and warn otherwise,
> > but not suggesting we should start doing that manually.
> >
> > I personally agree that adding those extra "const" is of little value and
> > makes the function definition lines longer and harder to read and so would
> > rather not add those.
> >
> > I mean we could first collectively decide (and that's not a review
> > half-suggesting we do them) that we want them, and document that, but AFAIK
> > that's not the case yet. While there's already an agreement that const
> > pointed-to values is a good thing and nobody objects that.
>
> Yeah, and discussed elsewhere in this series, it would also have to be
> clarified how to deal with the *const" (or const values in general) with
> function declaration vs. definition. I don't think we really have
> written-down rule for that yet.

For this series the consensus is clear that we should eliminate these and revert
to const pointed-to values (1) only.

We can determine how we do this in future re: const actual pointers (2), but
this series isn't the place.

So Max - can you respin with the (2) const-ification removed please.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ