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: <2ca532af-79b4-4f37-8e5a-c99181da88d1@lucifer.local>
Date: Mon, 1 Sep 2025 15:49:39 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: David Hildenbrand <david@...hat.com>
Cc: 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, vbabka@...e.cz,
        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 08/12] mm: constify arch_pick_mmap_layout() for
 improved const-correctness

On Mon, Sep 01, 2025 at 03:58:14PM +0200, David Hildenbrand wrote:
> On 01.09.25 14:30, Max Kellermann wrote:
> > This function only reads from the rlimit pointer (but writes to the
> > mm_struct pointer which is kept without `const`).
> >
> > All callees are already const-ified or (internal functions) are being
> > constified by this patch.
> >
> > Signed-off-by: Max Kellermann <max.kellermann@...os.com>
> > Reviewed-by: Vishal Moola (Oracle) <vishal.moola@...il.com>
> > ---
>
> [...]
>
> > index 2201da0afecc..0232d983b715 100644
> > --- a/include/linux/sched/mm.h
> > +++ b/include/linux/sched/mm.h
> > @@ -178,7 +178,7 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
> >   #endif
> >   extern void arch_pick_mmap_layout(struct mm_struct *mm,
> > -				  struct rlimit *rlim_stack);
> > +				  const struct rlimit *rlim_stack);
> >   unsigned long
> >   arch_get_unmapped_area(struct file *filp, unsigned long addr,
> > @@ -211,7 +211,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
> >   				  unsigned long flags, vm_flags_t vm_flags);
> >   #else
> >   static inline void arch_pick_mmap_layout(struct mm_struct *mm,
> > -					 struct rlimit *rlim_stack) {}
> > +					 const struct rlimit *rlim_stack) {}
> >   #endif
>
> Should both these cases also use *const?
>
> (for the latter we probably don't care either, but maybe just to be
> consistent)

It'd be pretty hideous aesthetically. Really feel like we shouldn't be doing
it...

Imagine

static inline void foo(const struct mm_struct *const mm, const struct vm_area_struct *const vma,
			const struct rlimit *const rlim_stack);

I mean that's _just not readable_.

>
> --
> Cheers
>
> David / dhildenb
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ