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: <20230421022525.GX3390869@ZenIV>
Date:   Fri, 21 Apr 2023 03:25:25 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     David Howells <dhowells@...hat.com>
Cc:     Jens Axboe <axboe@...nel.dk>,
        Christoph Hellwig <hch@...radead.org>,
        Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
        Jeff Layton <jlayton@...nel.org>,
        David Hildenbrand <david@...hat.com>,
        Jason Gunthorpe <jgg@...dia.com>,
        Logan Gunthorpe <logang@...tatee.com>,
        Hillf Danton <hdanton@...a.com>,
        Christian Brauner <brauner@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Christoph Hellwig <hch@....de>,
        John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH v18 09/15] iov_iter: Kill ITER_PIPE

On Fri, Apr 21, 2023 at 02:11:45AM +0100, Al Viro wrote:
> On Thu, Apr 20, 2023 at 11:36:57PM +0100, Al Viro wrote:
> 
> > Don't get me wrong - I'd love to kill ITER_PIPE off; it's just that tons
> > of ->splice_read() duplicating the corresponding ->read_iter() up to the
> > point where it would call generic_file_read_iter(), modulo ignoring
> > O_DIRECT case and then calling filemap_splice_read() instead...  Painful
> > and asking for trouble down the road.
> 
> FWIW, broken in this series:
> 	* a bunch of 9p variants (those could probably switch to direct)
> 	* afs
> 	* ceph (very likely)
> 	* ecryptfs (atime propagation)
> 	* dax on various filesystems (probably)
> 	* f2fs
> 	* gfs2
> 	* nfs
> 	* ocfs2
> 	* orangefs
> 	* xfs
> 	* zonefs (probably)
> 	* splice from UDP sockets, unless I'm misreading something.
> Your sock_splice_read() still falls back to generic_file_splice_read(),
> rather than to direct_splice_read() and sockets don't have O_DIRECT
> in flags.  Neither do they have associated page cache ;-)
> 
> Sure, we could provide a bunch of ->splice_read(), but then we'd have to make
> sure that all subsequent changes to matching ->read_iter() get duplicated -
> unless they are on O_DIRECT-only paths, that is...

OK, how about the following modification of ITER_PIPE?
	* buffers might extend past the current position
	* buffers (as now) are either data or zero-copy ones.
	* advance past the end of data => allocate data-type buffers
and fill with zeroes.
	* copying data to area prior to the end of buffers => each
zero-copy-type buffer is converted to a data one; data is copied,
but WTF else can you do?  If there's a page borrowed from page
cache, we can't change its contents anyway.
	* zero-copy of a page into an area overlapping the existing
buffers => treat as data copy for the overlapping part and zero-copy
the rest (if any) in normal fashion.
	* iov_iter_get_pages(): convert everything involved into
data-type buffers first, then give caller references to that.
Zero-fill new pages (if any).
	* iov_iter_revert() does *NOT* truncate anything
	* truncation of stuff past the current position is done by
generic_file_splice_read() not only in error case, but on success
as well - starting at the end of actually read data, of course.

That would make for seekable ITER_PIPE, with zero-copy working for
normal cases.  I agree that O_DIRECT would probably be better off
with ITER_BVEC.

Comments?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ