oxidecomputer / oxidecomputer/propolis
block/file: be more defensive about the backing file
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 270
- Forks
- 42
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 6
Description
in file.rs we'll just open the backing file for whatever permissions the disk should have: https://github.com/oxidecomputer/propolis/blob/2dc643742f82d2e072a1281dab23ba2bfdcee440/lib/propolis/src/block/file.rs#L175
but we don't get O_EXCL in here anywhere. I'd thought offhandedly that we could take advantage of that for a very weird one-off test configuration (opening a volume from multiple propolises concurrently), but this was appropriately worrying to everyone else with more calibrated fear-o-meter. we should probably open with O_EXCL, which I think we can plumb in with custom_flags()
if Propolis is told to open a file for writing by multiple VMs concurrently that's likely a serious operator error. I'm less opposed to concurrent read-only opens, but caution seems more appropriate here. I've definitely corrupted guests doing this nonsense locally before.
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start in lib/propolis/src/block/file.rs around line 175 and read how the backing file is opened, then check Rust's Unix OpenOptionsExt::custom_flags documentation. Add the requested exclusive-opening behavior and verify that concurrent writable opens are rejected while the intended read-only behavior remains clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100