Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4733467rwb; Tue, 8 Aug 2023 12:59:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGXLZeUaD5QLPi9/NMm5iL8jnIVTJt8F+O+KlDOMTgQI9kw9g/SI0b0ODZkuXdSzYWsiQ2 X-Received: by 2002:a05:6a21:47ca:b0:13d:3b4d:e4b4 with SMTP id as10-20020a056a2147ca00b0013d3b4de4b4mr497430pzc.9.1691524780817; Tue, 08 Aug 2023 12:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691524780; cv=none; d=google.com; s=arc-20160816; b=nAOg8LP9OLdG7xH5NIDTFYf52nX6KFEVpSi7uRUarfrQEsoKjF6Iu5KYZJcEijfmYL LT5FIrs4R8lxN0PaEBNlA3KywAhoutmKbTpCH3xndbElObExXIAODDKNLetyIzgGuJb8 G+23Ex0sjquF6sG5alOj1Lv1U0TAPZ+j2vy6YqimoLG9idjF95eYOpPOn5UL8UbOW1UQ oGWITN3C/JLPQ1g4SrY26mhLBv7RfsTUq5PWEoA+qnLhwoV2K30/j3lkqeqawg2rRGu+ CRDY3wH22Aah4ery9hLLPAhmErEFNboQpd65gQOpy7vmDD3ALP05UgmBp699ACYcoz3G Bojw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=poXIN1qcm1mBgNPqEzhboKC2+bYbXxru4TDBolh6FdE=; fh=l1VDbM6J2p5aUkzf5Bk93PWv8dfwilEfhcujjbOTx18=; b=nHIiTSRw/ux/wzpYT+uY0gtMhoOH3jCuDEdUSSoP/NIdBI4ucEt2x/HnCBUxWZI4OL aisye6KpsvhZdp/J/cXkaS4cb642y6wd3DMpCEvd1TgHqjpZnbbSD/xuLWU+7TRyHzXe zrax+wvb/2IfZOqx+dMeh+uEPjmiK3TxC7wRLQx1YB04sYJDmIfRbhPCYz0cna744r/Q lzdrzuDk+qde6md9eNfWfk8bgdGwYwt7dX0+SBxzgM0HFOQcJpT3Bbe0efEFmd7fAsCR Mh1lAPBxHmeqvkj47RHumpItB/UquP3wcvk0x3OHCXuw/pTbPZ11zYm1sYHqPNNUQrLo nAVA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a63cf4f000000b0055bc97cc885si4041402pgj.614.2023.08.08.12.59.28; Tue, 08 Aug 2023 12:59:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235742AbjHHTPN (ORCPT + 99 others); Tue, 8 Aug 2023 15:15:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbjHHTOn (ORCPT ); Tue, 8 Aug 2023 15:14:43 -0400 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED031458D; Tue, 8 Aug 2023 09:37:36 -0700 (PDT) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-3fe12baec61so49809545e9.2; Tue, 08 Aug 2023 09:37:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691512617; x=1692117417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=poXIN1qcm1mBgNPqEzhboKC2+bYbXxru4TDBolh6FdE=; b=GUsMOGemXr5xK1uso6LK91nkUDP0bg339cyAUktGmrr+UOR/4bWHSV7ZztR+rboZXs pT04BqZPDtHcJUrD0/TbcFaWxevzQsS1X5xuNk8m6CERBF2ME/ylns06NyfRxvaICxcu OqWtv+l8EROL6yQAFVBH3i1LRfrlGpKIOC/E0IZh+Ka9BFKirt/IPcwDA8oZHL4ohSRQ BvJMWi2EseNpceI/JI8QRSGQG6eO7vJhUFUjEggDekyh62YwkEOvNjyGtf7wA8BTGZdN TpEXdpJERZOkhHZKusY8T7y5HIBBnrgyRVq30Ap4uWWNkiGbqGyDGqbdjNQ0axoFBLDn 74vQ== X-Gm-Message-State: AOJu0YysYYBNy/qpUs7CzqmTRp5rzwQIlhNdUtssVYv5R5uBLfyxAtem 1i7ijAJfGjW7F5cHCMgKlQhiaammt0g= X-Received: by 2002:a50:ec99:0:b0:523:7b1:3720 with SMTP id e25-20020a50ec99000000b0052307b13720mr9558535edr.15.1691502068043; Tue, 08 Aug 2023 06:41:08 -0700 (PDT) Received: from localhost (fwdproxy-cln-118.fbsv.net. [2a03:2880:31ff:76::face:b00c]) by smtp.gmail.com with ESMTPSA id v18-20020aa7d652000000b005233885d0c6sm2734886edr.41.2023.08.08.06.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Aug 2023 06:41:07 -0700 (PDT) From: Breno Leitao To: sdf@google.com, axboe@kernel.dk, asml.silence@gmail.com, willemdebruijn.kernel@gmail.com Cc: 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: [PATCH v2 4/8] io_uring/cmd: Extend support beyond SOL_SOCKET Date: Tue, 8 Aug 2023 06:40:44 -0700 Message-Id: <20230808134049.1407498-5-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808134049.1407498-1-leitao@debian.org> References: <20230808134049.1407498-1-leitao@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 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); return err; } -- 2.34.1