#
19424260 |
| 17-Jan-2025 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Simplify the deleg argument for nfscl_deleg()
The deleg argument to nfscl_deleg() is a "struct nfscldeleg **" although the returned pointer value is never used by callers.
This patch changes
nfscl: Simplify the deleg argument for nfscl_deleg()
The deleg argument to nfscl_deleg() is a "struct nfscldeleg **" although the returned pointer value is never used by callers.
This patch changes the argument to "struct nfscldeleg *" to simplify the call and avoid any confusion w.r.t. use of the returned value.
This patch should not create any NFS semantics change.
show more ...
|
#
f9f0a1d6 |
| 10-Jan-2025 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Fix a crash when a readdir entry has nul in it
Commit 026cdaa3b3a9 added a check for a nul or "/" in a file name in a readdir reply. Unfortunately, the minimal testing done on it did not det
nfscl: Fix a crash when a readdir entry has nul in it
Commit 026cdaa3b3a9 added a check for a nul or "/" in a file name in a readdir reply. Unfortunately, the minimal testing done on it did not detect a bug that can cause the client to crash.
This patch fixes the code so that it does not crash.
Note that a NFS server will not normally return a file name in a readdir reply that has a nul or "/" in it, so the crash is unlikely.
PR: 283965 Reported by: asomers Tested by: asomers MFC after: 2 weeks
show more ...
|
Revision tags: release/14.2.0 |
|
#
314cb279 |
| 31-Oct-2024 |
John Baldwin <jhb@FreeBSD.org> |
mbuf: Don't force all M_EXTPG mbufs to be read-only
Some M_EXTPG mbufs are read-only (e.g. those backing sendfile requests), but others are not. Add a flags argument to mb_alloc_ext_pgs that can be
mbuf: Don't force all M_EXTPG mbufs to be read-only
Some M_EXTPG mbufs are read-only (e.g. those backing sendfile requests), but others are not. Add a flags argument to mb_alloc_ext_pgs that can be used to set M_RDONLY when needed rather than setting it unconditionally. Update mb_unmapped_to_ext to preserve M_RDONLY from the unmapped mbuf.
Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D46783
show more ...
|
Revision tags: release/13.4.0 |
|
#
2477e88b |
| 21-Aug-2024 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfs: Add support for the NFSv4.2 mode_umask attribute
RFC8275 defines a new attribute as an extension to NFSv4.2 called MODE_UMASK. This patch adds support for this attribute to the NFSv4.2 client
nfs: Add support for the NFSv4.2 mode_umask attribute
RFC8275 defines a new attribute as an extension to NFSv4.2 called MODE_UMASK. This patch adds support for this attribute to the NFSv4.2 client and server.
Since FreeBSD applies the umask above the VFS/VOP layer, this attribute does not actually have any effect on the handling of ACL inheritance, which is what it is designed for. However, future changes to NFSv4.2 require support of it, so this patch does that, resulting in behaviour identcal to the mode attribute already supported.
MFC after: 2 months
show more ...
|
#
026cdaa3 |
| 22-Jul-2024 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Scan readdir reply filenames for invalid characters
The NFS RFCs are pretty loose with respect to what characters can be in a filename returned by a Readdir. However, FreeBSD, as a POSIX sys
nfscl: Scan readdir reply filenames for invalid characters
The NFS RFCs are pretty loose with respect to what characters can be in a filename returned by a Readdir. However, FreeBSD, as a POSIX system will not handle imbedded '/' or nul characters in file names. Also, for NFSv4, the file names "." and ".." are handcrafted on the client and should not be returned by a NFSv4 server.
This patch scans for the above in filenames returned by Readdir and ignores any entry returned by Readdir which has them in it. Because an imbedded nul would be a string terminator, it was not possible to code this check efficiently using string(3) functions.
Reported by: Apple Security Engineering and Architecture (SEAR) MFC after: 1 week
show more ...
|
#
ec1f285f |
| 13-Jun-2024 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Add support for the NFSv4.1/4.2 WANT_xxx flags
NFSv4.1/4.2 defined new OPEN_WANT_xxx flags that a client can use to hint to the server that delegations are or are not wanted. This patch adds
nfscl: Add support for the NFSv4.1/4.2 WANT_xxx flags
NFSv4.1/4.2 defined new OPEN_WANT_xxx flags that a client can use to hint to the server that delegations are or are not wanted. This patch adds use of those delegations to the client.
This patch should only affect the NFSv4.1/4.2 behaviour when delegations are enabled, which is not the default.
MFC after: 1 month
show more ...
|
Revision tags: release/14.1.0 |
|
#
6251027c |
| 26-Apr-2024 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Do not use nfso_own for delayed nfsrpc_doclose()
When an initial attempt to close an NFSv4 lock returns NFSERR_DELAY, the open structure is put on a list for delayed closing. When this is do
nfscl: Do not use nfso_own for delayed nfsrpc_doclose()
When an initial attempt to close an NFSv4 lock returns NFSERR_DELAY, the open structure is put on a list for delayed closing. When this is done, the nfso_own field is set to NULL, so it cannot be used by nfsrpc_doclose().
Without this patch, the NFSv4 client can crash when a NFSv4 server replies NFSERR_DELAY to a Close operation. Fortunately, most extant NFSv4 servers do not do this. This patch avoids the crash for any that do return NFSERR_DELAY for Close.
Found during a IETF bakeathon testing event this week.
MFC after: 5 days
show more ...
|
#
8efba70d |
| 25-Apr-2024 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Revert part of commit 196787f79e67
Commit 196787f79e67 erroneously assumed that the client code for Open/Claim_deleg_cur_FH was broken, but it was not. It was actually wireshark that was brok
nfscl: Revert part of commit 196787f79e67
Commit 196787f79e67 erroneously assumed that the client code for Open/Claim_deleg_cur_FH was broken, but it was not. It was actually wireshark that was broken and indicated that the correct XDR was bogus.
This reverts the part of 196787f79e67 that changed the arguments for Open/Claim_deleg_cur_FH.
Found during the IETF bakeathon testing event this week.
MFC after: 3 days
show more ...
|
Revision tags: release/13.3.0 |
|
#
cc760de2 |
| 12-Jan-2024 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Only update atime for Copy when noatime is not specified
Commit 57ce37f9dcd0 modified the NFSv4.2 Copy operation so that it will update atime on the infd file whenever possible. This is done
nfscl: Only update atime for Copy when noatime is not specified
Commit 57ce37f9dcd0 modified the NFSv4.2 Copy operation so that it will update atime on the infd file whenever possible. This is done by adding a Setattr of TimeAccess for the input file.
This patch disables this change for the case of an NFSv4.2 mount with the "noatime" mount option, which avoids the additional Setattr of TimeAccess operation.
MFC after: 1 week
show more ...
|
#
6fa843f6 |
| 12-Dec-2023 |
Mark Johnston <markj@FreeBSD.org> |
nfsclient: Propagate copyin() errors from nfsm_uiombuf()
Approved by: so Security: SA-23:18.nfsclient Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation
|
#
0a958aa1 |
| 04-Dec-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Fix comment for commit 6aded1e6b2e5
Commit 6aded1e6b2e5 fixed a rare case when handling an NFSv4 Rename reply when delegations are in use. This patch fixes the associated comment.
MFC after
nfscl: Fix comment for commit 6aded1e6b2e5
Commit 6aded1e6b2e5 fixed a rare case when handling an NFSv4 Rename reply when delegations are in use. This patch fixes the associated comment.
MFC after: 2 weeks
show more ...
|
#
6aded1e6 |
| 04-Dec-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Fix processing of a rare Rename reply case
When delegations are enabled (they are not by default in the FreeBSD NFSv4 server), rename will check for and return delegations. If the second of
nfscl: Fix processing of a rare Rename reply case
When delegations are enabled (they are not by default in the FreeBSD NFSv4 server), rename will check for and return delegations. If the second of these DelegReturn operations were to fail (they rarely do), then the code would not retry the rename with returning delegations, as it is intended to do.
The patch fixes the problem, since the DelegReturn reply status is the second iteration of the loop and not the first iteration.
As noted, this bug would have rarely manifested a problem, since DelegReturn operations do not normally fail.
MFC after: 2 weeks
show more ...
|
Revision tags: release/14.0.0 |
|
#
dd7d42a1 |
| 23-Oct-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl/kgssapi: Fix Kerberized NFS mounts to pNFS servers
During recent testing related to the IETF NFSv4 Bakeathon, it was discovered that Kerberized NFSv4.1/4.2 mounts to pNFS servers (sec=krb5[ip]
nfscl/kgssapi: Fix Kerberized NFS mounts to pNFS servers
During recent testing related to the IETF NFSv4 Bakeathon, it was discovered that Kerberized NFSv4.1/4.2 mounts to pNFS servers (sec=krb5[ip],pnfs mount options) was broken. The FreeBSD client was using the "service principal" for the MDS to try and establish a rpcsec_gss credential for a DS, which is incorrect. (A "service principal" looks like "nfs@<fqdn-of-server>" and the <fqdn-of-server> for the DS is not the same as the MDS for most pNFS servers.)
To fix this, the rpcsec_gss code needs to be able to do a reverse DNS lookup of the DS's IP address. A new kgssapi upcall to the gssd(8) daemon is added by this patch to do the reverse DNS along with a new rpcsec_gss function to generate the "service principal".
A separate patch to the gssd(8) will be committed, so that this patch will fix the problem. Without the gssd(8) patch, the new upcall fails and current/incorrect behaviour remains.
This bug only affects the rare case of a Kerberized (sec=krb5[ip],pnfs) mount using pNFS.
This patch changes the internal KAPI between the kgssapi and nfscl modules, but since I did a version bump a few days ago, I will not do one this time.
MFC after: 1 month
show more ...
|
#
14bbf4fe |
| 22-Oct-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Handle a Getattr failure with NFSERR_DELAY following Open
During testing at a recent IETF NFSv4 Bakeathon, a non-FreeBSD server was rebooted. After the reboot, the FreeBSD client sent an Ope
nfscl: Handle a Getattr failure with NFSERR_DELAY following Open
During testing at a recent IETF NFSv4 Bakeathon, a non-FreeBSD server was rebooted. After the reboot, the FreeBSD client sent an Open/Claim_previous with a Getattr after the Open in the same compound. The Open/Claim_previous was done to recover the Open and a Delegation for for a file. The Open succeeded, but the Getattr after the Open failed with NFSERR_DELAY. This resulted in the FreeBSD client retrying the entire RPC over and over again, until the server's recovery grace period ended. Since the Open succeeded, there was no need to retry the entire RPC.
This patch modifies the NFSv4 client side recovery Open/Claim_previous RPC reply handling to deal with this case. With this patch, the Getattr reply of NFSERR_DELAY is ignored and the successful Open reply is processed.
This bug will not normally affect users, since this non-FreeBSD server is not widely used (it may not even have shipped to any customers).
MFC after: 1 month
show more ...
|
#
196787f7 |
| 21-Oct-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH
For NFSv4.1/4.2, there are two new options for the Open operation. These two options use the file handle for the file instead of the file handle for t
nfscl: Use Claim_Null_FH and Claim_Deleg_Cur_FH
For NFSv4.1/4.2, there are two new options for the Open operation. These two options use the file handle for the file instead of the file handle for the directory plus a file name. By doing so, the client code is simplified (it no longer needs the "nfsv4node" structure attached to the NFS vnode). It also avoids problems caused by another NFS client (or process running locally in the NFS server) doing a rename or remove of the file name between the Lookup and Open.
Unfortunately, there was a bug (fixed recently by commit X) in the NFS server which mis-parsed the Claim_Deleg_Cur_FH arguments. To allow this patch to work with the broken FreeBSD NFSv4.1/4.2 server, NFSMNTP_BUGGYFBSDSRV is defined and is set when a correctly formatted Claim_Deleg_Cur_FH fails with NFSERR_EXPIRED. (This is what the old, broken NFS server does, since it erroneously uses the Getattr arguments as a stateID.) Once this flag is set, the client fills in a stateID, to make the broken NFS server happy.
Tested at a recent IETF NFSv4 Bakeathon.
MFC after: 1 month
show more ...
|
#
57ce37f9 |
| 18-Oct-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Make NFSv4.2 Copy set atime on infd
RFC7862 does not specify infile atime behaviour when a NFSv4.2 Copy operation is performed. Since the collective opinion of a mailing list discussion (on
nfscl: Make NFSv4.2 Copy set atime on infd
RFC7862 does not specify infile atime behaviour when a NFSv4.2 Copy operation is performed. Since the collective opinion of a mailing list discussion (on freebsd-hackers@) seemed to indicate that copy_file_range(2) should update atime on the infd, even if there is no data copied, this patch attempts to ensure that behaviour.
For Copy, it preceeds the Copy operation with a Setattr of TimeAccess_Set(NFSv4. speak for atime) for the invp. For the case where no data will be copied, it does a Setattr RPC to set TimeAccess_Set for the invp.
A __FreeBSD_version bump will be done as a separate commit, since this patch changes the internal interface between the nfscommon and nfscl modules.
MFC after: 1 month
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
Revision tags: release/13.2.0 |
|
#
ba8cc6d7 |
| 12-Mar-2023 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: use __enum_uint8 for vtype and vstate
This whacks hackery around only reading v_type once.
Bump __FreeBSD_version to 1400093
|
#
695d87ba |
| 29-Mar-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Make coverity happy
Coverity does not like code that checks a function's return value sometimes. Add "(void)" in front of the function when the return value does not matter to try and make i
nfscl: Make coverity happy
Coverity does not like code that checks a function's return value sometimes. Add "(void)" in front of the function when the return value does not matter to try and make it happy.
A recent commit deleted "(void)"s in front of nfsm_fhtom(). This commit puts them back in.
Reported by: emaste MFC after: 3 months
show more ...
|
#
1512579a |
| 28-Mar-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Make coverity happy
Coverity does not like code that checks a function's return value sometimes. Add "(void)" in front of the function when the return value does not matter to try and make i
nfscl: Make coverity happy
Coverity does not like code that checks a function's return value sometimes. Add "(void)" in front of the function when the return value does not matter to try and make it happy.
Reported by: emaste MFC after: 3 months
show more ...
|
#
896516e5 |
| 16-Mar-2023 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Add a new NFSv4.1/4.2 mount option for Kerberized mounts
Without this patch, a Kerberized NFSv4.1/4.2 mount must provide a Kerberos credential for the client at mount time. This credential i
nfscl: Add a new NFSv4.1/4.2 mount option for Kerberized mounts
Without this patch, a Kerberized NFSv4.1/4.2 mount must provide a Kerberos credential for the client at mount time. This credential is typically referred to as a "machine credential". It can be created one of two ways: - The user (usually root) has a valid TGT at the time the mount is done and this becomes the machine credential. There are two problems with this. 1 - The user doing the mount must have a valid TGT for a user principal at mount time. As such, the mount cannot be put in fstab(5) or similar. 2 - When the TGT expires, the mount breaks. - The client machine has a service principal in its default keytab file and this service principal (typically called a host-based initiator credential) is used as the machine credential. There are problems with this approach as well: 1 - There is a certain amount of administrative overhead creating the service principal for the NFS client, creating a keytab entry for this principal and then copying the keytab entry into the client's default keytab file via some secure means. 2 - The NFS client must have a fixed, well known, DNS name, since that FQDN is in the service principal name as the instance.
This patch uses a feature of NFSv4.1/4.2 called SP4_NONE, which allows the state maintenance operations to be performed by any authentication mechanism, to do these operations via AUTH_SYS instead of RPCSEC_GSS (Kerberos). As such, neither of the above mechanisms is needed.
It is hoped that this option will encourage adoption of Kerberized NFS mounts using TLS, to provide a more secure NFS mount.
This new NFSv4.1/4.2 mount option, called "syskrb5" must be used with "sec=krb5[ip]" to avoid the need for either of the above Kerberos setups to be done by the client.
Note that all file access/modification operations still require users on the NFS client to have a valid TGT recognized by the NFSv4.1/4.2 server. As such, this option allows, at most, a malicious client to do some sort of DOS attack.
Although not required, use of "tls" with this new option is encouraged, since it provides on-the-wire encryption plus, optionally, client identity verification via a X.509 certificate provided to the server during TLS handshake. Alternately, "sec=krb5p" does provide on-the-wire encryption of file data.
A mount_nfs(8) man page update will be done in a separate commit.
Discussed on: freebsd-current@ MFC after: 3 months
show more ...
|
Revision tags: release/12.4.0 |
|
#
d4a11b3e |
| 12-Jul-2022 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Fix CreateSession for an established ClientID
Commit 981ef32230b2 added optional use of the session slots marked bad to recover a new session when all slots are marked bad. The recovery work
nfscl: Fix CreateSession for an established ClientID
Commit 981ef32230b2 added optional use of the session slots marked bad to recover a new session when all slots are marked bad. The recovery worked against a FreeBSD NFSv4.1/4.2 server, but not a Linux one. It turns out that it was a bug in the FreeBSD client and not the Linux server.
This patch fixes the client so that DeleteSession followed by CreateSession after receiving a NFSERR_BADSESSION error reply works against the Linux server (and conforms to the RFC).
This also implies that the FreeBSD NFSv4.1/4.2 server needs to be fixed in a future commit. Without the fix, the FreeBSD server does a full recovery, including creation of a new ClientID, but since "intr" mounts were broken, this does not result in a regression.
This patch only affects the case where a CreateSession is done for an already confirmed ClientID, which was not being done prior to commit 981ef32230b2.
PR: 260011 MFC after: 2 weeks
show more ...
|
#
2adb3074 |
| 12-Jul-2022 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Replace "cred" with NULL to cleanup code
Commit 326bcf9394c7 added a new "cred" argument to nfscl_reqstart(). Fsinfo is a NFSv3 RPC and since the "cred" argument is not used for NFSv3, it doe
nfscl: Replace "cred" with NULL to cleanup code
Commit 326bcf9394c7 added a new "cred" argument to nfscl_reqstart(). Fsinfo is a NFSv3 RPC and since the "cred" argument is not used for NFSv3, it does not matter what is passed in. However, to be consistent with the rest of the patch, change the argument to NULL.
This patch should not result in a semantics change.
PR: 260011 MFC after: 2 weeks
show more ...
|
#
8f4a5fc6 |
| 10-Jul-2022 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2
Commit 981ef32230b2 enabled marking of potentially bad session slots when an RPC is interrupted if the "intr" mount option is used. As such, it
nfscl: Do not call nfscl_hasexpired() for NFSv4.1/4.2
Commit 981ef32230b2 enabled marking of potentially bad session slots when an RPC is interrupted if the "intr" mount option is used. As such, it no longer makes sense to call nfscl_hasexpired() for I/O operations that reply NFSERR_BADSTATEID for NFSv4.1/4.2, which does a full recovery of NFSv4 open state, destroying all byte range locks. Recovery of open state should not be usually needed, since the session slot has been marked potentially bad and, although opens for the process that has been terminated via a signal may be broken, locks for other processes will still be valid.
This patch disables calls to nfscl_hasexpired for NFSv4.1/4.2 mounts, when I/O RPCs receive NFSERR_BADSTATEID replies. It does not affect the behaviour of NFSv4.0 mounts nor hard (non "intr") mounts.
PR: 260011 MFC after: 2 weeks
show more ...
|
#
627f1555 |
| 10-Jul-2022 |
Rick Macklem <rmacklem@FreeBSD.org> |
nfscl: Initialize nfsess_badslots to zero
Commit 40ada74ee1da added a field to mark bad session slots. This patch ensures that the field is initialized to 0.
PR: 260011 MFC after: 2 weeks
|