Repository navigation
Clear setgid when hardening Windows VM directories - #12323
Conversation
A numeric chmod keeps setuid/setgid on a directory, so a setgid ~/Windows stayed 2700 and failed the exact 700 privacy check, aborting the launch. dockur marks an initially empty /shared setgid (chmod 2777) on first boot, so this hits fresh installs the next time the bind anchors are recreated.
Automated AI review: targeted fix verifiedA/B-tested
This verifies the targeted permission and mount behavior, not a Windows boot/RDP cycle. The new diagnostic was inspected but not fault-injection tested, and the full repository suite was not run. |
|
Reproduced on Omarchy 4.0.4, coreutils 9.11, kernel 7.2.5-3-omarchy. Same conditions as described here: One thing worth fixing alongside the chmod: the mode check in |
The mode check returned 1 without any output, so a launch from the app menu died after the polkit prompt with nothing to diagnose. Name each source directory and the mode it was left with.
d1b18d5 to
45fd98f
Compare
|
Thanks for the repro. The second commit already printed the modes; I've updated it to name the directories too, so the failure now reads: The boundary test now also fault-injects that path (a |
|
Two more open implementations of this same Samba/setgid fix are #10595 and #12019, in addition to #12264 already linked here. They change the same two hardening paths: #10595 uses Linking these for consolidation around one fix. The root-boundary and legacy-migration regressions in this PR are worth retaining whichever implementation lands. |
|
Thanks for linking those, I had missed them. Agreed on consolidating: I closed my duplicate report (#12322) in favor of #9630 and pointed this PR at #9630 and #11940. No attachment to which implementation lands; if it is another one, the two regressions and the fault-injected diagnostic test here can be lifted as-is. |
|
hey, this is already covered in #12264 (clear setgid on harden). mind closing this as a duplicate? |
|
Thanks. Before closing anything: the maintainers' duplication check already consolidated around #9322 (it closed #10595 in its favor on 09-20), and #9322 is the oldest of the four, so consolidation should go there rather than to #12264, which also bundles an unrelated launcher change. This one stays open only for what #9322 doesn't have: the root-boundary regressions and the diagnostic with its fault-injection test. If #9322 lands first I'll rebase this into a tests-only follow-up. No objection to closing whichever the maintainers pick. |
|
Reviewed at The bug is real and this fixes its cause. A separate reproduction, written independently of the tests here, sets Tests on the worker: Second opinion: Codex at medium effort reviewed the diff at this head and found no defects. It confirmed that Competing fixes: #12019 and #12264 fix the same bug. Codex was asked separately, without our view, and also picked this one. #12019 is correct but adds no tests. #12264's Fixes #9334. This is now waiting on the maintainer. |
The setgid hardening it exercised landed on quattro with omacom#12323, whose compose and mount-boundary tests cover it through the root path. This one called prepare_caller_mounts itself before removal, so it could not show that removal hardens the directory, as its comment claimed. What remains is the launcher fix for omacom#7943. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
The only conflict was bin/omarchy-windows-vm. omacom#12323 landed the same setgid fix on quattro using a symbolic mode (chmod u=rwx,go=,a-s) where this branch used chmod 00700, so the branch takes quattro's version and no longer changes that file. Two follow-ups the text merge could not see: - Dropped this branch's setgid test block from test/shell.d/windows-vm-mount-boundary-test.sh. It merged cleanly but tested a code change this branch no longer makes, and omacom#12323 added equivalent coverage to the same file. - Updated the omarchy:summary line in bin/omarchy-toggle-bar. Quattro had reworded it to document the inverted behaviour ("on hides the bar, off shows it"), which contradicts this branch's fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Clear setgid when hardening Windows VM directories (cherry picked from commit 35a0d59)
Fixes #9334
Problem
omarchy windows vm launchexits 1 with no output whenever~/Windows(or~/.windows) is setgid. From the app menu nothing happens after the polkit prompt.prepare_caller_mountsrunschmod 0700on both sources and then requires the mode to be exactly700. A numericchmodkeeps setuid/setgid on directories, so2700stays2700and the check fails:This is not an exotic setup:
dockurr/windowssets the bit itself./run/samba.shin the container runschmod 2777on/sharedwhen it is empty, which is the state of~/Windowson a fresh install. The next launch that has to recreate the bind anchors (any reboot) then fails.Changes
chmod u=rwx,go=,a-sat both sites (prepare_caller_mountsandprepare_user_mount_sources), which also drops a sticky bit. The exact-700checks stay as they are.2777share, as dockur leaves it. Both fail before the fix and pass after.Testing
test/shell.d/windows-vm-mount-boundary-test.sh,windows-vm-compose-test.sh,windows-vm-test.sh,bin-style-test.shpass../test/all: the remaining failures (config,locate,omarchy-kernel-migration,snapper,unowned-system-paths) fail identically on an untouchedquattrocheckout here (noomarchy-pkgscheckout, etc.).~/Windowswas2700, launch failed silently; clearing the bit made the VM boot and RDP connect.One note for reviewers:
windows-vm-mount-boundary-test.shfails on the host while a Windows VM is running, with or without this change. The host's live bind anchors stay listed in the test namespace's/proc/self/mountinfo, somountpoint -qreports the fresh anchor as already mounted. I ran it in a cleanpivot_roottree. Not addressed here to keep the PR focused.Related
Canonical issue is #9334 (my #12322, plus #9630 and #11940, were closed as duplicates of it). Other open implementations of the same
chmodchange: #9322 (oldest, Aug 31; the maintainers' duplication check kept it and closed #10595 in its favor), #12019 and #12264 (bundled with an unrelated launcher change). What this PR adds on top of #9322: the root-boundary regressions (re-hardening behind live anchors and after the binds are recreated), the diagnostic for the silent failure, and its fault-injected test. If #9322 lands first I will rebase this into a tests-plus-diagnostic follow-up.