public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Change in splice() behaviour after 5.10?
@ 2024-06-03  9:59 Terry Tritton
  2024-06-04  4:50 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Terry Tritton @ 2024-06-03  9:59 UTC (permalink / raw)
  To: hch; +Cc: ttritton@google.com, edliaw, keescook, linux-kernel

Hi,
We've found a change in behaviour while testing the splice07 LTP test.
In versions before 5.10 the test will hang on certain combinations but after
5.10 the splice call will return.
I bisected the change to the following commit:
    36e2c7421f02a22f71c9283e55fdb672a9eb58e7
    fs: don't allow splice read/write without explicit ops

There has been some discussion on the LTP github page already:
    https://github.com/linux-test-project/ltp/issues/1156

From the github link these combinations fail on 5.4:
|in_fd            |  out_fd            |  error  |
--------------------------------------------------
|TST_FD_PIPE_READ |  TST_FD_EPOLL      | hangs   |
|TST_FD_PIPE_READ |  TST_FD_EVENTFD    | hangs   |
|TST_FD_PIPE_READ |  TST_FD_SIGNALFD   | hangs   |
|TST_FD_PIPE_READ |  TST_FD_TIMERFD    | hangs   |
|TST_FD_PIPE_READ |  TST_FD_PIDFD      | hangs   |
|TST_FD_PIPE_READ |  TST_FD_PERF_EVENT | hangs   |
|TST_FD_PIPE_READ |  TST_FD_IO_URING   | hangs   |
|TST_FD_PIPE_READ |  TST_FD_BPF_MAP    | hangs   |
|TST_FD_PIPE_READ |  TST_FD_FSOPEN     | hangs   |
|TST_FD_PIPE_READ |  TST_FD_FSPICK     | hangs   |
|TST_FD_INOTIFY   |  TST_FD_PIPE_WRITE | hangs   |
|TST_FD_DIR       |  TST_FD_PIPE_WRITE | EISDIR  |
|TST_FD_PERF_EVENT| TST_FD_PIPE_WRITE | ENODATA |
|TST_FD_FSOPEN    |  TST_FD_PIPE_WRITE | ENODATA |
|TST_FD_FSPICK    |  TST_FD_PIPE_WRITE | ENODATA |


PoC below, this program will hang before 36e2c7421f and complete after it.

#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <unistd.h>

int main(){
    int fd_in[2];
    int fd_out;

    pipe(fd_in);
    fd_out = epoll_create(1);

    splice(fd_in[0], NULL, fd_out, NULL, 1, 0);

    printf("Should not hang!\n");

    return 0;
}

Is this change expected?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Change in splice() behaviour after 5.10?
  2024-06-03  9:59 Change in splice() behaviour after 5.10? Terry Tritton
@ 2024-06-04  4:50 ` Christoph Hellwig
  2024-06-04  5:43   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2024-06-04  4:50 UTC (permalink / raw)
  To: Terry Tritton; +Cc: hch, ttritton@google.com, edliaw, keescook, linux-kernel

On Mon, Jun 03, 2024 at 10:59:15AM +0100, Terry Tritton wrote:
> Hi,
> We've found a change in behaviour while testing the splice07 LTP test.
> In versions before 5.10 the test will hang on certain combinations but after
> 5.10 the splice call will return.
> I bisected the change to the following commit:
>     36e2c7421f02a22f71c9283e55fdb672a9eb58e7
>     fs: don't allow splice read/write without explicit ops
> 
> There has been some discussion on the LTP github page already:
>     https://github.com/linux-test-project/ltp/issues/1156

In that case the return probably is an error because epoll doesn't
support read_iter/write_iter and thus completely expected.

If the underlying bug hasn't been fix in the mean time that probably
means it will be back if Jens' conversion of all misc file operations
to the iter based ones every gets merged.

If you are interested more in this please discuss it on the relevant
mailing lists instead of in private mail.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Change in splice() behaviour after 5.10?
  2024-06-04  4:50 ` Christoph Hellwig
@ 2024-06-04  5:43   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2024-06-04  5:43 UTC (permalink / raw)
  To: Christoph Hellwig, Terry Tritton
  Cc: hch, ttritton@google.com, edliaw, keescook, linux-kernel,
	linux-fsdevel, Jens Axboe



On June 3, 2024 9:50:30 PM PDT, Christoph Hellwig <hch@lst.de> wrote:
>On Mon, Jun 03, 2024 at 10:59:15AM +0100, Terry Tritton wrote:
>> Hi,
>> We've found a change in behaviour while testing the splice07 LTP test.
>> In versions before 5.10 the test will hang on certain combinations but after
>> 5.10 the splice call will return.
>> I bisected the change to the following commit:
>>     36e2c7421f02a22f71c9283e55fdb672a9eb58e7
>>     fs: don't allow splice read/write without explicit ops
>> 
>> There has been some discussion on the LTP github page already:
>>     https://github.com/linux-test-project/ltp/issues/1156
>
>In that case the return probably is an error because epoll doesn't
>support read_iter/write_iter and thus completely expected.
>
>If the underlying bug hasn't been fix in the mean time that probably
>means it will be back if Jens' conversion of all misc file operations
>to the iter based ones every gets merged.
>
>If you are interested more in this please discuss it on the relevant
>mailing lists instead of in private mail.

Eh? LKML is in CC...

I've added fsdevel and Jens now too, though. 

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-04  5:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-03  9:59 Change in splice() behaviour after 5.10? Terry Tritton
2024-06-04  4:50 ` Christoph Hellwig
2024-06-04  5:43   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox