Drop remnants of SCM_RIGHTS support
Subsystems (4)
Jens Axboe
maintainercover Drop remnants of SCM_RIGHTS support
Hi,
Since we dropped support for SCM_RIGHTS passing of io_uring fds, we know have some code that is no longer enabled. Drop it like a bad habbit.
include/linux/io_uring.h | 10 +- include/linux/io_uring_types.h | 3 - io_uring/filetable.c | 11 +-- io_uring/io_uring.c | 45 +-------- io_uring/io_uring.h | 1 - io_uring/rsrc.c | 169 +-------------------------------- io_uring/rsrc.h | 15 --- net/core/scm.c | 2 +- net/unix/scm.c | 4 +- 9 files changed, 17 insertions(+), 243 deletions(-)
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerPATCH 1/2 io_uring/unix: drop usage of io_uring socket
Since we no longer allow sending io_uring fds over SCM_RIGHTS, move to using io_is_uring_fops() to detect whether this is a io_uring fd or not. With that done, kill off io_uring_get_socket() as nobody calls it anymore.
This is in preparation to yanking out the rest of the core related to unix gc with io_uring.
Signed-off-by Jens Axboe <[email protected]>
--- include/linux/io_uring.h | 10 +++++----- io_uring/io_uring.c | 13 ------------- io_uring/io_uring.h | 1 - net/core/scm.c | 2 +- net/unix/scm.c | 4 +--- 5 files changed, 7 insertions(+), 23 deletions(-)
include/linux/io_uring.h +5 -5
@@ -7,12 +7,12 @@#include <uapi/linux/io_uring.h> #if defined(CONFIG_IO_URING ) -struct sock *io_uring_get_socket (struct file *file);void __io_uring_cancel (bool cancel_all);void __io_uring_free (struct task_struct *tsk);void io_uring_unreg_ringfd (void );const char *io_uring_get_opcode (u8 opcode);int io_uring_cmd_sock (struct io_uring_cmd *cmd,unsigned int issue_flags); +bool io_is_uring_fops (struct file *file);static inline void io_uring_files_cancel (void ) {
@@ -32,10 +32,6 @@ static inline void io_uring_free(struct task_struct *tsk) __io_uring_free(tsk); }#else -static inline struct sock *io_uring_get_socket (struct file *file) -{ -return NULL ; -}static inline void io_uring_task_cancel (void ) { }
@@ -54,6 +50,10 @@ static inline int io_uring_cmd_sock(struct io_uring_cmd *cmd, {return -EOPNOTSUPP ; } +static inline bool io_is_uring_fops (struct file *file) +{ +return false; +}#endif #endif
io_uring/io_uring.c +0 -13
@@ -171,19 +171,6 @@ static struct ctl_table kernel_io_uring_disabled_table[] = { };#endif -struct sock *io_uring_get_socket (struct file *file) -{ -#if defined(CONFIG_UNIX ) -if (io_is_uring_fops (file)) { -struct io_ring_ctx *ctx = file->private_data; - -return ctx->ring_sock->sk; - } -#endif -return NULL ; -} -EXPORT_SYMBOL (io_uring_get_socket); -static inline void io_submit_flush_completions (struct io_ring_ctx *ctx) { if (!wq_list_empty(&ctx->submit_state.compl_reqs) ||
io_uring/io_uring.h +0 -1
@@ -44,7 +44,6 @@ struct file *io_file_get_fixed(struct io_kiocb *req, int fd, unsigned issue_flags);void __io_req_task_work_add (struct io_kiocb *req,unsigned flags); -bool io_is_uring_fops (struct file *file);bool io_alloc_async_data (struct io_kiocb *req);void io_req_task_queue (struct io_kiocb *req);void io_queue_iowq (struct io_kiocb *req,struct io_tw_state *ts_dont_use);
net/core/scm.c +1 -1
@@ -105,7 +105,7 @@ 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)) { +if (io_is_uring_fops (file)) {fput (file);return -EINVAL ; }
net/unix/scm.c +1 -3
@@ -35,10 +35,8 @@ struct sock *unix_get_socket(struct file *filp)/* PF_UNIX ? */ if (s && ops && ops->family ==PF_UNIX ) u_sock = s; - }else { -/* Could be an io_uring instance */ - u_sock =io_uring_get_socket (filp); } +return u_sock; }EXPORT_SYMBOL (unix_get_socket);
Signature · 1 line
2.43.0
Jens Axboe
maintainerPATCH 2/2 io_uring: drop any code related to SCM_RIGHTS
In reply to Jens AxboeThis is dead code after we dropped support for passing io_uring fds over SCM_RIGHTS, get rid of it.
Signed-off-by Jens Axboe <[email protected]>
--- include/linux/io_uring_types.h | 3 - io_uring/filetable.c | 11 +-- io_uring/io_uring.c | 32 +------ io_uring/rsrc.c | 169 +-------------------------------- io_uring/rsrc.h | 15 --- 5 files changed, 10 insertions(+), 220 deletions(-)
include/linux/io_uring_types.h +0 -3
@@ -389,9 +389,6 @@ struct io_ring_ctx {struct wait_queue_head rsrc_quiesce_wq;unsigned rsrc_quiesce; -#if defined(CONFIG_UNIX ) -struct socket *ring_sock; -#endif /* hashed buffered write serialization */ struct io_wq_hash *hash_map;
io_uring/filetable.c +4 -7
@@ -87,13 +87,10 @@ static int io_install_fixed_file(struct io_ring_ctx *ctx, struct file *file,io_file_bitmap_clear (&ctx->file_table, slot_index); } - ret =io_scm_file_account (ctx, file); -if (!ret) { - *io_get_tag_slot (ctx->file_data, slot_index) =0 ; -io_fixed_file_set (file_slot, file); -io_file_bitmap_set (&ctx->file_table, slot_index); - } -return ret; + *io_get_tag_slot (ctx->file_data, slot_index) =0 ; +io_fixed_file_set (file_slot, file); +io_file_bitmap_set (&ctx->file_table, slot_index); +return 0 ; } int __io_fixed_fd_install(struct io_ring_ctx *ctx, struct file *file,
io_uring/io_uring.c +2 -30
@@ -60,7 +60,6 @@#include <linux/net.h> #include <net/sock.h> #include <net/af_unix.h> -#include <net/scm.h> #include <linux/anon_inodes.h> #include <linux/sched/mm.h> #include <linux/uaccess.h>
@@ -2866,13 +2865,6 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx)io_rsrc_node_destroy (ctx, ctx->rsrc_node);WARN_ON_ONCE (!list_empty (&ctx->rsrc_ref_list)); - -#if defined(CONFIG_UNIX ) -if (ctx->ring_sock) { - ctx->ring_sock->file =NULL ;/* so that iput() is called */ -sock_release (ctx->ring_sock); - } -#endif WARN_ON_ONCE (!list_empty (&ctx->ltimeout_list));io_alloc_cache_free (&ctx->rsrc_node_cache, io_rsrc_node_cache_free);
@@ -3781,32 +3773,12 @@ static int io_uring_install_fd(struct file *file)/* * Allocate an anonymous fd, this is what constitutes the application * visible backing of an io_uring instance. The application mmaps this -* fd to gain access to the SQ/CQ ring details. If UNIX sockets are enabled, -* we have to tie this fd to a socket for file garbage collection purposes. +* fd to gain access to the SQ/CQ ring details. */ static struct file *io_uring_get_file (struct io_ring_ctx *ctx) { -struct file *file; -#if defined(CONFIG_UNIX ) -int ret; - - ret =sock_create_kern (&init_net,PF_UNIX ,SOCK_RAW ,IPPROTO_IP , - &ctx->ring_sock); -if (ret) -return ERR_PTR (ret); -#endif - - file =anon_inode_getfile_secure ("[io_uring]" , &io_uring_fops, ctx, +return anon_inode_getfile_secure ("[io_uring]" , &io_uring_fops, ctx,O_RDWR |O_CLOEXEC ,NULL ); -#if defined(CONFIG_UNIX ) -if (IS_ERR (file)) { -sock_release (ctx->ring_sock); - ctx->ring_sock =NULL ; - }else { - ctx->ring_sock->file = file; - } -#endif -return file; } static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
io_uring/rsrc.c +4 -165
221 lines not on this page · raw message
io_uring/rsrc.h +0 -15
@@ -75,21 +75,6 @@ int io_sqe_files_unregister(struct io_ring_ctx *ctx);int io_sqe_files_register (struct io_ring_ctx *ctx,void __user *arg,unsigned nr_args,u64 __user *tags); -int __io_scm_file_account (struct io_ring_ctx *ctx,struct file *file); - -static inline bool io_file_need_scm (struct file *filp) -{ -return false; -} - -static inline int io_scm_file_account (struct io_ring_ctx *ctx, -struct file *file) -{ -if (likely (!io_file_need_scm (file))) -return 0 ; -return __io_scm_file_account (ctx, file); -} -int io_register_files_update (struct io_ring_ctx *ctx,void __user *arg,unsigned nr_args); int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg,
Signature · 1 line
2.43.0