HomeFreeBSD

unionfs: work around underlying FS failing to respect cn_namelen

Description

unionfs: work around underlying FS failing to respect cn_namelen

unionfs_mkshadowdir() may be invoked on a non-leaf pathname component
during lookup, in which case the NUL terminator of the pathname buffer
will be well beyond the end of the current component. cn_namelen in
this case will still (correctly) indicate the length of only the
current component, but ZFS in particular does not currently respect
cn_namelen, leading to the creation on inacessible files with slashes
in their names. Work around this behavior by temporarily NUL-
terminating the current pathname component for the call to VOP_MKDIR().

https://github.com/openzfs/zfs/issues/15705 has been filed to track
a proper upstream fix for the issue at hand.

PR: 275871
Reported by: Karlo Miličević <karlo98.m@gmail.com>
Tested by: Karlo Miličević <karlo98.m@gmail.com>
Reviewed by: kib, olce
Differential Revision: https://reviews.freebsd.org/D43818

(cherry picked from commit a2ddbe019d51b35f9da2cb5ddca8c69f0ee422da)

Details

Provenance
jahAuthored on Dec 24 2023, 4:48 AM
Reviewer
kib
Differential Revision
D43818: unionfs: workaround underlying FS failing to respect cn_namelen
Parents
rGd0bb255d1fcb: VFS: update VOP_FSYNC() debug check to reflect actual locking policy
Branches
Unknown
Tags
Unknown