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

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