From owner-svn-src-all@freebsd.org Thu Jul 30 15:48:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E793A3A8CC1; Thu, 30 Jul 2020 15:48:47 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-eopbgr660078.outbound.protection.outlook.com [40.107.66.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BHZZk5lXJz4XRR; Thu, 30 Jul 2020 15:48:46 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RxEkNwD+dX53mGR0PtUlNMNktq5twAV2Hffpx4h211bPdnNyn1gF4wU7Kjc0Nv3s6c8/Q6XVdE4Jv3L4zhFS0ANZOyxlxZRnTi29f30NcwU7z0kag3jKeny4GxOUx2YPIs8l2fBLmCUwfv8ZkdfAAJiO29AzBT0jtnmoQzikf8rnY2A/aCZzJiUpy7NGCAvcDBdOP/T6nmWhHpOeRMQ4NUKkgesBlhkiJ1R6NFIo4qymB2JSzgfzHIPyQIeMhtUJV7cQHh2s+SiDfpHNt1QejoyhBfZ1Tf6Sr9JhwcYjLKuyROdZR0BI98X7Ygh5oWe9WbIV1Ewg+JwYcfI1+9ynlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9CcKBRaEJuijOJrMKnRObEjUu9L+pimPLQOTaCpWh8Q=; b=FM1XAaw/F+ZisXA399VOpGVHLAu9D480Ym4DmLr6NNEXOI4N6SN8ECZRB4WrnHqsE1FFPIFoXGNAAYA9ATTuu9z2+P4gaab9sxf/hMFqyWfvOjd/yU+yqiOcMQz0kMi6z3WTfcMLH0x/4MtPSE6zoEwtBQrTkw/xWaVhsqLLdb3T7aSqsr0r89B4ARYXv5QUDUt8PX+M5hZMEwH/Awcj9mQn74Gqdbr3/nfCz1PPHB5LeLpsM4BeN6BPIGKVY0ltmiXP0Eh+Kc41+6qJZfr9X7zcSgo8uYuaFzl8IYpi518rVA6D5j7z9SkWdUfUqW+JkM1/sEsYSsYqQHJcdVibyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uoguelph.ca; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9CcKBRaEJuijOJrMKnRObEjUu9L+pimPLQOTaCpWh8Q=; b=rHTxbyL/29l/rQjCWBrM6PefFaRzlbzGzCjVpIkThOkhW/JDDXGpOzN9EpCsqD27EuAukN213I+YFwUKWQqDHOZ+QsXR/P/FhNhL3LIIVKs7JB8CL0SGINoyyPsmEcC9WjUHKmCq1UG26PwOlhHvL1ujcKFaQgS9SZv8DjxH2WLqn5jSom986iKYKtMfY3SHrZ9eeIAEHrOxiwM3646SsjhyU2yGk2S6kYC/2l78U9d0gKtHa8hv/tPSHZmMWy4hcBv9d7PDSUpJ5tJAUXurSfe3YWMHS4xafXqUtOskq3bv40DNL2ixmgRVPgCciB7FInbxGp1Qhni7g6rndMV8yA== Received: from QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:38::14) by YQXPR0101MB1845.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:1e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16; Thu, 30 Jul 2020 15:48:44 +0000 Received: from QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM ([fe80::60f3:4ca2:8a4a:1e91]) by QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM ([fe80::60f3:4ca2:8a4a:1e91%7]) with mapi id 15.20.3216.033; Thu, 30 Jul 2020 15:48:34 +0000 From: Rick Macklem To: Ian Lepore , Brooks Davis , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-12@freebsd.org" Subject: Re: svn commit: r363625 - stable/12/usr.sbin/mountd Thread-Topic: svn commit: r363625 - stable/12/usr.sbin/mountd Thread-Index: AQHWZGw7l3AA2GANGkmYHY+WWlMRT6kfVzKsgAAiMQCAADpv4oAAiFtW Date: Thu, 30 Jul 2020 15:48:34 +0000 Message-ID: References: <202007272318.06RNIFjV005206@repo.freebsd.org> , <4d5b871fad9412661c3914a64c8ca0b7a01d1dc6.camel@freebsd.org>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 00af6f22-fa8d-4352-c19f-08d834a00479 x-ms-traffictypediagnostic: YQXPR0101MB1845: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MjzssD9sqDpP/QBV42oV3RFf90tfXtXtCDFa4S8/7bwbPrSLKRNi0JFcheaRICLI698xIfYGVkeV2EOfNXZ2Iaf+2CdlT0GLmeCOQx+4Ud9598HfgDDfEuzkltS07/VuPR5oarn0E3Q1fd05SZHVvPjOosIMbItrHuU9cK6gJHb/Jd/fwJdmWJ1LILpNJtD0MZ+0Wnysh48bAkECEKlp+4iAEb0byaI4K4txwcpMAKBVUtJcfSZM/IfgQ6kqXHwEFHEJD62BclQNi1evAQvdOXHrrPB9Tps22Df7V6Th67kHS9AHktBcjaM78V+vaozwbvT0hgin48Se3haNj7Ksiov7oZKwT84bt2PnxYG6qy/hy6lFFwZja2Fpn6d3xA1go8cCnZt67j/GsAVhu3BrxQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(39860400002)(346002)(376002)(136003)(396003)(366004)(450100002)(7696005)(6506007)(33656002)(52536014)(5660300002)(64756008)(71200400001)(66946007)(66446008)(66476007)(66556008)(86362001)(91956017)(76116006)(316002)(786003)(83380400001)(2906002)(55016002)(110136005)(9686003)(8936002)(2940100002)(966005)(478600001)(186003)(8676002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: TyzyOW4eTkefbN+Hmbi4z/aOJsytD6rxsm13itq7Jlq+8PznlqdUvAut/992Vq9C0GH4gCH4Mjuh1ohw1nW374NGm+QOdxWOqADzs6E8nJ3OzXQDivjksZiHn0K8HeSoFCjYX4Gdm7cN5wQz6txAYM7AKDlA8Neq2kwZtTw0NeKGPtLHCSAq0iiuERqHAagqI1E3NuPLhbr+tYOibcpgbE/8KyYtubV3qxsw17wJsBcVzkC5iBmBVvf/WFbKFfor3ekniPkDcjZIYPqL5X0ZlIdsY2E7pJmkXBKBIhfM8vUm96HfLRbW2XgYFudjAVxZB7ZnXJHuIjQPtd+b/V26ghOvKtspHE2NPLxNeeYmtFRqdklWNKDcCLmVZzwwElt6nqXazHsfeiXpfxTweZWcIllQccuolVN4XQXvK14PEsq+Zyd0zeUVcqaUBkTlJgK64xHkKEn7w5IGLDYwVFtuagARZfT82fUX5QRQioHCflNHrofW596aXEdoQUuXyq6Taw78fAvP+GjxRaki3BEeD0V2iVYATPpOgOUoz9BCOtiJMeL1MRhY82qe7XCUeLX0xgShHlI3GeBWMIgYHmQrOSQf0owb01Hz72YlJLUzsId9PRad6xp1erhIp9rcnKpjC9qYiZSXxAq11yNP3J7aPiby9QNjy55MHY06QKx9Xy/u9LNTwD8bi/yznG3iajrPdvUm0S5XBizdgOZ4EFxkPQ== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 00af6f22-fa8d-4352-c19f-08d834a00479 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2020 15:48:34.6325 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: U9wkhxTVIA9wjLRCZF8KVWJHTii023a1avHhyx9pl6+w21UTy7t4IXQQN04l6+YPOT3xF7keKQrj0n+G4yS/bA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR0101MB1845 X-Rspamd-Queue-Id: 4BHZZk5lXJz4XRR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=uoguelph.ca header.s=selector1 header.b=rHTxbyL/; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.66.78 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-4.66 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.995]; R_DKIM_ALLOW(-0.20)[uoguelph.ca:s=selector1]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; NEURAL_HAM_LONG(-1.04)[-1.036]; RCPT_COUNT_FIVE(0.00)[6]; DWL_DNSWL_LOW(-1.00)[uoguelph.ca:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[uoguelph.ca:+]; NEURAL_HAM_SHORT(-0.13)[-0.133]; RCVD_IN_DNSWL_NONE(0.00)[40.107.66.78:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:8075, ipnet:40.104.0.0/14, country:US]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; RWL_MAILSPIKE_POSSIBLE(0.00)[40.107.66.78:from] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2020 15:48:48 -0000 Rick Macklem wrote:=0A= >Ian Lepore wrote:=0A= >>On Thu, 2020-07-30 at 01:52 +0000, Rick Macklem wrote:=0A= >>> Brooks Davis wrote:=0A= >>> > Author: brooks=0A= >>> > Date: Mon Jul 27 23:18:14 2020=0A= >>> > New Revision: 363625=0A= >>> > URL: https://svnweb.freebsd.org/changeset/base/363625=0A= >>> >=0A= >>> > Log:=0A= >>> > MFC r363439:=0A= >>> >=0A= >>> > Correct a type-mismatch between xdr_long and the variable "bad".=0A= >>> >=0A= >>> > [...]=0A= >>> --> I can't see how the xdr.c code would work for a machine that is=0A= >>> BIG_ENDIAN and where "long" is 64bits, but we don't have any of=0A= >>> those.=0A= >>>=0A= >>=0A= >>mips64 and powerpc64 are both big endian with 64-bit long.=0A= >Oops, I didn't know that. In the past, I've run PowerPC and MIPS, but thou= ght=0A= >they both were little endian. (I recall the arches can be run either way.)= =0A= >=0A= >Anyhow, take a look at head/lib/libc/xdr/xdr.c and it looks to me like it= =0A= >has been broken "forever" (ever since we stopped using a K&R compiler=0A= >that would have always made "long" 32bits).=0A= OK, I took another look at xdr.c and it isn't broken as I thought.=0A= =0A= xdr_long() takes a "long *" argument ("long" in Sun XDR is 32bits),=0A= but then it only passes it as an argument to XDR_PUTLONG(), which is actual= ly=0A= a call to xdrmem_putlong_aligned() or xdrmem_putlong_unaligned().=0A= For xdrmem_putlong_aligned(), the line is:=0A= *(u_int32_t *)xdrs->x_private =3D htonl((u_int32_t)*lp);=0A= --> where lp is a "long *"=0A= =0A= I'll admit I'm not 100% sure if "(u_int32_t)*lp" gets the correct 32bits of= a 64bit=0A= long pointer for all arches? (I'm not very good at knowing what type casts = do.)=0A= If this is the equivalent of "u_int32_t t; t =3D *lp; htonl(t); then I thin= k the code is ok?=0A= (At least it makes it clear that it is using 32bits of the value pointed to= by the=0A= argument.)=0A= =0A= For xdrmem_putlong_unaligned(), it does the same thing via:=0A= u_int32_t l;=0A= =85.=0A= l =3D htonl((u_int32_t)*lp);=0A= =0A= --> At least the man page for xdr_long() should be clarified to note it=0A= puts a 32bit quantity on the wire.=0A= =0A= >If anyone has either of these and can set up an NFS server on one of=0A= >them and then try and do an NFSv3 mount that is not allowed, it would=0A= >be interesting to see the packet trace and if the MNT RPC fails, because= =0A= >it looks like it will put the high order 32bits on the wire and they'll=0A= >always be 0?=0A= It would still be interesting to test this on a 64bit big endian, but so lo= ng as=0A= the above cast works, it does look like it works for all arches.=0A= =0A= >Just to clarify. The behaviour wasn't broken by this commit. I just=0A= >don't see how the commit fixes anything?=0A= My mistake. Sorry for the noise.=0A= =0A= I now think the commit is correct since it uses "*lp" to get the value befo= re=0A= casting it down to 32bits. Passing in an "int *" was incorrect.=0A= =0A= The code does seem to handle "long *" for 64bit arches, although it=0A= only puts 32bits "on-the-wire".=0A= =0A= rick, who was confused because he knew there was only supposed to be=0A= 32bits go on the wire.=0A= =0A= -- Ian=0A= =0A= =0A= =0A=