From nobody Mon Feb 9 04:40:09 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D857C142906; Sun, 24 Mar 2024 23:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321933; cv=none; b=Q5B43ta+nnlTNmE9RnNMRVfC8wPSiyOPwgdXuGw3oWI/igE2nMGkwVC8nHfzW4xvV9CDTQ61giBZxOkE7FloBPlRDH5ja6xKz0wgJST5DmcOEu9CGR0cjlMyTA+nDYvpOyGvKPmk+/lEvToEkg9Ihy5mtZ07yZ+a/vPROXoDeII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321933; c=relaxed/simple; bh=LEKNRecMmvxXUllhD4M+yND2wFd/fo2ndQcInkj7mNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XUsb6xohV3jvatPAJYmdACVLem1s6J7R8ZpfC/7jKfz1EgnXsvOpm56U1XysYY1yU+SrZTIGwTE0SUB5CpsMwdf5oYp7g9nN+5NAw70F2oFdTihshVvTa+W8kDOE47c5T4+X+OlgFYDodQUj8YdVbR18OOTmw0HbDFaPfZSmeqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W+FTRbno; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W+FTRbno" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AF05C43394; Sun, 24 Mar 2024 23:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321932; bh=LEKNRecMmvxXUllhD4M+yND2wFd/fo2ndQcInkj7mNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W+FTRbnoywarMWsCiowx0OdOSAMFOkQqSL+cZqsQ07T+mXXbrZTbEcg/Z7++7R+To EBXITtvxaYbL+M7MU6miDUsuAHxMuGVIvwtplokF946FvHHQPdkEOHPpEnyQKhaE1S Ew4Iu3QC6VxuiO1JBfySj3lSXmaLD0wjgxWDBpOK11mrXoOeJf+rhVYfkAs9XrRXIg rp7Q9A5CObZJwuXR2V2uP+otkqSbFvfhBke2dzVMmymiMf1ECehF0oMe3rKdWEaPM8 rp3JXvPa9kXQvzrx6oUWDq7Xu/NfiaLbQVUJ16fgq0T5Ptvq0uwtjSLUI1y4Er0OgJ Hk3pbBdJJCvRA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jens Axboe , Sasha Levin Subject: [PATCH 6.1 003/451] io_uring/unix: drop usage of io_uring socket Date: Sun, 24 Mar 2024 19:04:39 -0400 Message-ID: <20240324231207.1351418-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jens Axboe Commit a4104821ad651d8a0b374f0b2474c345bbb42f82 upstream. 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 Signed-off-by: Sasha Levin --- 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(-) diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h index a1484cdb3158e..a8f3058448eaa 100644 --- a/include/linux/io_uring.h +++ b/include/linux/io_uring.h @@ -42,11 +42,11 @@ void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_= t ret, ssize_t res2, unsigned issue_flags); void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd, void (*task_work_cb)(struct io_uring_cmd *, unsigned)); -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); +bool io_is_uring_fops(struct file *file); =20 static inline void io_uring_files_cancel(void) { @@ -71,6 +71,10 @@ static inline int io_uring_cmd_import_fixed(u64 ubuf, un= signed long len, int rw, { return -EOPNOTSUPP; } +static inline bool io_is_uring_fops(struct file *file) +{ + return false; +} static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t ret2, unsigned issue_flags) { @@ -79,10 +83,6 @@ static inline void io_uring_cmd_complete_in_task(struct = io_uring_cmd *ioucmd, void (*task_work_cb)(struct io_uring_cmd *, unsigned)) { } -static inline struct sock *io_uring_get_socket(struct file *file) -{ - return NULL; -} static inline void io_uring_task_cancel(void) { } diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 35894955b4549..cf7dd62da0e37 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -153,19 +153,6 @@ static void __io_submit_flush_completions(struct io_ri= ng_ctx *ctx); =20 static struct kmem_cache *req_cachep; =20 -struct sock *io_uring_get_socket(struct file *file) -{ -#if defined(CONFIG_UNIX) - if (io_is_uring_fops(file)) { - struct io_ring_ctx *ctx =3D 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)) diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h index 019600570ee49..59e6f755f12c6 100644 --- a/io_uring/io_uring.h +++ b/io_uring/io_uring.h @@ -52,7 +52,6 @@ static inline bool io_req_ffs_set(struct io_kiocb *req) } =20 void __io_req_task_work_add(struct io_kiocb *req, bool allow_local); -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, bool *dont_use); diff --git a/net/core/scm.c b/net/core/scm.c index e762a4b8a1d22..a877c4ef4c256 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -105,7 +105,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm= _fp_list **fplp) if (fd < 0 || !(file =3D 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; } diff --git a/net/unix/scm.c b/net/unix/scm.c index e8e2a00bb0f58..d1048b4c2baaf 100644 --- a/net/unix/scm.c +++ b/net/unix/scm.c @@ -34,10 +34,8 @@ struct sock *unix_get_socket(struct file *filp) /* PF_UNIX ? */ if (s && sock->ops && sock->ops->family =3D=3D PF_UNIX) u_sock =3D s; - } else { - /* Could be an io_uring instance */ - u_sock =3D io_uring_get_socket(filp); } + return u_sock; } EXPORT_SYMBOL(unix_get_socket); --=20 2.43.0