Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4308255rwd; Sun, 4 Jun 2023 02:22:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7kq0cNFIskIOhq8PFvwY6ZZ1EBPSF+UIlFoLU8ddJjqu0Dp7Z+n4LI6wpVSlezDME2v6ET X-Received: by 2002:a54:4886:0:b0:398:f91:9660 with SMTP id r6-20020a544886000000b003980f919660mr5104596oic.47.1685870526867; Sun, 04 Jun 2023 02:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685870526; cv=none; d=google.com; s=arc-20160816; b=HZQpVO8NHQuft5hB2bmtZfxBFV2/CH+3omgUuPf7MtqMHeK08fnF+hGCVkIaAlPlYE o9Fv3PUa1RDkcqOdo6X3zKBLX4/kUEDa/wdeGJ/NcdmZPxLWvmwMm1ygrX2aOwmGb2/6 4t7gSZJnLgxUj6YNYkZcVTCaIpWyGyC5Eao73QqKuYcuZ7SO6Tbzf0mP623OJRNvMx1l 3RiJHxsC5gaboB7JReNRLXIG3UGTsL8Oe0AGdFwk8ArlrWr1bRKMZMgjwiDsdfAR7v+W LM94Bf8kdjbnHsfeQ9gOGRjjmIXyV9QBF1CL44Fv8/N61KeB1ew4eTHiRDHBhFHjFeA/ Zzlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=aox3XK8tx72aeNja1udkD88JAZ0aWEszFBLsOxbe+fI=; b=h01En2ColW5jVzDsF3IXENRj6CNcdHZKcGXPgRnyDBaJgNTO0W0tryzTGJb14b2Ef8 0SdZviwWl7AoL2DhYgXJj+h6VjJr729AEN3BiUXbVf7UwO8H+H1B6oN7lCeSsB/Puzn5 DcLQWdnSjB/sWUU+NAIAvC61u2E7z/go01g6AC9B12tR5PQuSjiCw7l6E80mxPgy+pxf wpRXi0I6Xo62U/0Dv2j2KZbzri4sBxdtMJtb86m2AE4YtAD6RAnuJtd7n1R5KUCIM6vm 8BgxZpi22fIkzBqp7I6RvUNX7bZW6+8wLAKyzg9enZ9NDCmFdz00c3p83Uv4LIQkoWCZ FtyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rSfoJfS2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a17090aec0500b0025684ce9c40si3916790pjy.83.2023.06.04.02.21.55; Sun, 04 Jun 2023 02:22:06 -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=@gmail.com header.s=20221208 header.b=rSfoJfS2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbjFDJSh (ORCPT + 99 others); Sun, 4 Jun 2023 05:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjFDJSg (ORCPT ); Sun, 4 Jun 2023 05:18:36 -0400 Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36713B1; Sun, 4 Jun 2023 02:18:35 -0700 (PDT) Received: by mail-vk1-xa32.google.com with SMTP id 71dfb90a1353d-4652fcb2ac1so54031e0c.1; Sun, 04 Jun 2023 02:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685870314; x=1688462314; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aox3XK8tx72aeNja1udkD88JAZ0aWEszFBLsOxbe+fI=; b=rSfoJfS2X8Zx0gaX8WEMmFcIYgSg25rCZ+TYlggJeZcpKateZrWXEbic+aLXjMv2GR gjjZI0N+ru+UqG9tRNfDeqiJB9NSP/YBse9KnKB4ov97mKBPgeYSpjB+I+rJFaeRquxk Q8kCSN4N48veUEAxUTT3rcE0aHfP3FIjZ5UCEANBn5J4AFUCV8SdSYuZcSnKYoGqxtOA x3hNvruleQUDpiRe8e2S6c9ZDbAhV10jcwWwQ9w65XG/9MX7IGHroZUMTKUtepX057C3 9CVX+K1Y0WwQvZQFvme2NWhA1VtLGqamnw7qtm4ZCD+1CyeTsOEc6lTtRVdp06jsDWDF N9QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685870314; x=1688462314; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aox3XK8tx72aeNja1udkD88JAZ0aWEszFBLsOxbe+fI=; b=gTHDl2qU1P2foAPXvM+sqNzoaVwA3l8cpJS/fXb9nSiBFTS+YGMoKc/+Hdf813BLME BL3PzG5sB161/Ukg7kK3T9FGTmECloWdl3TfkH7aJBAdzSKSi9sVdJNQMvNyUKhrue/s S/0pu2WMP11tjzld3zxQ41y2d1xMULMqHxPqa+IraTRMSxVABdHyEUjgV0+6LYHFDfSi 1RZeZSUC1tJGUgMJZjnPU8s2mTuABX0DyP+y7opV77Gj+Hsp1koBlR/NXP+JISFjmZnD rjMILkymIxf6PmD3enKKu4gprClM87zlWaL/OHOeE+bT4EwSOcaXQLPwmS1urS9vdTmO N/dA== X-Gm-Message-State: AC+VfDy+VkvvloSnw5x8g8kOGY9zacntpbqXmnRNgOQbVKlZ2VWOswA/ M28ksQDGgWUo/lrXtHU2UYvSvRwrd1MLxVipRQ0= X-Received: by 2002:a1f:45d5:0:b0:460:d627:22ca with SMTP id s204-20020a1f45d5000000b00460d62722camr2332346vka.1.1685870314156; Sun, 04 Jun 2023 02:18:34 -0700 (PDT) MIME-Version: 1.0 References: <20230602163044.1820619-1-leitao@debian.org> In-Reply-To: From: Willem de Bruijn Date: Sun, 4 Jun 2023 11:17:56 +0200 Message-ID: Subject: Re: [PATCH net-next v5] net: ioctl: Use kernel memory on protocol ioctl callbacks To: Breno Leitao Cc: Remi Denis-Courmont , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexander Aring , Stefan Schmidt , Miquel Raynal , David Ahern , Matthieu Baerts , Mat Martineau , Marcelo Ricardo Leitner , Xin Long , axboe@kernel.dk, asml.silence@gmail.com, leit@fb.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, dccp@vger.kernel.org, linux-wpan@vger.kernel.org, mptcp@lists.linux.dev, linux-sctp@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Sat, Jun 03, 2023 at 10:21:50AM +0200, Willem de Bruijn wrote: > > On Fri, Jun 2, 2023 at 6:31=E2=80=AFPM Breno Leitao = wrote: > > > Signed-off-by: Breno Leitao > > > > Please check the checkpatch output > > > > https://patchwork.hopto.org/static/nipa/753609/13265673/checkpatch/stdo= ut > > I am checking my current checkpatch before sending the patch, but I am > not seeing the problems above. > > My tree is at 44c026a73be8038 ("Linux 6.4-rc3"), and I am not able to > reproduce the problems above. > > $ scripts/checkpatch.pl v5/v5-0001-net-ioctl-Use-kernel-memory-on= -protocol-ioctl-cal.patch > total: 0 errors, 0 warnings, 0 checks, 806 lines checked > v5/v5-0001-net-ioctl-Use-kernel-memory-on-protocol-ioctl-cal.patc= h has no obvious style problems and is ready for submission. > > Let me investigate what options I am missing when running checkpatch. The reference is to the checkpatch as referenced by patchwork: https://patchwork.kernel.org/project/netdevbpf/patch/20230602163044.1820619= -1-leitao@debian.org/ The 80 character limit is a soft limit. But also note the CHECK statements on whitespace. > > > > +/* A wrapper around sock ioctls, which copies the data from userspac= e > > > + * (depending on the protocol/ioctl), and copies back the result to = userspace. > > > + * The main motivation for this function is to pass kernel memory to= the > > > + * protocol ioctl callbacks, instead of userspace memory. > > > + */ > > > +int sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) > > > +{ > > > + int rc =3D 1; > > > + > > > + if (sk_is_ipmr(sk)) > > > + rc =3D ipmr_sk_ioctl(sk, cmd, arg); > > > + else if (sk_is_icmpv6(sk)) > > > + rc =3D ip6mr_sk_ioctl(sk, cmd, arg); > > > + else if (sk_is_phonet(sk)) > > > + rc =3D phonet_sk_ioctl(sk, cmd, arg); > > > > Does this handle all phonet ioctl cases correctly? > > > > Notably pn_socket_ioctl has a SIOCPNGETOBJECT that reads and writes a u= 16. > > We are not touching "struct proto_ops" in this patch at all. And > pn_socket_ioctl() is part of "struct proto_ops". > > const struct proto_ops phonet_stream_ops =3D { > ... > .ioctl =3D pn_socket_ioctl, > } > > That said, all the "struct proto_ops" ioctl calls backs continue to use > "unsigned long arg" with userspace information, at least for now. Ok. Perhaps good to call out in the commit message that this does not convert all protocol ioctl callbacks.