mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
A parent folder's VM can move a nested project folder aside and put a link in its place. The checks around a start refuse what they see, but a swap timed for the moment Virtualization.framework opens the share, and put back before devvm's last check, made the nested VM mount the link's target. On vz, the Lima backend now mounts the project folder as location /.vol/<dev>/<ino>, from the folder devvm recorded (the state's folder, passed as the new Want.ProjectID), with mountPoint set to its path. macOS's volfs opens the folder by its inode wherever it is, so the share is the recorded folder, never what's at the path. Checked first on a real vz VM (Lima 2.2.1, macOS 26): vz and Lima accept the /.vol location; with the folder swapped for a link before limactl start the VM read the real folder's files at the project path, and wrote there; limactl list --json keeps the location and mountPoint as set. vz serves the share by the path the folder had at the start, so once the folder is put back the VM gets Operation not permitted (as for any rename while it runs) until its next start, and replacing that path with a link while it runs gives the same: never the decoy. The Lima backend alone decides it: projectMount (vz with a recorded folder: by inode; otherwise, and on QEMU/9p, by path), used by CreateVM (the image's vmType, which its clone has) and Start's wantEdits, which now compares the project mount whole (location, path in the VM, writable) through keptMounts, so a start edits nothing when they match and limactl list's filled-in fields never cause an edit. Instance.Project is the mount's path in the VM, so devvm's comparisons, devvm ls, devvm ports and .git protection keep using the host path. mount_comma checks the path in the VM too. platform.VolPath parses a FolderID. The checks from the nested-replaced fix stay, as defence in depth and for Linux, where 9p has no equivalent. Docs: internals/lima.md (the mount, the compare), internals/overview.md (what's checked and what stays open per OS), safety/attack-vectors.md (the residual gap is Linux's only), using/vms.md. Tests: TestVolPath (parsing; on macOS the path opens a moved folder), TestProjectMountByInode (wantEdits on vz: as it is, another inode, moved, a comma, a path mount before, no folder recorded, --clone; QEMU by path; Instance.Project), TestCreateVMByInode (the clone's mount, no mount edit), TestUp (spec and start carry the state's folder), TestUpClone (none); e2e's project section: the folder swapped as limactl start runs and put back when it returns, through the parent's VM (macOS: the VM never sees the decoy, its mount is /.vol/<dev>/<ino> at the path; Linux: noted), and the next start runs no limactl edit. Co-Authored-By: Claude Opus 5.5 <[email protected]>