From: Greg Kroah-Hartman Date: Tue, 12 May 2020 17:18:27 +0000 (+0200) Subject: 5.6-stable patches X-Git-Tag: v4.19.123~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9554d31cc44d80aeb047b025c33bf36de305d9d9;p=thirdparty%2Fkernel%2Fstable-queue.git 5.6-stable patches added patches: io_uring-don-t-use-fd-for-openat-openat2-statx.patch --- diff --git a/queue-5.6/io_uring-don-t-use-fd-for-openat-openat2-statx.patch b/queue-5.6/io_uring-don-t-use-fd-for-openat-openat2-statx.patch new file mode 100644 index 00000000000..93370d371d0 --- /dev/null +++ b/queue-5.6/io_uring-don-t-use-fd-for-openat-openat2-statx.patch @@ -0,0 +1,63 @@ +From 63ff822358b276137059520cf16e587e8073e80f Mon Sep 17 00:00:00 2001 +From: Max Kellermann +Date: Thu, 7 May 2020 14:56:15 -0600 +Subject: io_uring: don't use 'fd' for openat/openat2/statx + +From: Max Kellermann + +Based on commit 63ff822358b276137059520cf16e587e8073e80f upstream. + +If an operation's flag `needs_file` is set, the function +io_req_set_file() calls io_file_get() to obtain a `struct file*`. + +This fails for `O_PATH` file descriptors, because io_file_get() calls +fget(), which rejects `O_PATH` file descriptors. To support `O_PATH`, +fdget_raw() must be used (like path_init() in `fs/namei.c` does). +This rejection causes io_req_set_file() to throw `-EBADF`. This +breaks the operations `openat`, `openat2` and `statx`, where `O_PATH` +file descriptors are commonly used. + +This could be solved by adding support for `O_PATH` file descriptors +with another `io_op_def` flag, but since those three operations don't +need the `struct file*` but operate directly on the numeric file +descriptors, the best solution here is to simply remove `needs_file` +(and the accompanying flag `fd_non_reg`). + +Cc: stable@vger.kernel.org +Signed-off-by: Max Kellermann +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + +--- + fs/io_uring.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -696,8 +696,6 @@ static const struct io_op_def io_op_defs + .needs_file = 1, + }, + [IORING_OP_OPENAT] = { +- .needs_file = 1, +- .fd_non_neg = 1, + .file_table = 1, + .needs_fs = 1, + }, +@@ -711,8 +709,6 @@ static const struct io_op_def io_op_defs + }, + [IORING_OP_STATX] = { + .needs_mm = 1, +- .needs_file = 1, +- .fd_non_neg = 1, + .needs_fs = 1, + .file_table = 1, + }, +@@ -743,8 +739,6 @@ static const struct io_op_def io_op_defs + .unbound_nonreg_file = 1, + }, + [IORING_OP_OPENAT2] = { +- .needs_file = 1, +- .fd_non_neg = 1, + .file_table = 1, + .needs_fs = 1, + }, diff --git a/queue-5.6/series b/queue-5.6/series index 485932b4344..e4846ff0027 100644 --- a/queue-5.6/series +++ b/queue-5.6/series @@ -113,3 +113,4 @@ scripts-decodecode-fix-trapping-instruction-formatting.patch mm-memcg-fix-error-return-value-of-mem_cgroup_css_alloc.patch bdi-move-bdi_dev_name-out-of-line.patch bdi-add-a-dev_name-field-to-struct-backing_dev_info.patch +io_uring-don-t-use-fd-for-openat-openat2-statx.patch