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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAB07EB64DC for ; Sat, 24 Jun 2023 20:50:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B5D8D8601B; Sat, 24 Jun 2023 22:49:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="q/zWWOYa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DE06E80181; Sat, 24 Jun 2023 22:49:16 +0200 (CEST) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E90EB8603A for ; Sat, 24 Jun 2023 22:49:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-777a4c8e8f4so98159139f.3 for ; Sat, 24 Jun 2023 13:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1687639741; x=1690231741; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jQZJNy8Y4fIxt6Ah0xPGUPi8XsqJ6yjf29HwdzzeasY=; b=q/zWWOYaazdM84l3mbxhYOi3fnMHgF77Z2kdT274e/V6RM5dNkT7tPfZI8yuUye+4N dHiQRHYYY+3OzQ8ZjleP1SaZKfDCyVfcRs63WPSekuAsLZdmKfksLJVmUWPuZN5JeOgB pSKw8K7czIUOUO0Vop3OKxkiIGBmP7Y/arcyk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687639741; x=1690231741; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jQZJNy8Y4fIxt6Ah0xPGUPi8XsqJ6yjf29HwdzzeasY=; b=H/UK7lOJ6THWzOXY7Oc+qVd+50wsd53txtFLDVgFFNU/Z4eY1KAa9J3sHaGSr3gbrN HjNyGjN3cQyZyvmVFEblhq3IuR3wGkMn7vxBfV9VnWnKW9s3lNCj3EO1/8FHZUWvq39H DUgRk/Q9QwXyCPNaV+G+jGf0a6/hlnIgo9DCVe1hvcYjUy+CpEShYwqiRLGmX8BAr3KR wy4mueSJiV/eV3caK3xH7jSJ6O7yswadT7Umk3YvUJ2JDU1FRyE14gtBBeByCOzoqvmu eYyXJEunls+h/o+HOfKLrmyeymTR6YrT2YnGbqImUJ5xoC9FvPXHas946NOF3uPaQRaL symA== X-Gm-Message-State: AC+VfDxFiUlCGG3cDLIV/8/XQ1xYD3QpNN+ogWeFZCGVXxEtb7Eh8ZcY YzZJSAs50KVyqa2MytccEQ0wAzqN+MUVxkVoyDFpGw== X-Google-Smtp-Source: ACHHUZ7D/0LSZaX70UpG4vUFZB0cghliDZu2GJRI55cyokDbX1YEWA59Yw74cNHENdEUFz7hY1Ib7Q== X-Received: by 2002:a25:acd4:0:b0:ba8:ae3a:dd39 with SMTP id x20-20020a25acd4000000b00ba8ae3add39mr24736071ybd.43.1687625885018; Sat, 24 Jun 2023 09:58:05 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-da61-6355-3777-b00c.res6.spectrum.com. [2603:6081:7b00:6400:da61:6355:3777:b00c]) by smtp.gmail.com with ESMTPSA id l12-20020a25ad4c000000b00bebeeacb19fsm402669ybe.22.2023.06.24.09.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jun 2023 09:58:04 -0700 (PDT) Date: Sat, 24 Jun 2023 12:58:02 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Christian Gmeiner , Stefan Roese , Joe Hershberger , Ramon Fried , open list , Thomas RIENOESSL Subject: Re: [PATCH v2 4/4] net: add NFSv1 support Message-ID: <20230624165802.GW3931582@bill-the-cat> References: <20230310095155.29832-1-christian.gmeiner@gmail.com> <20230310095155.29832-5-christian.gmeiner@gmail.com> <20230611125424.3yxonqq5ddxxkoys@pali> <20230611151050.65treh5zfaer2gkc@pali> <20230624090511.hik6suse7ubcklou@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Gfu++o+LS48X5Xv8" Content-Disposition: inline In-Reply-To: <20230624090511.hik6suse7ubcklou@pali> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean --Gfu++o+LS48X5Xv8 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 24, 2023 at 11:05:11AM +0200, Pali Roh=E1r wrote: > On Sunday 11 June 2023 17:24:50 Christian Gmeiner wrote: > > Am So., 11. Juni 2023 um 17:10 Uhr schrieb Pali Roh=E1r : > > > > > > On Sunday 11 June 2023 16:57:07 Christian Gmeiner wrote: > > > > Hello > > > > > > > > > > > > > > Hello! I must admit that this patch is broken and does not add an= y NFSv1 > > > > > support. Just look below.... > > > > > > > > > > > > > So .. let see what happend here. > > > > > > > > > On Friday 10 March 2023 10:51:55 Christian Gmeiner wrote: > > > > > > From: Thomas RIENOESSL > > > > > > > > > > > > NFSv1 support added by Christian Gmeiner, Thomas Rienoessl, > > > > > > September 27, 2018. As of now, NFSv3 is the default choice. > > > > > > if the server does not support NFSv3, we fall back to > > > > > > versions 2 or 1. > > > > > > > > > > > > Signed-off-by: Thomas RIENOESSL > > > > > > --- > > > > > > net/nfs.c | 42 +++++++++++++++++++++++++++++++++--------- > > > > > > 1 file changed, 33 insertions(+), 9 deletions(-) > > > > > > > > > > > > diff --git a/net/nfs.c b/net/nfs.c > > > > > > index 21cae52f35..7a8887ef23 100644 > > > > > > --- a/net/nfs.c > > > > > > +++ b/net/nfs.c > > > > > > @@ -26,6 +26,10 @@ > > > > > > * NFSv2 is still used by default. But if server does not supp= ort NFSv2, then > > > > > > * NFSv3 is used, if available on NFS server. */ > > > > > > > > > > > > +/* NOTE 5: NFSv1 support added by Christian Gmeiner, Thomas Ri= enoessl, > > > > > > + * September 27, 2018. As of now, NFSv3 is the default choice.= If the server > > > > > > + * does not support NFSv3, we fall back to versions 2 or 1. */ > > > > > > + > > > > > > #include > > > > > > #include > > > > > > #include > > > > > > @@ -78,6 +82,7 @@ static char nfs_path_buff[2048]; > > > > > > > > > > > > enum nfs_version { > > > > > > NFS_UNKOWN =3D 0, > > > > > > + NFS_V1 =3D 1, > > > > > > NFS_V2 =3D 2, > > > > > > NFS_V3 =3D 3, > > > > > > }; > > > > > > @@ -192,6 +197,7 @@ static void rpc_req(int rpc_prog, int rpc_p= roc, uint32_t *data, int datalen) > > > > > > switch (rpc_prog) { > > > > > > case PROG_NFS: > > > > > > switch (choosen_nfs_version) { > > > > > > + case NFS_V1: > > > > > > case NFS_V2: > > > > > > rpc_pkt.u.call.vers =3D htonl(2); > > > > > > > > > > So if NFSv1 is chosen then this code uses NFSv2. This is either r= ebasing > > > > > problem or just prove that this patch does not add any NFSv1 supp= ort. > > > > > > > > > > > break; > > > > > > @@ -205,8 +211,26 @@ static void rpc_req(int rpc_prog, int rpc_= proc, uint32_t *data, int datalen) > > > > > > break; > > > > > > } > > > > > > break; > > > > > > - case PROG_PORTMAP: > > > > > > case PROG_MOUNT: > > > > > > + switch (choosen_nfs_version) { > > > > > > + case NFS_V1: > > > > > > + rpc_pkt.u.call.vers =3D htonl(1); > > > > > > + break; > > > > > > > > > > And later here for NFSv1 we are trying to use Mount Server, which= NFSv1 > > > > > did not use at all. So this patch really does not have to work wi= th old > > > > > NFSv1 servers. > > > > > > > > > > Instead NFSv1 uses NFSPROC_ROOT RPC call exported by NFS server. > > > > > (See that this RPC call is deprecated in NFSv2 and MNT server is = used > > > > > in NFSv2 instead.) > > > > > > > > > > MNTv1 is service used by the NFSv2 and it returns NFSv2 file hand= les > > > > > (not NFSv1 file handles). MNTv2 is also used by NFSv2 and as addi= tion to > > > > > MNTv1, it adds DIRPATH rpc call. So if NFSv2 does not need to use > > > > > DIRPATH then it is fine to use just MNTv1 in NFSv2. > > > > > > > > > > > + > > > > > > + case NFS_V2: > > > > > > + rpc_pkt.u.call.vers =3D htonl(2); > > > > > > + break; > > > > > > + > > > > > > + case NFS_V3: > > > > > > + rpc_pkt.u.call.vers =3D htonl(3); > > > > > > + break; > > > > > > + > > > > > > + case NFS_UNKOWN: > > > > > > + /* nothing to do */ > > > > > > + break; > > > > > > + } > > > > > > + break; > > > > > > + case PROG_PORTMAP: > > > > > > default: > > > > > > rpc_pkt.u.call.vers =3D htonl(2); /* portmapper i= s version 2 */ > > > > > > } > > > > > > @@ -311,7 +335,7 @@ static void nfs_readlink_req(void) > > > > > > p =3D &(data[0]); > > > > > > p =3D rpc_add_credentials(p); > > > > > > > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) { > > > > > > + if (choosen_nfs_version !=3D NFS_V3) { > > > > > > memcpy(p, filefh, NFS_FHSIZE); > > > > > > p +=3D (NFS_FHSIZE / 4); > > > > > > } else { /* NFS_V3 */ > > > > > > @@ -340,7 +364,7 @@ static void nfs_lookup_req(char *fname) > > > > > > p =3D &(data[0]); > > > > > > p =3D rpc_add_credentials(p); > > > > > > > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) { > > > > > > + if (choosen_nfs_version !=3D NFS_V3) { > > > > > > memcpy(p, dirfh, NFS_FHSIZE); > > > > > > p +=3D (NFS_FHSIZE / 4); > > > > > > *p++ =3D htonl(fnamelen); > > > > > > @@ -380,7 +404,7 @@ static void nfs_read_req(int offset, int re= adlen) > > > > > > p =3D &(data[0]); > > > > > > p =3D rpc_add_credentials(p); > > > > > > > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) { > > > > > > + if (choosen_nfs_version !=3D NFS_V3) { > > > > > > memcpy(p, filefh, NFS_FHSIZE); > > > > > > p +=3D (NFS_FHSIZE / 4); > > > > > > *p++ =3D htonl(offset); > > > > > > @@ -410,13 +434,13 @@ static void nfs_send(void) > > > > > > > > > > > > switch (nfs_state) { > > > > > > case STATE_PRCLOOKUP_PROG_MOUNT_REQ: > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) > > > > > > + if (choosen_nfs_version !=3D NFS_V3) > > > > > > rpc_lookup_req(PROG_MOUNT, 1); > > > > > > else /* NFS_V3 */ > > > > > > rpc_lookup_req(PROG_MOUNT, 3); > > > > > > break; > > > > > > case STATE_PRCLOOKUP_PROG_NFS_REQ: > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) > > > > > > + if (choosen_nfs_version !=3D NFS_V3) > > > > > > rpc_lookup_req(PROG_NFS, 2); > > > > > > else /* NFS_V3 */ > > > > > > rpc_lookup_req(PROG_NFS, 3); > > > > > > @@ -457,7 +481,7 @@ static int rpc_handle_error(struct rpc_t *r= pc_pkt) > > > > > > const int min =3D ntohl(rpc_pkt->u.reply.= data[0]); > > > > > > const int max =3D ntohl(rpc_pkt->u.reply.= data[1]); > > > > > > > > > > > > - if (max < NFS_V2 || max > NFS_V3 || min >= NFS_V3) { > > > > > > + if (max < NFS_V1 || max > NFS_V3 || min >= NFS_V3) { > > > > > > puts("*** ERROR: NFS version not = supported"); > > > > > > debug(": Requested: V%d, accepted= : min V%d - max V%d\n", > > > > > > choosen_nfs_version, > > > > > > @@ -588,7 +612,7 @@ static int nfs_lookup_reply(uchar *pkt, uns= igned len) > > > > > > if (ret) > > > > > > return ret; > > > > > > > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) { > > > > > > + if (choosen_nfs_version !=3D NFS_V3) { > > > > > > if (((uchar *)&(rpc_pkt.u.reply.data[0]) - (uchar= *)(&rpc_pkt) + NFS_FHSIZE) > len) > > > > > > return -NFS_RPC_DROP; > > > > > > memcpy(filefh, rpc_pkt.u.reply.data + 1, NFS_FHSI= ZE); > > > > > > @@ -712,7 +736,7 @@ static int nfs_read_reply(uchar *pkt, unsig= ned len) > > > > > > if (!(nfs_offset % ((NFS_READ_SIZE / 2) * 10))) > > > > > > putc('#'); > > > > > > > > > > > > - if (choosen_nfs_version =3D=3D NFS_V2) { > > > > > > + if (choosen_nfs_version !=3D NFS_V3) { > > > > > > rlen =3D ntohl(rpc_pkt.u.reply.data[18]); > > > > > > data_ptr =3D (uchar *)&(rpc_pkt.u.reply.data[19]); > > > > > > } else { /* NFS_V3 */ > > > > > > -- > > > > > > 2.39.2 > > > > > > > > > > > > > > > > And looking at the other changes here, there is really _no_ code = which > > > > > adds NFSv1 support. > > > > > > > > > > So what is this patch doing? The only thing which it does is that= for > > > > > NFSv1 requests it does NFSv2 calls. On every place is just check = that > > > > > choosen_nfs_version is not NFS_V3. > > > > > > > > > > Which just basically duplicates NFSv2 to be used two times. > > > > > > > > > > I would suggest to revisit this patch (who reviewed it at all?) = and > > > > > either fix it or revert it. And of course properly test it. (And I > > > > > really curious where you find NFSv1 server because Linux has alre= ady > > > > > removed also NFSv2 support from userspace...) > > > > > > > > Soo. I had a look at RFC 1094 and this patch adds version one of the > > > > mount protocol. > > > > I am quite unhappy that we got into this state, but the company I > > > > worked for uses the > > > > term NFSv1 for this in all their configuration tools etc. > > > > What would you suggest to improve this situation? > > > > > > Suggestion: Revert this one patch, then figure out what is needed to = be > > > supported (describe all details what kind of protocol and what packets > > > needs to be send and received), find a way and discuss how to impleme= nt > > > it and prepare patch for the review. > >=20 > > Here comes a big problem: "find a way and discuss how to implement it > > and prepare patch for the review." > > I am not sure if there is really someone interested in discussion > > about this topic and it is > > even harder to find someone that reviews U-Boot patches. And this is > > not specific to networking stuff. > >=20 > > I can prepare a patch that reworks the current implementation (without > > a revert) and send it out. >=20 > So how to handle this issue? Release date of u-boot is coming and this > issue have not been addressed or discussed yet. >=20 > As I wrote I can help in this area, but I doubt that we will be able to > everything before release. >=20 > Tom, could you do something here? I don't see a reason to revert this patch as Christian has promised a follow-up to address things. Using the nfs command (not to be confused with root=3D/dev/nfs) isn't part of any in-tree default environment so I don't have a concern about this exposing some security issue. --=20 Tom --Gfu++o+LS48X5Xv8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmSXIJoACgkQFHw5/5Y0 tyzfHQwAgeB4yLhtLKZzslOcqbZz5ugkv7/5scRlR1p/LlHlICCyj+vUV2rZxRjo jcUcUotJrd+GmqNgTRKdkYnWNA8ZojYm6tWk3Gi/OqTQcEv4mitvyevuQHXi2f0u 65Z0ZStKBeW7r++AyosEVIs3Du7kgMMcUA4tgQBROUtZdRG+tfGySfBi6JunvlS9 TPvQKkySam1kJrI1H9nsWwiuDCSoyoESk3tYb1xR4FaQpZRuxacu6M2G7CsT/kYy t/C5Ti/WSfPWZJCEPcoU+Gk1K1EPdSYEdUKEMXJOjfA0NKxKx9jYtso6WF7niuV9 yt1BGSSF2R6FPByH+htYXXTnQFdfujmJYjlDimbhIafqUTV60PpjKCJf9SgneoEC 6eyVxjZcWizQCmUdMvR2Lif1YBORnLdi2Yrgsd95+hk8bVXAD5yxJixb421uOija pLeEtvN3ip5HR4W8+Cx3bKsU5VhS78jklH+gLFhrmEKUZ1qFdGVFmOq4zTNZQ2vp YgHTCNfV =880s -----END PGP SIGNATURE----- --Gfu++o+LS48X5Xv8--