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: <871qgc89cu.fsf@suse.de>
Date: Wed, 09 Aug 2023 12:32:33 -0400
From: Gabriel Krisman Bertazi <krisman@...e.de>
To: Breno Leitao <leitao@...ian.org>
Cc: sdf@...gle.com,  axboe@...nel.dk,  asml.silence@...il.com,
  willemdebruijn.kernel@...il.com,  bpf@...r.kernel.org,
  linux-kernel@...r.kernel.org,  netdev@...r.kernel.org,
  io-uring@...r.kernel.org,  kuba@...nel.org,  pabeni@...hat.com
Subject: Re: [PATCH v2 4/8] io_uring/cmd: Extend support beyond SOL_SOCKET

Breno Leitao <leitao@...ian.org> writes:

> 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 | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
> index 5404b788ca14..dbba005a7290 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -205,10 +205,14 @@ static inline int io_uring_cmd_setsockopt(struct socket *sock,
>  	if (err)
>  		return err;
>  
> -	err = -EOPNOTSUPP;
>  	if (level == SOL_SOCKET && !sock_use_custom_sol_socket(sock))
>  		err = sock_setsockopt(sock, level, optname,
>  				      USER_SOCKPTR(optval), optlen);
> +	else if (unlikely(!sock->ops->setsockopt))
> +		err = -EOPNOTSUPP;
> +	else
> +		err = sock->ops->setsockopt(sock, level, optname,
> +					    USER_SOCKPTR(koptval), optlen);

Perhaps move this logic into a helper in net/ so io_uring doesn't need
to know details of struct socket and there is no duplication of this code
in __sys_getsockopt.

>  	return err;
>  }

-- 
Gabriel Krisman Bertazi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ