Repository navigation
Conversation
Command substitutions run in a subshell where BASHPID is not the descriptor owner. prepare_caller_mounts chmod'd via the parent PID then stat'd via the subshell PID, so the 0700 privacy check read the wrong descriptor table and failed closed after a correct chmod. Capture self_pid=$BASHPID before every /proc/<pid>/fd access that can run under $(...). Closes #10035 Signed-off-by: fresh3nough <[email protected]>
|
Thanks for this. I tested it, and it doesn't fix the launch failure in #10035. With Why the snapshot doesn't change anything. What ran, on a disposable worker built from the Omarchy ISO (bash 5.3.15, coreutils 9.11). I pulled the
Second opinion. Codex Medium reviewed the same head and reached the same conclusion. Since its independence isn't guaranteed, its agreement adds less than the measurements above. It added two points that hold: the snapshots don't break anything (each function captures its own PID, and nested What happens next. Nothing was pushed here, because the change has nothing to fix. This now waits on the maintainer, and my recommendation is to close it. The setgid bug has open fixes in #9605, #9783 and #10113, and the maintainer will choose among them. |
|
Thank you for this, @fresh3nough. Closing because tested on a worker, the setgid launch failure happens with and without this change, so it does not fix the bug. Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent. |
|
Update: #12323 has 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 |
Summary
omarchy-windows-vmpins mount sources through/proc/$BASHPID/fd/N. Inprepare_caller_mounts,chmodran in the parent shell (correct PID) but the following$(stat ... "/proc/$BASHPID/fd/...")expandedBASHPIDinside a command-substitution subshell. That subshell has a different PID and a different descriptor table, so the 0700 privacy check could read a stale mode (e.g.2700) and abort launch with "Failed to start Windows VM" after a successful chmod.This snapshots
self_pid=$BASHPIDbefore every/proc/<pid>/fdaccess that can run under$(...)in:open_mount_sourcepinned_dir_containspinned_tree_containsbind_mount_leafprepare_caller_mountsFixes #10035
Test plan
test/shell.d/windows-vm-bashpid-test.shbash test/shell.d/windows-vm-bashpid-test.sh(all ok)$BASHPIDinside$(...)and that each helper snapshotsself_pid