diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-12-06 13:26:47 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-12-13 18:39:17 +0100 |
commit | f2f57f51b53be153a522300454ddb3887722fb2c (patch) | |
tree | 53276db052dac2a38e2b2d154a820908992a5f96 /io_uring | |
parent | 515c25be77ba5c5c7b041dcbd5fac682b1dda166 (diff) | |
download | linux-stable-f2f57f51b53be153a522300454ddb3887722fb2c.tar.gz linux-stable-f2f57f51b53be153a522300454ddb3887722fb2c.tar.bz2 linux-stable-f2f57f51b53be153a522300454ddb3887722fb2c.zip |
io_uring/af_unix: disable sending io_uring over sockets
commit 705318a99a138c29a512a72c3e0043b3cd7f55f4 upstream.
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.
Cc: <stable@vger.kernel.org>
Fixes: 0091bfc81741b ("io_uring/af_unix: defer registered files gc to io_uring release")
Reported-and-suggested-by: Jann Horn <jannh@google.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c716c88321939156909cfa1bd8b0faaf1c804103.1701868795.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/rsrc.h | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h index d60c758326b4..acaf8dad0540 100644 --- a/io_uring/rsrc.h +++ b/io_uring/rsrc.h @@ -79,17 +79,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) |