Skip to content

Clear special permission bits during Windows VM migration - #9322

Closed
pyrozhok wants to merge 1 commit into
omacom:quattrofrom
pyrozhok:fix/windows-vm-clear-special-permissions
Closed

pyrozhok wants to merge 1 commit into
omacom:quattrofrom
pyrozhok:fix/windows-vm-clear-special-permissions

Conversation

@pyrozhok

Copy link
Copy Markdown

Problem

Existing Windows VM installs can fail to start when the shared directory has the setgid bit set, for example mode 2700. The migration hardens the directory with numeric chmod 0700, but numeric modes leave unspecified special bits unchanged. The subsequent exact-mode check sees 2700 instead of 700 and aborts the migration, causing the Quickshell Windows launcher to report only that startup failed.

Solution

Use an explicit symbolic mode that sets owner permissions, removes group/other permissions, and clears all special bits before validating the mount sources. Apply the same hardening to both the user-side and privileged migration paths.

Testing

  • bash test/shell.d/windows-vm-compose-test.sh
  • ./test/all (the existing environment-dependent failures remain in config-test.sh, snapper-test.sh, unowned-system-paths-test.sh, and windows-vm-mount-boundary-test.sh)

The focused Windows VM test now covers migration from a setgid shared directory.

@686f6c61

Copy link
Copy Markdown

The numeric 0700 was leaving setgid in place, and the existing %a == 700 check is exactly what would then fail. u=rwx,go=,a-s plus the g+s fixture is the right pair.

Read against current quattro bin/omarchy-windows-vm and test/shell.d/windows-vm-compose-test.sh.

@slinn-01

Copy link
Copy Markdown

Independently reproduced this on a physical Omarchy 4.0.2-1 install upgraded from 4.0.1. Dockurr had left ~/Windows with SGID (2700; it also became 2777 while the guest was running). The privileged launch trace reached chmod 0700 successfully, then read shared_mode=2700 and returned before Docker startup. Clearing SGID in place immediately restored launch, guest readiness, and RDP connectivity.

Validated this branch in a clean checkout:

  • bash test/shell.d/windows-vm-compose-test.sh: pass, including the new g+s migration fixture and exact 700 assertion.
  • git diff --check quattro...HEAD: pass.
  • bash test/shell.d/windows-vm-mount-boundary-test.sh: fails at the existing protected-anchor identity assertion, but the same failure reproduces unchanged at base commit b686ed89, so it is not introduced by this patch.
  • ./test/all: CLI passes; shell has the same baseline/environment failures (missing omarchy-pkgs, live-shell IPC count, and the boundary result above). The Windows VM compose regression suite passes within the aggregate run.

The symbolic chmod u=rwx,go=,a-s is the right fix: it preserves the strict exact-mode postcondition while explicitly removing Dockurr-created special bits on every launch.

@686f6c61

Copy link
Copy Markdown

Thanks — that 2700 → chmod 0700 → shared_mode=2700 trace is the live path I could not run here. The compose test covers the bits; your install shows Dockurr actually sets them.

@chessing234

Copy link
Copy Markdown
Contributor

hey, this is already covered in #12264 (clear setgid / special bits on windows vm harden). mind closing this as a duplicate?

@omarchybot

Copy link
Copy Markdown
Collaborator

Update: #12323 has merged into quattro. The merged fix explicitly clears setuid/setgid in both mount-source hardening paths, keeps the exact mode-700 boundary, adds a diagnostic, and covers this launch/install failure. This alternative is no longer needed for that bug.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants