Repository navigation
fix(sandbox): preserve Linux overlayfs directory identity across copy-up - #6910
Draft
Colafornia wants to merge 2 commits into
Draft
Colafornia wants to merge 2 commits into
Colafornia wants to merge 2 commits into
Conversation
Generated-by: Google Antigravity
Reuse FS_IOC_GETFSUUID instead of accepting a shared backing fsid. Reject overlays without an instance UUID while preserving copy-up stability. Replace the synthetic fsid test with an explicit live-mount rejection test. Generated-by: OpenAI Codex
This branch has not been deployed
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.
English
Summary
Preserve workspace directory grants when Linux overlayfs copies a lower-layer directory to the writable upper layer. Creating
.maka-workspace.jsonmust not invalidate the grant used by ACPsession/newand later tools.Refs #6667 and #6815.
Root cause and identity boundary
DirectoryIdentityhashes(volume, ino, birth). Directory copy-up can change birth time while preserving the visible directory inode. Omit birth only for overlayfs, and obtain its instance UUID through the existingFS_IOC_GETFSUUIDpath.A nonzero
f_fsidis insufficient: withuuid=off/null, overlayfs returns the backing filesystem's fsid. Independent overlays can then share both fsid and a lower directory's inode. The initial PR accepted one overlay's grant after the same path was mounted with another upper directory. This revision removes overlayfs from the fsid branch and rejects mounts that cannot expose an instance UUID. It also removes the synthetic statfs helper and its obsolete test.The earlier claim that overlayfs always rejects
FS_IOC_GETFSUUID, or thatuuid=offimplies a zero fsid, was incorrect on the tested kernel. The ioctl returns a persistent instance UUID withuuid=on/auto;uuid=off/nullreturnsENOTTY, mapped toUnsupported.Verification
Verified at
0daa2ef6dc612300b893f82d27de368144c60509:7.2.12-orbstack-00394-gbecdd6130068:cargo test --offline --locked -p maka-sandbox --lib -F schemars/uuid1passed: 10 tests, 2 explicitly ignored live-mount tests.MAKA_TEST_OVERLAYFS_DIR, the individual test name, and-- --ignored --nocapture. Freshuuid=onanduuid=autooverlays passed copy-up stability;uuid=offanduuid=nulloverlays with nonzero fsid were rejected. The rejection test failed on the previous implementation because capture incorrectly succeeded.DirectoryIdentityandmaka-fs-tools::directory::open: the same overlay's grant survived unmount/remount; a different overlay rejected it. Both UUID-less configurations rejected capture.cargo fmt -p maka-sandbox -- --checkandgit diff --checkpassed.The live fixtures used temporary tmpfs-backed overlays inside a disposable Docker container with
CAP_SYS_ADMIN. These tests are explicitly ignored by default and are not wired into CI. Linux bubblewrap integration, clippy, macOS/Windows tests, fulljust check, and the full ACPsession/new→ tool execution check were not rerun for this revision. CI remains pending.AI use
Google Antigravity authored the initial change. OpenAI Codex verified and fixed the overlay identity collision, updated regression coverage, and ran the Linux checks above. Preserve the
Generated-bytrailers when squashing.Checklist
Does this PR entail a change in behavior?
中文
概述
保持 Linux overlayfs 目录从只读下层复制到可写上层后的工作区授权有效。创建
.maka-workspace.json不应使 ACPsession/new和后续工具使用的目录授权失效。关联 #6667 与 #6815。
根因与身份边界
DirectoryIdentity对(volume, ino, birth)计算哈希。目录复制到上层时,可见的 inode 保持不变,但创建时间可能改变。因此仅对 overlayfs 省略创建时间,并通过已有的FS_IOC_GETFSUUID路径获取实例 UUID。非零
f_fsid不足以证明实例身份:uuid=off/null下,overlayfs 返回底层文件系统的 fsid。不同 overlay 实例可能同时共享这个 fsid 和下层目录的 inode。初版 PR 在同一路径换挂另一个上层目录后,仍接受原实例的授权。本次修订移除 overlayfs 的 fsid 分支,拒绝无法提供实例 UUID 的挂载,并删除合成 statfs 测试及其专用辅助函数。此前关于 overlayfs 总是拒绝
FS_IOC_GETFSUUID、或uuid=off意味着 fsid 为零的描述,在本次内核实测中均不成立。uuid=on/auto时 ioctl 返回持久化的实例 UUID;uuid=off/null时返回ENOTTY,映射为Unsupported。验证
验证提交:
0daa2ef6dc612300b893f82d27de368144c60509:7.2.12-orbstack-00394-gbecdd6130068:cargo test --offline --locked -p maka-sandbox --lib -F schemars/uuid1通过,10 项通过、2 项真实挂载测试显式忽略。MAKA_TEST_OVERLAYFS_DIR,指定单个测试名并添加-- --ignored --nocapture,显式运行真实挂载测试。全新uuid=on、uuid=auto挂载通过目录复制后的身份稳定性检查;非零 fsid 的uuid=off、uuid=null挂载均被拒绝。拒绝测试在修改前因错误接受授权而失败。DirectoryIdentity和maka-fs-tools::directory::open:同一实例卸载后重挂仍接受原授权,不同实例拒绝该授权;两种无 UUID 配置均拒绝捕获授权。cargo fmt -p maka-sandbox -- --check与git diff --check通过。真实夹具是在带
CAP_SYS_ADMIN的一次性 Docker 容器内创建的临时 tmpfs 支撑 overlay 挂载。这些测试默认显式忽略,尚未接入 CI。本次修订未重跑 Linux bubblewrap 集成、clippy、macOS/Windows 测试、完整just check或完整 ACPsession/new→ 工具执行验收。CI 待完成。AI 使用
Google Antigravity 编写初版改动。OpenAI Codex 验证并修复 overlay 身份碰撞、更新回归测试并执行上述 Linux 检查。Squash 时保留
Generated-bytrailers。审查清单
本 PR 是否带来行为变更?