Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142733808
D43818.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D43818.diff
View Options
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -916,7 +916,24 @@
goto unionfs_mkshadowdir_abort;
unionfs_create_uppervattr_core(ump, &lva, &va, td);
+ /*
+ * Temporarily NUL-terminate the current pathname component.
+ * This function may be called during lookup operations in which
+ * the current pathname component is not the leaf, meaning that
+ * the NUL terminator is some distance beyond the end of the current
+ * component. This *should* be fine, as cn_namelen will still
+ * correctly indicate the length of only the current component,
+ * but ZFS in particular does not respect cn_namelen in its VOP_MKDIR
+ * implementation
+ * Note that this assumes nd.ni_cnd.cn_pnbuf was allocated by
+ * something like a local namei() operation and the temporary
+ * NUL-termination will not have an effect on other threads.
+ */
+ char *pathend = &nd.ni_cnd.cn_nameptr[nd.ni_cnd.cn_namelen];
+ char pathterm = *pathend;
+ *pathend = '\0';
error = VOP_MKDIR(udvp, &uvp, &nd.ni_cnd, &va);
+ *pathend = pathterm;
if (!error) {
unionfs_node_update(unp, uvp, td);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 8:59 PM (7 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27889523
Default Alt Text
D43818.diff (1 KB)
Attached To
Mode
D43818: unionfs: workaround underlying FS failing to respect cn_namelen
Attached
Detach File
Event Timeline
Log In to Comment