Fix Windows VM helper rejecting setgid source directories - #9783
Conversation
GNU chmod leaves setuid/setgid on directories for numeric modes of four digits or fewer, so chmod 0700 cannot satisfy the exact-700 mount check when ~/Windows was created with g+s. Harden with a-s,u=rwx,go= and print the observed modes when the check still fails.
samba.sh treats an empty /shared bind as uninitialized and chmod 2777s it at container start, undoing the host 700 privacy check after every launch. Keep a hidden sentinel in the share and re-harden the directory after docker compose up.
|
Reviewed by Claude Opus 5, with an independent second opinion from Codex at xhigh. Both reached the same verdict, and Codex contributed two mechanisms the first pass had not worked out; its independence is not currently guaranteed, so the agreement is worth less than those two findings. What was checked. The diff against The mode fix is correct, and it is the right kind of repair. On coreutils 9.11, The sentinel is where the defects are. Its premise holds — dockur's
Neither of the two behaviours that distinguish this PR — the sentinel under the privileged path, and Nothing was pushed to your branch. Finding 1 needs a design decision rather than a patch — drop the privileged creation, or open with Waiting on the maintainer, both for that choice and for a decision on the sentinel. |
Creating ~/.omarchy-keep as root in a caller-owned directory is a symlink-follow write primitive. Restore mode 700 on the pinned directory inodes after the guest reports ready, and never fail a successful start on that chmod.
|
Addressing the review by dropping privileged sentinel creation.
This revision:
The world-writable window is now only during guest boot, not until the next privileged action. |
Fixes #9698
Fixes #9374
GNU
chmod 0700leaves setuid/setgid on directories when the numeric mode is four digits or fewer.prepare_caller_mountsthen requires mode700exactly, so a leftoverg+son~/Windows(often2700or2777) makes every privileged VM action fail closed with no diagnostic.This hardens those directories with
chmod a-s,u=rwx,go=(which does clear the special bits) and prints the observed modes if the check still fails.dockur
samba.shalsochmod 2777s an empty/sharedbind at container start, so a successful launch immediately undoes the host privacy mode. A hidden.omarchy-keepsentinel keeps the share non-empty, and the helper re-hardens~/Windowsafterdocker compose up.Covered by a user-side
prepare_user_mount_sourcestest and a root-namespace case that starts from2700/2777sources.