From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C065C7EE2A for ; Fri, 19 May 2023 15:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232274AbjESPPf (ORCPT ); Fri, 19 May 2023 11:15:35 -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 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?