Clear setgid when hardening the Windows VM data directories - #11833
Closed
devYRPauli wants to merge 1 commit into
Closed
devYRPauli wants to merge 1 commit into
devYRPauli wants to merge 1 commit into
Conversation
chmod keeps setuid and setgid on a directory for every numeric mode, so chmod 0700 on a setgid ~/.windows or ~/Windows leaves mode 2700. The mode check in prepare_caller_mounts requires 700, so it returns 1 and every privileged action stops. Use the symbolic mode u=rwx,go=,ug-s, which clears both bits. Print a reason on that branch. assert_mounts_safe names a reason for every other refusal, so this one failed with no output at all. The regression fixture sets g+s on the legacy source directories in the migration case of windows-vm-compose-test.sh. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
devYRPauli
added a commit
to devYRPauli/devYRPauli
that referenced
this pull request
Sep 14, 2026
Open external pull requests: 40 -> 41. The new one is omacom/omarchy#11833, which clears the setgid bit when the Windows VM data directories are hardened, so the mode assert can pass. Merged stays at 97 across the same 38 projects. Upstream issues stay at 16. Closed unmerged stays at 37. No table row moved. The table still covers 52 merges across 11 projects, so the remainder stays at 45 across 27. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
You are right. I searched PRs, not issues, and I searched the wrong term. There are 18 other open PRs for this bug. Three predate mine by two weeks: #9322, #9414 and #9504, all opened on August 31. Closing mine. One note for whoever picks one of those up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11741.
chmod keeps setuid and setgid on a directory for every numeric mode. Measured with GNU coreutils 9.1:
chmod 700chmod 0700chmod u=rwx,go=chmod u=rwx,go=,ug-sprepare_caller_mountsrunschmod 0700on the two pinned sources, then requiresstat -Lc '%a'to report700. A setgid~/.windowsor~/Windowsreports2700, so the check fails and the function returns 1.assert_mounts_safecalls it asprepare_caller_mounts || return 1with no message. Every caller ofassert_mounts_safeis a privileged action, soremoveandlaunchstop with no output.The fix uses
chmod u=rwx,go=,ug-s, the shortest symbolic form that clears both bits.prepare_user_mount_sourceshardens the same two directories with the same numeric mode, so it gets the same change.The branch that rejects a wrong mode now prints a reason. Every other refusal in
assert_mounts_safealready names one.Test
test/shell.d/windows-vm-compose-test.shalready assertsstat -Lc '%a' == 700on both directories after the legacy migration. The fixture for that case now setsg+son them before the migration runs.Measured in a Debian bookworm container as a non-root user, inside the test's own
unshare --user --map-current-user --keep-caps --mountnamespace:windows-vm-test.sh,windows-vm-mount-boundary-test.sh,privileged-heredoc-test.shandbin-style-test.shgive the same result on base and on this branch.