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  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]
Date:   Tue, 22 Jun 2021 16:32:31 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     David Howells <dhowells@...hat.com>
Cc:     torvalds@...ux-foundation.org, Ted Ts'o <tytso@....edu>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        viro@...iv.linux.org.uk, linux-mm@...ck.org,
        linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: Do we need to unrevert "fs: do not prefault sys_write() user
 buffer pages"?

On Tue, Jun 22, 2021 at 04:20:40PM +0100, David Howells wrote:
> and wondering if the iov_iter_fault_in_readable() is actually effective.  Yes,
> it can make sure that the page we're intending to modify is dragged into the
> pagecache and marked uptodate so that it can be read from, but is it possible
> for the page to then get reclaimed before we get to
> iov_iter_copy_from_user_atomic()?  a_ops->write_begin() could potentially take
> a long time, say if it has to go and get a lock/lease from a server.

It's certainly possible, but unlikely.  The page is going to go to the
head of the active queue, and so we'll have to burn our way through the
entire inactive and then active queue in order to bump this page out
of memory.

> Also, I've been thinking about Willy's folio/THP stuff that allows bunches of
> pages to be glued together into single objects for efficiency.  This is
> problematic with the above code because the faultahead is limited to a maximum
> of PAGE_SIZE, but we might be wanting to modify a larger object than that.

Just to be clear, it's not _currently_ a problem for the folio patchset.

Multi-page folios are only created during readahead.  Unless there's a
read error during readahead, a folio found during write() will either
be freshly created and order-0, or it'll be multi-order and uptodate.
I would like to create larger folios during write() eventually, but I'm
choosing to not burden the folio patchset with that enhancement yet.
It has enough performance improvement to not need that yet.

Powered by blists - more mailing lists