From owner-dev-commits-src-all@freebsd.org Sat Jun 26 22:46:58 2021 Return-Path: Delivered-To: dev-commits-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 A5B8E65AE60; Sat, 26 Jun 2021 22:46:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GC8BV4LRhz3tHC; Sat, 26 Jun 2021 22:46:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CF0E26F47; Sat, 26 Jun 2021 22:46:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15QMkwhP041547; Sat, 26 Jun 2021 22:46:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15QMkwf8041546; Sat, 26 Jun 2021 22:46:58 GMT (envelope-from git) Date: Sat, 26 Jun 2021 22:46:58 GMT Message-Id: <202106262246.15QMkwf8041546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 0da79992428f - stable/13 - nfsd: Delete extraneous NFSv4 root checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0da79992428fb154cacfb58ca230bfdec8895958 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jun 2021 22:46:58 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=0da79992428fb154cacfb58ca230bfdec8895958 commit 0da79992428fb154cacfb58ca230bfdec8895958 Author: Rick Macklem AuthorDate: 2021-06-01 02:41:17 +0000 Commit: Rick Macklem CommitDate: 2021-06-26 22:43:49 +0000 nfsd: Delete extraneous NFSv4 root checks There are several NFSv4.1/4.2 server operation functions which have unneeded checks for the NFSv4 root being set up. The checks are not needed because the operations always follow a Sequence operation, which performs the check. This patch deletes these checks, simplifying the code so that a future patch that fixes the checks to conform with RFC5661 Sec. 2.6 will be less extension. (cherry picked from commit 1d4afcaca282f4ba249d8508f4149d9c0b058492) --- sys/fs/nfsserver/nfs_nfsdserv.c | 68 ----------------------------------------- 1 file changed, 68 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 5d3c6f65ced0..329c096c7570 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -4523,10 +4523,6 @@ nfsrvd_reclaimcomplete(struct nfsrv_descript *nd, __unused int isdgram, uint32_t *tl; int error = 0, onefs; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); /* * I believe that a ReclaimComplete with rca_one_fs == TRUE is only @@ -4644,10 +4640,6 @@ nfsrvd_freestateid(struct nfsrv_descript *nd, __unused int isdgram, int error = 0; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID); stateid.seqid = fxdr_unsigned(uint32_t, *tl++); NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER); @@ -4694,10 +4686,6 @@ nfsrvd_layoutget(struct nfsrv_descript *nd, __unused int isdgram, char *layp; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER + NFSX_STATEID); tl++; /* Signal layout available. Ignore for now. */ @@ -4795,10 +4783,6 @@ nfsrvd_layoutcommit(struct nfsrv_descript *nd, __unused int isdgram, struct thread *p = curthread; layp = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED + 2 * NFSX_HYPER + NFSX_STATEID); offset = fxdr_hyper(tl); tl += 2; @@ -4878,10 +4862,6 @@ nfsrvd_layoutreturn(struct nfsrv_descript *nd, __unused int isdgram, struct thread *p = curthread; layp = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED); reclaim = *tl++; layouttype = fxdr_unsigned(int, *tl++); @@ -4964,10 +4944,6 @@ nfsrvd_layouterror(struct nfsrv_descript *nd, __unused int isdgram, char devid[NFSX_V4DEVICEID]; uint64_t offset, len; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID + NFSX_UNSIGNED); offset = fxdr_hyper(tl); tl += 2; @@ -5032,10 +5008,6 @@ nfsrvd_layoutstats(struct nfsrv_descript *nd, __unused int isdgram, uint64_t offset, len, readcount, readbytes, writecount, writebytes __unused; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 6 * NFSX_HYPER + NFSX_STATEID + NFSX_V4DEVICEID + 2 * NFSX_UNSIGNED); offset = fxdr_hyper(tl); tl += 2; @@ -5092,10 +5064,6 @@ nfsrvd_ioadvise(struct nfsrv_descript *nd, __unused int isdgram, int error = 0, ret; off_t offset, len; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER); stateid.seqid = fxdr_unsigned(uint32_t, *tl++); NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER); @@ -5185,10 +5153,6 @@ nfsrvd_getdevinfo(struct nfsrv_descript *nd, __unused int isdgram, char devid[NFSX_V4DEVICEID], *devaddr; time_t dev_time; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 3 * NFSX_UNSIGNED + NFSX_V4DEVICEID); NFSBCOPY(tl, devid, NFSX_V4DEVICEID); tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); @@ -5257,10 +5221,6 @@ nfsrvd_teststateid(struct nfsrv_descript *nd, __unused int isdgram, int cnt, error = 0, i, ret; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); cnt = fxdr_unsigned(int, *tl); if (cnt <= 0 || cnt > 1024) { @@ -5307,10 +5267,6 @@ nfsrvd_allocate(struct nfsrv_descript *nd, __unused int isdgram, nfsquad_t clientid; nfsattrbit_t attrbits; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } gotproxystateid = 0; NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER); stp->ls_flags = (NFSLCK_CHECK | NFSLCK_WRITEACCESS); @@ -5404,10 +5360,6 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, void *rl_rcookie, *rl_wcookie; rl_rcookie = rl_wcookie = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } if (nfsrv_devidcnt > 0) { /* * For a pNFS server, reply NFSERR_NOTSUPP so that the client @@ -5634,10 +5586,6 @@ nfsrvd_seek(struct nfsrv_descript *nd, __unused int isdgram, nfsattrbit_t attrbits; bool eof; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + NFSX_HYPER + NFSX_UNSIGNED); /* Ignore the stateid for now. */ tl += (NFSX_STATEID / NFSX_UNSIGNED); @@ -5707,10 +5655,6 @@ nfsrvd_getxattr(struct nfsrv_descript *nd, __unused int isdgram, uint16_t off; error = 0; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0) { @@ -5779,10 +5723,6 @@ nfsrvd_setxattr(struct nfsrv_descript *nd, __unused int isdgram, error = 0; name = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); opt = fxdr_unsigned(int, *tl++); len = fxdr_unsigned(int, *tl); @@ -5872,10 +5812,6 @@ nfsrvd_rmxattr(struct nfsrv_descript *nd, __unused int isdgram, error = 0; name = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0) { @@ -5942,10 +5878,6 @@ nfsrvd_listxattr(struct nfsrv_descript *nd, __unused int isdgram, error = 0; buf = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); /* * The cookie doesn't need to be in net byte order, but FreeBSD