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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230724142237.358769-5-leitao@debian.org>
Date:   Mon, 24 Jul 2023 07:22:37 -0700
From:   Breno Leitao <leitao@...ian.org>
To:     asml.silence@...il.com, axboe@...nel.dk
Cc:     io-uring@...r.kernel.org, netdev@...r.kernel.org,
        davem@...emloft.net, kuba@...nel.org, edumazet@...gle.com,
        pabeni@...hat.com, linux-kernel@...r.kernel.org, leit@...a.com
Subject: [PATCH 4/4] io_uring/cmd: Extend support beyond SOL_SOCKET

Add generic support for SOCKET_URING_OP_SETSOCKOPT, expanding the
current case, that just execute if level is SOL_SOCKET.

This implementation basically calls sock->ops->setsockopt() with a
kernel allocated optval;

Since the callback for ops->setsockopt() is already using sockptr_t,
then the callbacks are leveraged to be called directly, similarly to
__sys_setsockopt().

Signed-off-by: Breno Leitao <leitao@...ian.org>
---
 io_uring/uring_cmd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index d63a3b0f93a3..ff438826e63f 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -229,11 +229,14 @@ static inline int io_uring_cmd_setsockopt(struct socket *sock,
 	if (err)
 		goto fail;
 
-	err = -EOPNOTSUPP;
-	if (level == SOL_SOCKET && !sock_use_custom_sol_socket(sock)) {
+	if (level == SOL_SOCKET && !sock_use_custom_sol_socket(sock))
 		err = sock_setsockopt(sock, level, optname,
 				      KERNEL_SOCKPTR(koptval), optlen);
-	}
+	else if (unlikely(!sock->ops->setsockopt))
+		err = -EOPNOTSUPP;
+	else
+		err = sock->ops->setsockopt(sock, level, optname,
+					    KERNEL_SOCKPTR(koptval), optlen);
 
 fail:
 	kfree(koptval);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ