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: <fbbba8cd-77d1-44c3-ba70-18beae5719d1@lucifer.local>
Date:   Mon, 22 May 2023 21:34:31 +0100
From:   Lorenzo Stoakes <lstoakes@...il.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Mike Rapoport <rppt@...nel.org>,
        "Liam R . Howlett" <Liam.Howlett@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>
Subject: Re: [PATCH] mm/mmap: refactor mlock_future_check()

On Mon, May 22, 2023 at 01:28:51PM -0700, Andrew Morton wrote:
> On Mon, 22 May 2023 09:24:12 +0100 Lorenzo Stoakes <lstoakes@...il.com> wrote:
>
> > In all but one instance, mlock_future_check() is treated as a boolean
> > function despite returning an error code. In one instance, this error code
> > is ignored and replaced with -ENOMEM.
> >
> > This is confusing, and the inversion of true -> failure, false -> success
> > is not warranted. Convert the function to a bool, lightly refactor and
> > return true if the check passes, false if not.
>
> Yup.
>
> I don't think the name does a good job of conveying the
> function's use.
>
> > -	if (mlock_future_check(mm, vm_flags, len))
> > +	if (!mlock_future_check(mm, vm_flags, len))
> >  		return -EAGAIN;
>
> 	if (!may_mlock_future(...))
>
> or
>
> 	if (!mlock_future_ok(...))
>
> ?
>
>

Yeah I struggled with this, because the check only triggers if VM_LOCKED. I was
originally toying with can_mlock_future() but of course, it also returns true if
!VM_LOCKED...

I think your suggestion of mlock_future_ok() works well, could you change it to
that? Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ