lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251126111931.1788970-1-metze@samba.org>
Date: Wed, 26 Nov 2025 12:19:31 +0100
From: Stefan Metzmacher <metze@...ba.org>
To: io-uring@...r.kernel.org
Cc: metze@...ba.org,
	Jens Axboe <axboe@...nel.dk>,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>,
	Kuniyuki Iwashima <kuniyu@...gle.com>,
	Willem de Bruijn <willemb@...gle.com>,
	netdev@...r.kernel.org,
	linux-cifs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] io_uring/net: wire up support for sk->sk_prot->uring_cmd() with SOCKET_URING_OP_PASSTHROUGH_FLAG

This will allow network protocols to implement async operations
instead of using ioctl() syscalls.

By using the high bit there's more than enough room for generic
calls to be added, but also more than enough for protocols to
implement their own specific opcodes.

The IPPROTO_SMBDIRECT socket layer [1] I'm currently working on,
will use this in future in order to let Samba use efficient RDMA offload.

[1]
https://git.samba.org/?p=metze/linux/wip.git;a=shortlog;h=refs/heads/master-ipproto-smbdirect

Cc: Jens Axboe <axboe@...nel.dk>
Cc: David S. Miller <davem@...emloft.net>
Cc: Eric Dumazet <edumazet@...gle.com>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>
Cc: Simon Horman <horms@...nel.org>
Cc: Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: Willem de Bruijn <willemb@...gle.com>
Cc: io-uring@...r.kernel.org
Cc: netdev@...r.kernel.org
Cc: linux-cifs@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Stefan Metzmacher <metze@...ba.org>

---

This is based on for-6.19/io_uring + the 3
"Introduce getsockname io_uring_cmd" patches from
https://lore.kernel.org/io-uring/20251125211806.2673912-1-krisman@suse.de/
as the addition of SOCKET_URING_OP_GETSOCKNAME would
conflict with the addition of SOCKET_URING_OP_PASSTHROUGH_FLAG
---
 include/net/sock.h            | 4 ++++
 include/uapi/linux/io_uring.h | 7 +++++++
 io_uring/cmd_net.c            | 2 ++
 3 files changed, 13 insertions(+)

diff --git a/include/net/sock.h b/include/net/sock.h
index 60bcb13f045c..ffcee4792589 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -98,6 +98,7 @@ typedef struct {
 struct sock;
 struct proto;
 struct net;
+struct io_uring_cmd;
 
 typedef __u32 __bitwise __portpair;
 typedef __u64 __bitwise __addrpair;
@@ -1272,6 +1273,9 @@ struct proto {
 
 	int			(*ioctl)(struct sock *sk, int cmd,
 					 int *karg);
+	int			(*uring_cmd)(struct sock *sk,
+					struct io_uring_cmd *ioucmd,
+					unsigned int issue_flags);
 	int			(*init)(struct sock *sk);
 	void			(*destroy)(struct sock *sk);
 	void			(*shutdown)(struct sock *sk, int how);
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index b5b23c0d5283..62ce6cb7d145 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -1010,6 +1010,13 @@ enum io_uring_socket_op {
 	SOCKET_URING_OP_SETSOCKOPT,
 	SOCKET_URING_OP_TX_TIMESTAMP,
 	SOCKET_URING_OP_GETSOCKNAME,
+
+	/*
+	 * This lets the sk->sk_prot->uring_cmd()
+	 * handle it, giving it enough space for
+	 * custom opcodes.
+	 */
+	SOCKET_URING_OP_PASSTHROUGH_FLAG = 0x80000000
 };
 
 /*
diff --git a/io_uring/cmd_net.c b/io_uring/cmd_net.c
index 5d11caf5509c..964f1764fa67 100644
--- a/io_uring/cmd_net.c
+++ b/io_uring/cmd_net.c
@@ -182,6 +182,8 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)
 	case SOCKET_URING_OP_GETSOCKNAME:
 		return io_uring_cmd_getsockname(sock, cmd, issue_flags);
 	default:
+		if (cmd->cmd_op & SOCKET_URING_OP_PASSTHROUGH_FLAG && prot->uring_cmd)
+			return prot->uring_cmd(sk, cmd, issue_flags);
 		return -EOPNOTSUPP;
 	}
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ