You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mv xattr preservation TOCTOU on cross-device moves #10014
When moving files across filesystem boundaries, mv falls back to copy-then-delete. During this fallback, extended attribute preservation uses path-based operations (xattr::list, xattr::get, xattr::set) that repeatedly re-resolve source and destination paths with each syscall. This means the xattrs copied are not an atomic snapshot, and concurrent path manipulation (renames, replacements) can redirect individual syscalls to different inodes mid-operation.
The implementation is not inode-stable. Each xattr operation walks the path again instead of operating on a pinned file descriptor. For regular files, copy_xattrs(source, dest) iterates attributes and performs separate path lookups per get/set. For directories, retrieve_xattrs and apply_xattrs similarly resolve paths multiple times.
This is primarily a correctness issue, but becomes security-relevant when privileged processes move files carrying security xattrs (SELinux labels, capabilities). Content and metadata can be observed or manipulated at different times during the operation.
Activity
mv,cp: fix xattr TOCTOU by using file descriptor-based operations
15 remaining items
uucore/mv: fd-based xattr copy for cross-device moves (uutils#10014)
uucore/mv: fd-based xattr copy for cross-device moves (uutils#10014)
uucore/mv: fd-based xattr copy for cross-device moves (#10014)
sylvestre commentedon May 24, 2026
Fixed by #12170 (commit 54877ac "uucore/mv: fd-based xattr copy for cross-device moves").
uucore/mv: fd-based xattr copy for cross-device moves (uutils#10014)
uucore/mv: fd-based xattr copy for cross-device moves (uutils#10014)
mv: drop pre-copy unlink of regular file destinations (uutils#10015)
uucore/fsxattr: keep copy_xattrs strict; add ignore-unsupported variants
mv,cp: fix xattr TOCTOU by using file descriptor-based operations
mv,cp: fix xattr TOCTOU by using file descriptor-based operations
mv,cp: fix xattr TOCTOU by using file descriptor-based operations
mv,cp: fix xattr TOCTOU by using file descriptor-based operations
mv,cp: fix xattr TOCTOU by using file descriptor-based operations (#1…
mv,cp: fix xattr TOCTOU by using file descriptor-based operations (uu…