Skip to content

NFSD: Apply all export checks when a compound changes exports

VeroFess linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3NFSD: Check the secure-port policy when entering an exportfs/nfsd/export.c fs/nfsd/nfs4proc.c fs/nfsd/nfsfh.c +2 more+48 -130 replies
2/3NFSD: Apply the entered export's credentials after LOOKUP and RESTOREFHfs/nfsd/nfs4proc.c fs/nfsd/vfs.c+8 -10 replies
3/3NFSD: Verify COPY and CLONE source and destination filehandlesfs/nfsd/nfs4proc.c+9 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] NFSD: Apply all export checks when a compound changes exports

When a compound moves the current filehandle into another export, NFSD does not always apply all of that export's checks. These patches fix three such paths: LOOKUP entering an export, RESTOREFH, and COPY and CLONE with a source and destination in different exports. They apply to nfsd-testing at 08f97dfc517b.

In each case, the requester must already hold an OPEN stateid that NFSD granted after a full export check.

Patch 1 checks the secure-port setting of an export entered by LOOKUP. An AUTH_SYS request from an unreserved port can no longer enter a secure export that PUTFH of the same filehandle would reject.

Patch 2 applies the entered export's credentials after LOOKUP crosses into another export and after RESTOREFH, so root_squash and all_squash follow the export that owns the current filehandle.

Patch 3 verifies the COPY and CLONE source and destination filehandles, so each stateid is checked with the credentials of its own export.

The combined tree was built for x86-64 with KASAN, kernel TLS and NFSD_V4_2_INTER_SSC, and tested in a guest on NFSv4.0, v4.1 and v4.2. The test results are below the --- line of each patch. The guest log showed no KASAN report or oops. Each patch also applies and builds with W=1 on its own.

VeroFess (3):
NFSD: Check the secure-port policy when entering an export
NFSD: Apply the entered export's credentials after LOOKUP and
RESTOREFH
NFSD: Verify COPY and CLONE source and destination filehandles

 fs/nfsd/export.c   |  8 ++++++--
 fs/nfsd/nfs4proc.c | 18 +++++++++++++++---
 fs/nfsd/nfsfh.c    | 26 ++++++++++++++++++++++----
 fs/nfsd/nfsfh.h    |  2 ++
 fs/nfsd/vfs.c      | 26 ++++++++++++++++++++------
 5 files changed, 65 insertions(+), 15 deletions(-)

base-commit: 08f97dfc517b50a00a41ce99f5af7b6ce2814592

Signature · 1 line
2.43.0