openvmm: source RAM unlink invalidates an already-opened snapshot
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
Start in openvmm/openvmm_helpers/src/snapshot/fs.rs with opened_file_generation, which records ctime, and follow where OpenedSnapshot stores that generation and where validate_memory_generation and duplicate_memory_file_for_mapping compare it. Reproduce by opening a snapshot whose memory.bin is hard-linked, then unlinking the source's temporary file before validation. Done means the opened generation stays valid after that unlink while length and mtime checks still reject real changes; the issue's fix.patch approach is one option to evaluate.
Written by the indexing model from the issue text.
Description
A valid microVM snapshot can fail restore when source teardown occurs after the restore has opened its RAM file. Automatic publication hard-links the source's RAM backing as memory.bin; dropping the source's temporary file removes the sibling link and changes the inode's ctime without changing the snapshot bytes.
In openvmm/openvmm_helpers/src/snapshot/fs.rs, the Linux opened_file_generation records that metadata change time:
length: metadata.len(),
modified_seconds: metadata.mtime(),
modified_nanoseconds: metadata.mtime_nsec(),
changed_seconds: metadata.ctime(),
changed_nanoseconds: metadata.ctime_nsec(),
})
}
OpenedSnapshot saves this generation when it opens the memory handle. Later validate_memory_generation and duplicate_memory_file_for_mapping compare against it, so a source unlink makes mapping preparation reject a snapshot whose identity, length, modification time and content are unchanged.
Trigger
- Capture using automatic RAM backing and publish
memory.binas a hard link. - Open the snapshot for restore while the source still owns its temporary backing file.
- Tear down the source, removing that other link.
- Validate or duplicate the opened RAM handle for mapping.
The final step incorrectly reports that the memory generation changed.
Fix
fix.patch removes ctime from the Linux generation comparison and retains file identity, length and modification time. Link-count changes, chmod and chown no longer invalidate the opened generation.
The alternative is a publication redesign that prevents source teardown from changing the published inode's metadata. Removing ctime fixes the normal unlink race without changing the publication mechanism.
- Dominant language
- Rust
- Stars
- 758
- Forks
- 48
- Avg merge
- 17h 50m
- Merged PRs (30d)
- 450
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/nvx
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/nvx#1172 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/nvx#1151 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/nvx#1147 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/nvx#1146 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
docs(metrics): replace stale src/metrics.rs line anchors in dashboard-metrics.md with symbol namesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
vfarcic/dot-agent-deck#2079 ·
Maintainers usually reply within 1 day
-
修改文件名时主键盘上的数字无法输入Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
qingjian-team/qingjian#894 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
rubys/roundhouse#1757 ·
-
enhancement user-priority/P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day