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: <10687.1690213447@warthog.procyon.org.uk>
Date:   Mon, 24 Jul 2023 16:44:07 +0100
From:   David Howells <dhowells@...hat.com>
To:     Jan Stancek <jstancek@...hat.com>
Cc:     dhowells@...hat.com, kuba@...nel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        brauner@...nel.org, viro@...iv.linux.org.uk
Subject: Re: [PATCH] splice, net: Fix splice_to_socket() for O_NONBLOCK socket

Jan Stancek <jstancek@...hat.com> wrote:

> On Mon, Jul 24, 2023 at 12:12 PM David Howells <dhowells@...hat.com> wrote:
> >
> > Jan Stancek <jstancek@...hat.com> wrote:
> >
> > > LTP sendfile07 [1], which expects sendfile() to return EAGAIN when
> > > transferring data from regular file to a "full" O_NONBLOCK socket,
> > > started failing after commit 2dc334f1a63a ("splice, net: Use
> > > sendmsg(MSG_SPLICE_PAGES) rather than ->sendpage()").
> > > sendfile() no longer immediately returns, but now blocks.
> > >
> > > Removed sock_sendpage() handled this case by setting a MSG_DONTWAIT
> > > flag, fix new splice_to_socket() to do the same for O_NONBLOCK sockets.
> >
> > Does this actually work correctly in all circumstances?
> >
> > The problem might come if you have a splice from a non-rewindable source
> > through a temporary pipe (eg. sendfile() using splice_direct_to_actor()).
> 
> I assumed this was safe, since sendfile / splice_direct_to_actor()
> requires input to be seekable.

Ah!  The test isn't where I was looking for it (in sendfile()) - it's in
splice_direct_to_actor().

I wonder if it's worth making that explicit in do_sendfile() as the
requirement doesn't hold if the output is a pipe (though in such a case,
there's an explicit buffer, so it's not actually a problem).

Anyway, did you want to post this to netdev too so that the networking tree
picks it up?  Feel free to add:

Acked-by: David Howells <dhowells@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ