Repository navigation
Conversation
chmod preserves a directory's set-user-ID and set-group-ID bits when it is handed an octal mode, so `chmod 0700 ~/Windows` leaves a setgid source at 2700. prepare_caller_mounts compares the hardened mode against 700 exactly and returns 1, so a source that picked up a setgid bit fails every launch with no output at all, before Docker is ever contacted. The unprivileged prepare_user_mount_sources could not clear it either, so the state was permanent. Route the exact-mode chmods through a helper that clears the special bits first. Affected installs recover on their next launch; no migration needed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015xzqotBnVWaSdAMeqj87oy
|
Reviewed at The fix is correct and the two tests earn their place. Mutation-tested on a worker: with The Samba case recovers, at the cost of one prompt per launch. Probed on the worker: with the shared source chmodded to One low-severity note, not pushed. Splitting one On #10262, which claims a different root cause for the same failure. Its premise is that Waiting on the maintainer, who has four open pull requests over this file to choose between: this one, #9783, #10338 and #10262. |
|
hey, this is already covered in #12264 (clear setgid when hardening windows vm mounts). mind closing this as a duplicate? |
|
Re-checked at It still fixes the bug on current On the duplicate suggestion: #12264 was opened eleven days after this one, and it also changes when the launcher is created, so this pull request stays open. Both are left for the maintainer. Choosing between the fixes. Codex was asked which open fix to merge and was not told our answer. It found that #10411, #10338, #9783 and #12264 all clear the setgid bit, and that #10262 does not: it keeps #10338 already carries |
|
Closing this alternative after #12323 merged into Scope checked by GPT-6 in Codex and Codex Medium against the discussion and landed change; review independence is not guaranteed. No tests were rerun for this cleanup. Omabot on behalf of DHH |
omarchy-windows-vm launchworks exactly once. After the first successful run every later launch fails silently and permanently: no output, no notification, no Docker contact - the daemon is never even started.Cause
chmodpreserves a directory's set-user-ID and set-group-ID bits when it is handed an octal mode.chmod 0700 diron a2777directory leaves it at2700:prepare_caller_mountshardens both pinned sources and then requires the result to be exactly700:The chmod succeeds,
statreturns2700, the check fails, and__priv_up_waitreturns 1 beforedc up -d. The desktop entry appears to do nothing.Nothing in the tool can recover from it: the unprivileged
prepare_user_mount_sourcesnormalizes the same sources with the same octalchmod 0700, so the bit can never be cleared.What sets the bit
The
dockurr/windowsimage does, on every single run. Its Samba setup probes the share and then chmods it to2777. Caught with aninotifywaiton both sources across a full launch:~/Windowsis the bind source for/shared, so the container's chmod lands on the same inode the next bring-up checks. Verified on a real install:~/Windowsmeasured0700before the launch and2777after it, while~/.windowsstayed700throughout. The next launch then failed with no output at all.There is a privacy consequence too. The
0700hardening never actually holds: between runs the share sits world-writable at2777, and the hardening chmod cannot bring it back because it cannot clear the setgid bit. With this fix the source really is0700at each bring-up.Fix
Route every exact-mode
chmodthrough a helper that clears the special bits first:Applied to the four sites that set a mode a later check compares against, or that are meant to normalize an inherited one:
prepare_caller_mounts,prepare_user_mount_sources,prepare_boundary_component, andwrite_credentials. Thechmod 0640/0600 "$tmp"calls are untouched: those are freshmktempregular files that cannot carry special bits.Affected installs recover on their next launch, so no migration is needed.
Tests
A regression in each of the two existing harnesses:
windows-vm-mount-boundary-test.shseedsg+son both tmpfs sources before the root bind. Without the fix:not ok - root could not create verified production bind anchors.windows-vm-compose-test.shcovers the unprivileged path - setgid sources must leaveprepare_user_mount_sourcesat exactly0700. Without the fix:not ok - setgid sources were not hardened to an exact 0700.Both verified failing on stock
quattroand passing with the fix../test/shellis otherwise unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01E4RgepEpHPpP5i8Qcccpi8