FAILED: patch "[PATCH] io_uring/af_unix: disable sending io_uring over sockets" failed to apply to 6.6-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 69db702c83874fbaa2a51af761e35a8e5a593b95
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023121721-canary-transpire-3973@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
69db702c8387 ("io_uring/af_unix: disable sending io_uring over sockets")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 69db702c83874fbaa2a51af761e35a8e5a593b95 Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <[email protected]>
Date: Wed, 6 Dec 2023 13:55:19 +0000
Subject: [PATCH] io_uring/af_unix: disable sending io_uring over sockets
File reference cycles have caused lots of problems for io_uring in the past, and it still doesn't work exactly right and races with unix_stream_read_generic(). The safest fix would be to completely disallow sending io_uring files via sockets via SCM_RIGHT, so there are no possible cycles invloving registered files and thus rendering SCM accounting on the io_uring side unnecessary.
io_uring/rsrc.h +0 -7
@@ -77,17 +77,10 @@ int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,int __io_scm_file_account (struct io_ring_ctx *ctx,struct file *file); -#if defined(CONFIG_UNIX ) -static inline bool io_file_need_scm (struct file *filp) -{ -return !!unix_get_socket (filp); -} -#else static inline bool io_file_need_scm (struct file *filp) {return false; } -#endif static inline int io_scm_file_account (struct io_ring_ctx *ctx,struct file *file)
net/core/scm.c +6 -0
@@ -26,6 +26,7 @@#include <linux/nsproxy.h> #include <linux/slab.h> #include <linux/errqueue.h> +#include <linux/io_uring.h> #include <linux/uaccess.h>
@@ -103,6 +104,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)if (fd <0 || !(file =fget_raw (fd)))return -EBADF ; +/* don't allow io_uring files */ +if (io_uring_get_socket (file)) { +fput (file); +return -EINVAL ; + } *fpp++ = file; fpl->count++; }