Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2652281rwd; Fri, 19 May 2023 08:27:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7da54KKHlvliBFHPmYGhuzjMELp0Qs199xEkjVxWs654Ctbee4dECkH3M2imbCQ3BEi6Qr X-Received: by 2002:a17:90b:3a8e:b0:24e:1483:13c4 with SMTP id om14-20020a17090b3a8e00b0024e148313c4mr2219683pjb.20.1684510033575; Fri, 19 May 2023 08:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684510033; cv=none; d=google.com; s=arc-20160816; b=zJEnOWDU7cHz5nv8Vz+ug04Db8ofhg42kFwOcKEFY/D2DO1ik6D6snjCAYxb5sJkGn jkXJ2ESVgZlwvSrEnPJyySvxSQVDZ3FhengMFtsc++7UkuytkHiqyTECSoZNqIj5b6+2 2zUfG02XvDTd6fC/DcTTe9mJ6MM1j0F9gsMIsfvKMryHOEQHQ/NdtMpMjp0vFXOfT5ym VbOgxWPUcNA98djybfmIj5uYiq2veURdaS4uqR2RlJ/KB1uJvmk97wSsX17zjRdHgW2P XimEOWqB2rbzoZvQBhSJod4cQe/sRVFK/dI73h3cWf7qwDKawfv5h7cJpE/nipFYmVrR Epsg== 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:subject:cc:to:from:date :dkim-signature; bh=Ud/dE0e7EyDTEggwYERIXS+zeyXcpH/O60VCEGGlm0w=; b=L2b/ZPIICYjsbgxI86ggOdnQFw2je/9pvorQA3H0z08OLHJf5Ywf1MfO9fTEMyvHfP dGQJeG8aQBhnfbu+k9vNPLDH46dqNzI7DP1h/drkC4KoggYA8Y79iHhiutmzZyQtNCCM p1tOQF/kZQh7PUiNTVCyMGqffr9HCfuGV3cQEI5EnkFzqhwa7oY2p6GR10SJLzqVC5rg FAcA9H4tIF8x+GNajCdgEa47zVboWVpPo/WhKN5G6cdLPW5G7jAEQkAgpb/d7+uCl2bR PlQhmAJy7tTKxtf6zDON0p1CF48f7CZTpG/gD2HG/vzjLRd7mx9iCONUlfh9kUyH8vCN D4aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p6EYn1BZ; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a17090ae00b00b0024e43558fbdsi1768498pjy.129.2023.05.19.08.26.58; Fri, 19 May 2023 08:27:13 -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=@kernel.org header.s=k20201202 header.b=p6EYn1BZ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232235AbjESPPe (ORCPT + 99 others); Fri, 19 May 2023 11:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbjESPPc (ORCPT ); Fri, 19 May 2023 11:15:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAAEBCF; Fri, 19 May 2023 08:15:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FF6E65897; Fri, 19 May 2023 15:15:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0896BC4339B; Fri, 19 May 2023 15:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684509330; bh=16KHEhda17R0uNXkQJHXQVrobh41ZoiUCwXJdgtxDD4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p6EYn1BZXuMfM8CtTTKN7KtAAWXREvTpcAmBw49BmFLfAExk/ZJu+zT1Bcveqew3f 4yBzHEpEFeQNIKciEdvSB+HHhL8+fUDuf+suVvtk3wnbHDHxTT29TbEI9hC9QszG7R 9l10yRvtue+XsivRFuDgsSsm9JZDlWNuYj5sCe0eZPfoN2/TtOoT9xM1lIaFy/DDQX Z0QT5Z5sbqkgYAQI8objP2GG49dMUIEuUfQd8frsG5M5Kl5c7k+9iBX6y6yl4Tkdi/ jEfC2XE07PCOrhU0wbYYoqP0JUqnaiLECjzKvze65VIfpUSSVLwjNnJGlpq/rUbngG gPWtmKCfyAcuA== Date: Fri, 19 May 2023 08:15:26 -0700 From: Jakub Kicinski To: Breno Leitao Cc: axboe@kernel.dk, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, willemdebruijn.kernel@gmail.com, courmisch@gmail.com, nhorman@tuxdriver.com, asml.silence@gmail.com, alex.aring@gmail.com, dccp@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, matthieu.baerts@tessares.net, marcelo.leitner@gmail.com, linux-wpan@vger.kernel.org, linux-sctp@vger.kernel.org, leit@fb.com, David.Laight@ACULAB.COM, dsahern@kernel.org Subject: Re: [PATCH 0/1] net: ioctl: Use kernel buffer on proto ioctl callbacks Message-ID: <20230519081526.59411533@kernel.org> In-Reply-To: <20230519135821.922326-1-leitao@debian.org> References: <20230519135821.922326-1-leitao@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Fri, 19 May 2023 06:58:20 -0700 Breno Leitao wrote: > With the implementation of network ioctl on io_uring[1], Willem > suggested[2] that the "struct proto" ioctls functions should be reused, > instead of duplicating the code. > For that, the ioctl callbacks need to be more flexible, and avoid > operating on userspace buffers (doing get/put_user()) directly on the > callbacks. This patch adds this flexibility, so, the io_uring plumbing > becomes more clean, avoiding duplicating code. This may also benefit > BPF. > > For that, a wrapper is created, which will copy from/to userspace, and > the ioctl callback will rely on the wrapper to do userspace memory > copies. > > I've tested this patch in three different ways: > 1) Created a simple testcase for TCP/UDP [3] > 2) Run relevant LTP tests, such as: sockioctl, setsockopt, bind, sendto, > fanout, ns-udpsender, etc > 3) Run basics network selftests > > PS: There are some `strcmp()` in the `sock_skprot_ioctl()`, that I was > not able to find a better way to deal with it. Any feedback is > appreciated. Why not CC netdev@ on this?