Repository navigation
docs(minvmd): correct check_backend rustdoc link in krun/mod.rs - #333
Conversation
The module-level rustdoc incorrectly linked to VmError::check_backend which does not exist; the function lives in crate::krun::raw::check_backend. Closes #322 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single documentation link in the krun module's doc comment was corrected to point to the actual ChangesDocumentation Link Correction
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
sdd-validate · Implementation boundary · PR #333Boundary: Implementation (changed file is not a spec or architecture file). Gate results
FindingsInfo — Gate 1: proof artifacts deferred to consumer CI. The two proof artifacts — (a) file assertion on Gate 2 — pass. The sole changed file Gate 3 — pass. The diff is a single rustdoc link correction ( No Blocker findings. The feature tracking issue #311 already carries
|
Closes #322
FFI safety audit: R1.2 and R1.3 acceptance criteria
This PR is the deliverable for issue #322 ("FFI safety audit and safe-wrapper hardening"). The spec notes R1.2 and R1.3 are acceptance criteria for existing scaffolding, not new-from-scratch deliverables. The audit confirms the scaffolding already meets both requirements and corrects one rustdoc inaccuracy found during the audit.
R1.2 — SAFETY comments on every
unsafecallcrates/minvmd/src/krun/raw.rs: Theunsafe extern "C"block carries a comprehensive block-level// SAFETY:comment (lines 26–47) naming all libkrun preconditions: pointer lifetime, NUL-termination, range bounds (ctx_idvalidity,num_vcpustype bound), and ownership transfer (krun_start_enterconsumes the context). There are no otherunsafecall sites inraw.rs.crates/minvmd/src/krun/ctx.rs: Everyunsafeblock carries a per-call// SAFETY:comment (verified at lines 33–38, 52–55, 63–67, 107–117, 157–161, 185–187, 196–198, 217–220, 235–238).R1.3 — Safe-wrapper input validation and errno-preserving error translation
CString::new(...)before any FFI crossing; interior NUL bytes becomeVmError::NulInPath/VmError::NulInString.raw::check_backend(a free function in thekrunFFI module per the spec) translates negative libkrun return codes toVmError::Backend { op, source }wheresource = io::Error::from_raw_os_error(errno), preserving the original errno magnitude. Thei32::MINedge case is handled viachecked_neg().unwrap_or(libc::EOVERFLOW).raw.rscover: pass-through on success, errno preservation on negative return, and thei32::MINedge case.Code change
Corrected the rustdoc link in
krun/mod.rsthat referenced the non-existentVmError::check_backend; the function lives incrate::krun::raw::check_backend.Proof artifacts
File:
crates/minvmd/src/krun/raw.rs— theunsafe extern "C"block at line 48 is preceded by a// SAFETY:block comment naming all libkrun preconditions; no otherunsafecalls exist in the file. ✓Test:
cargo test -p minvmdpasses —check_backend_translates_negative_to_typed_errorandcheck_backend_handles_i32_mininraw.rs, and the NUL-rejection tests inctx.rs, verify that safe wrappers validate inputs and translate FFI return codes toVmError::Backend { op, source }preserving errno viaio::Error::from_raw_os_error. ✓Merging this pull request closes task sub-issue #322. Once every task sub-issue of the tracking issue #311 is closed the pipeline will advance to
sdd:donefor final human review.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
index.crates.ioSee Network Configuration for more information.
Summary by CodeRabbit