Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp29179rwl; Wed, 9 Aug 2023 10:23:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQ1w3VvPafZFy7L6utc/FlVgFnF487q0ZUbHBimmy9QfhrLnNFKumyT3bSEDKMrdFsO7bp X-Received: by 2002:a05:6358:63aa:b0:131:46b:3953 with SMTP id k42-20020a05635863aa00b00131046b3953mr67443rwh.13.1691601797352; Wed, 09 Aug 2023 10:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691601797; cv=none; d=google.com; s=arc-20160816; b=NpYkscsKHCkPlNeSVb+d7hJOCliy+CkOrbd/jfApYDD3snHJ82kK5ufMHhNAV/TZPh 18yJsWG+bWcMxqoeND81MZ1KB+C6iI933Y+Ykq3TAlXqg1Puy1dtFLAmBXM8sCOqpIWW 2yqZOcL/SamoI+afUa7+dPcv0KdZrahSOsenMJvQV3ncbvOBgwVh40c/reYV0zBGYzTg tFBYgTVxeEVvMj0bF52OgTqmwYcDw1xUdB1Dt0tBL+BdCl/y13Xfz6RKWSLs6eUKLadw VME9ZNCVifqTrMasmvsmZH6oeHOlTwcBOWujlrG+uA8HX8g+BDNalNe99WNr4Hs8G1gq svjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:dkim-signature :dkim-signature; bh=7QFcbq83iTfdOitDUN6evIcZyqpeTumZWQXVO5WSyTw=; fh=+V/QRs68yeDRu3Uxk4J70FAGv6km6I5r6wzqah/E9iw=; b=ebQoDmJrTpYlPjTlrfGrTV4++HOq4I3biYbp8K3Bu7o+OAmUedl4g76n638DmKjsX9 dXtL0iMvw0AkUqj7qEHgPAGasaBV/WVqGegHbDVN/ITkGm2eJW+S8Q8cfDBClR9WiGQl SOrQxTbLw+oexYVy89+GZVvXjcNUYeMnRWWuAhlbqYdKJZ0miuG5liHjlcVf3fZ9jTDy b9N/0ytGFweZbxbdIoS2RY8CfocmunNdafMfO952AiLIX1+gwFwD+kqAWNdIBSICs5bZ vNgouBBS9ZjCNWdOQcxB0VrsO4G7QcEkw7Z5Rysy/zWrBDZzUeLBv4Q06Flq926U6u5p 4tKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=w1WP5bAZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="5O/IJFSz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i65-20020a636d44000000b0055b618c77f6si9699818pgc.180.2023.08.09.10.23.04; Wed, 09 Aug 2023 10:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=w1WP5bAZ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="5O/IJFSz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230475AbjHIQch (ORCPT + 99 others); Wed, 9 Aug 2023 12:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbjHIQcg (ORCPT ); Wed, 9 Aug 2023 12:32:36 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07F5710F3; Wed, 9 Aug 2023 09:32:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B52B71F390; Wed, 9 Aug 2023 16:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691598754; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7QFcbq83iTfdOitDUN6evIcZyqpeTumZWQXVO5WSyTw=; b=w1WP5bAZE/zSuw7kqB93vtowYM7zVuuhl8Rc2SRSan8LvPe8Lfx2xAZ7f327XDzSDFoVOM HE+jCPblCOa+kKKjgT5n+lBklNdbXAIipUBF4mp0nnMwXIjyyl/C7J7fjSmb6FaNeYkO/b ZxPpcHNe2bgsaMb5k8sMMUurew7OBP0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691598754; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7QFcbq83iTfdOitDUN6evIcZyqpeTumZWQXVO5WSyTw=; b=5O/IJFSzRRrH1RkxV+y6NJZEypfhjSGMjUDCaG74+GsY1CDQkTgw5zNxPnqqCq1bWIWHNY XSDjMn6ZbnYO8CCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 60335133B5; Wed, 9 Aug 2023 16:32:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id voffEaK/02TLZgAAMHmgww (envelope-from ); Wed, 09 Aug 2023 16:32:34 +0000 From: Gabriel Krisman Bertazi To: Breno Leitao Cc: sdf@google.com, axboe@kernel.dk, asml.silence@gmail.com, willemdebruijn.kernel@gmail.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, io-uring@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com Subject: Re: [PATCH v2 4/8] io_uring/cmd: Extend support beyond SOL_SOCKET In-Reply-To: <20230808134049.1407498-5-leitao@debian.org> (Breno Leitao's message of "Tue, 8 Aug 2023 06:40:44 -0700") References: <20230808134049.1407498-1-leitao@debian.org> <20230808134049.1407498-5-leitao@debian.org> Date: Wed, 09 Aug 2023 12:32:33 -0400 Message-ID: <871qgc89cu.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Breno Leitao 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 > --- > 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