From owner-freebsd-hackers@freebsd.org Sun Feb 21 00:05:07 2021 Return-Path: Delivered-To: freebsd-hackers@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 49AB753D030 for ; Sun, 21 Feb 2021 00:05:07 +0000 (UTC) (envelope-from chrisj@rtems.org) Received: from nsstlmta34p.bpe.bigpond.com (nsstlmta34p.bpe.bigpond.com [203.38.21.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "", Issuer "Openwave Messaging Inc." (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Djltn5TvCz4tm1 for ; Sun, 21 Feb 2021 00:05:05 +0000 (UTC) (envelope-from chrisj@rtems.org) Received: from smtp.telstra.com ([10.10.24.4]) by nsstlfep34p-svc.bpe.nexus.telstra.com.au with ESMTP id <20210221000456.KNUP12830.nsstlfep34p-svc.bpe.nexus.telstra.com.au@smtp.telstra.com>; Sun, 21 Feb 2021 11:04:56 +1100 X-RG-Spam: Unknown X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgeduledrjeelgdduhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfupfevtfgpvffgnffuvffttedpqfgfvfenuceurghilhhouhhtmecugedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffhvfhfohfkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeevhhhrihhsucflohhhnhhsuceotghhrhhishhjsehrthgvmhhsrdhorhhgqeenucggtffrrghtthgvrhhnpeeuteekvdevffefteetgeehtefhtefffefgjeduveduleehgffggfehffeiffeuleenucffohhmrghinhepfhhrvggvsghsugdrohhrghenucfkphepudefledrudeftddrvdeghedrvddttdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehmrghilhdrtghonhhtvghmphhorhgrrhihrdhnvghtrdgruhdpihhnvghtpedufeelrddufedtrddvgeehrddvtddtpdhmrghilhhfrhhomhepoegthhhrihhsjhesrhhtvghmshdrohhrgheqpdhrtghpthhtohepoehfrhgvvggsshguqdhhrggtkhgvrhhssehfrhgvvggsshgurdhorhhgqedprhgtphhtthhopeeorhhmrggtkhhlvghmsehuohhguhgvlhhphhdrtggrqe X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean X-RG-VS-CLASS: clean Received: from mail.contemporary.net.au (139.130.245.200) by smtp.telstra.com (5.8.420) id 5FE6CCD00FD4EFBF; Sun, 21 Feb 2021 11:04:55 +1100 Received: from [10.10.11.8] ([10.10.11.8]) (authenticated bits=0) by mail.contemporary.net.au (8.15.2/8.15.2) with ESMTPSA id 11L04qX4046725 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 21 Feb 2021 11:04:52 +1100 (EST) (envelope-from chrisj@rtems.org) Subject: Re: sys/fs/nfsclient ACCESS attributes with RTEMS From: Chris Johns To: Rick Macklem , "freebsd-hackers@freebsd.org" References: <0e14503a-ca7b-cd0f-6472-289fc9ac301b@rtems.org> <5f66e68f-2979-dd14-f8f4-ee2bed0a5f43@rtems.org> Organization: https://www.rtems.org/ Message-ID: <5140b8d9-7f98-cd7d-eac0-9f938d73d320@rtems.org> Date: Sun, 21 Feb 2021 11:04:52 +1100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <5f66e68f-2979-dd14-f8f4-ee2bed0a5f43@rtems.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-102.9 required=2.7 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,USER_IN_WELCOMELIST,USER_IN_WHITELIST autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on corb.contemporary.net.au X-Rspamd-Queue-Id: 4Djltn5TvCz4tm1 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of chrisj@rtems.org has no SPF policy when checking 203.38.21.34) smtp.mailfrom=chrisj@rtems.org X-Spamd-Result: default: False [-1.22 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.02)[-0.024]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_LOW(-0.10)[203.38.21.34:from]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[203.38.21.34:from]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:1221, ipnet:203.36.0.0/14, country:AU]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[rtems.org]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[203.38.21.34:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 00:05:07 -0000 On 21/2/21 9:39 am, Chris Johns wrote: > On 21/2/21 3:13 am, Rick Macklem wrote: >> Chris Johns wrote: >> If you test against a FreeBSD server, you can "sysctl vfs.nfsd.debuglevel=4" and >> make it pretty chatty to help figure out what is going on. > > Thanks, I will have a look. I have isolated a potential reason. The FreeBSD > client has this in the RPC header: > > Credentials > Flavor: AUTH_UNIX (1) > Length: 32 > Stamp: 0x5e72fba7 > Machine Name: ruru > length: 4 > contents: ruru > UID: 0 > GID: 0 > Auxiliary GIDs (2) [0, 5] > GID: 0 > GID: 5 > > and my RTEMS client has: > > Credentials > Flavor: AUTH_UNIX (1) > Length: 20 > Stamp: 0x21dae501 > Machine Name: > length: 0 > contents: > UID: 65536 I have traced the error down to this piece of code in rpc [1]: if (!xdr_uint32_t(xdrs, &cred->cr_uid)) return (FALSE); if (!xdr_uint32_t(xdrs, &cred->cr_groups[0])) return (FALSE); On RTEMS uid_t is int and this creates an incompatible pointer... (gdb) p /x *(uint32_t*)&cred->cr_uid $15 = 0x10000 Assigning the uid to the local junk variable and using that fixes my perms issue and I can make a directory. Chris [1] https://cgit.freebsd.org/src/tree/sys/rpc/authunix_prot.c#n100