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: <CAKhLTr1s9t5xThJ10N9Wgd_M0RLTiy5gecvd1W6gok3q1m4Fiw@mail.gmail.com>
Date: Mon, 24 Feb 2025 12:45:21 -0300
From: "Raphael S. Carvalho" <raphaelsc@...lladb.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Christoph Hellwig <hch@....de>, linux-kernel@...r.kernel.org, linux-xfs@...r.kernel.org, 
	linux-mm@...ck.org, linux-fsdevel@...r.kernel.org, djwong@...nel.org, 
	Dave Chinner <david@...morbit.com>
Subject: Re: [PATCH v2] mm: Fix error handling in __filemap_get_folio() with FGP_NOWAIT

On Mon, Feb 24, 2025 at 12:33 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Mon, Feb 24, 2025 at 03:17:44PM +0100, Christoph Hellwig wrote:
> > On Mon, Feb 24, 2025 at 05:13:28AM -0300, Raphael S. Carvalho wrote:
> > > +           if (err) {
> > > +                   /* Prevents -ENOMEM from escaping to user space with FGP_NOWAIT */
> > > +                   if ((fgp_flags & FGP_NOWAIT) && err == -ENOMEM)
> > > +                           err = -EAGAIN;
> > >                     return ERR_PTR(err);
> >
> > I don't think the comment is all that useful.  It's also overly long.
> >
> > I'd suggest this instead:
> >
> >                       /*
> >                        * When NOWAIT I/O fails to allocate folios this could
> >                        * be due to a nonblocking memory allocation and not
> >                        * because the system actually is out of memory.
> >                        * Return -EAGAIN so that there caller retries in a
> >                        * blocking fashion instead of propagating -ENOMEM
> >                        * to the application.
> >                        */
>
> I don't think it needs a comment at all, but the memory allocation
> might be for something other than folios, so your suggested comment
> is misleading.

Isn't it all in the context of allocating or adding folio? The reason
behind a comment is to prevent movements in the future that could
cause a similar regression, and also to inform the poor reader that
might be left wondering why we're converting -ENOMEM into -EAGAIN with
FGP_NOWAIT. Can it be slightly adjusted to make it more correct? Or
you really think it's better to remove it completely?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ