Skip to content

guest: hide the guest's space as internal reference code - #1262

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
esaurez/slim-2.4.1-sl7.0-20261103
Nov 4, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
esaurez/slim-2.4.1-sl7.0-20261103

Conversation

@esaurez

@esaurez Enrique Saurez (esaurez) commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1104: SL7.0, the guest's space becomes NVX's internal reference code, not public API. Stacked on #1261, which adds the public-API snapshots.

What changes

The guest's space stays usable for its current users, but stops presenting itself as supported public API:

  • guest/mappings.rs moves with git mv to guest/mappings/mapper.rs, which keeps the mapper: Mapper, TargetRoot, SourceRoot, Reserved, bind, Step, MappingError, ApplyError, UnmountFailure, TeardownError and its kernel seam. The moved file changes only in its imports, visibility and doc links; git diff -B -M or --color-moved shows the move. Its tests move with it, from mappings/tests.rs and mappings/tests/privileged.rs to mappings/mapper/tests.rs and mappings/mapper/tests/privileged.rs, with the fake kernel that guest::root::tests re-exports and their test-only Mapped and TeardownError methods.
  • A new guest/mappings.rs facade takes back the module's docs and the mapping values, Mapping, Access, Kind, InvalidMapping and MAX_PATH_BYTES, with MappingTable, TableError and Refusal, which stay public and documented. It re-exports the mapper's public items under #[doc(hidden)], so their paths keep working.
  • guest::{root, gpt}, guest::mappings::mapper and the activation's apply, Applied, RootTemplate, ApplyError, AppliedTeardownError and NetworkError are #[doc(hidden)], and each says that it is unstable internal reference code that becomes crate-private once nothing outside NVX uses it.
  • The guest module's docs list the public guest surface, and the public docs stop linking to hidden items: MappingTable's example mounts its mappings through a function of the caller's instead of the hidden mapper.

Everything else stays as it was, visible and unchanged: guest::entry; the activation in guest::clone, Activation and its states, with MACHINE_ID_FILE and RESOLVER_FILE; and the mapping values with MappingTable, TableError and Refusal.

No implementation changes: nvx-init, the runtime adapter and users pinned to the API-ready commit compile and behave as before.

Size

Against the base, #1261's head:

  • nvx-rs slimming workstream: make nvx a library of mechanisms and value types #1076's rule: 146 core lines in 1 counted file: the new facade's 143 and the moved mapper's 3 import lines. The files that only hide items, clone.rs (5), clone/activation/apply.rs (6) and guest/mod.rs (2), count like a move: markers, hidden re-exports and the imports that they force.
  • Pairing the move as git diff -B -M does: 159 core lines in 5 files, under the 600-line limit and at the five-file cap, before the rule leaves out the files that only hide items. A plain line count gives 807 core lines in the same 5 files, since it reads the new facade at the old path as a rewrite of the whole old file.
  • git diff -B -M --stat: nvx-rs/src/guest/{mappings.rs => mappings/mapper.rs} | 245 ++----

The issue estimates 350 core lines in 4 counted files, with a stop at 600.

Public API snapshot

python scripts/public_api.py --update changed nvx-rs/public-api/linux.txt only; windows.txt is unchanged, and python scripts/public_api.py passes.

The supported public API is unchanged: no path is removed, no visible line is added, and 3096 of the base's 3426 lines stay as they were, among them the 50 of the mapping values, MappingTable, TableError and Refusal. Every other change marks an item of the families that this change hides on purpose, the space's reference code:

  • 330 lines gain (hidden): 215 of nvx::guest::root, 9 of nvx::guest::gpt, 52 of the activation's application in nvx::guest::clone, and 54 of the mapper's items at their old nvx::guest::mappings paths, which hidden re-exports keep. For example:

    -mod nvx::guest::root
    +mod nvx::guest::root (hidden)
    -mod nvx::guest::gpt
    +mod nvx::guest::gpt (hidden)
    -struct nvx::guest::clone::Applied
    +struct nvx::guest::clone::Applied (hidden)
    -struct nvx::guest::mappings::ApplyError
    +struct nvx::guest::mappings::ApplyError (hidden)
  • 55 lines are new, all hidden: the nvx::guest::mappings::mapper path and its items.

The 55 new lines
+mod nvx::guest::mappings::mapper (hidden)
+struct nvx::guest::mappings::mapper::ApplyError (hidden)
+method nvx::guest::mappings::mapper::ApplyError::entry (hidden)
+method nvx::guest::mappings::mapper::ApplyError::error (hidden)
+struct nvx::guest::mappings::mapper::Mapper (hidden)
+method nvx::guest::mappings::mapper::Mapper::apply (hidden)
+method nvx::guest::mappings::mapper::Mapper::check (hidden)
+method nvx::guest::mappings::mapper::Mapper::is_latched (hidden)
+method nvx::guest::mappings::mapper::Mapper::new (hidden)
+method nvx::guest::mappings::mapper::Mapper::targets (hidden)
+method nvx::guest::mappings::mapper::Mapper::teardown (hidden)
+enum nvx::guest::mappings::mapper::MappingError (hidden)
+variant nvx::guest::mappings::mapper::MappingError::Foreign (hidden)
+field nvx::guest::mappings::mapper::MappingError::Foreign::path (hidden)
+variant nvx::guest::mappings::mapper::MappingError::Latched (hidden)
+variant nvx::guest::mappings::mapper::MappingError::Link (hidden)
+field nvx::guest::mappings::mapper::MappingError::Link::path (hidden)
+variant nvx::guest::mappings::mapper::MappingError::MountPoint (hidden)
+variant nvx::guest::mappings::mapper::MappingError::Moved (hidden)
+field nvx::guest::mappings::mapper::MappingError::Moved::mounted (hidden)
+variant nvx::guest::mappings::mapper::MappingError::NotDirectory (hidden)
+field nvx::guest::mappings::mapper::MappingError::NotDirectory::path (hidden)
+variant nvx::guest::mappings::mapper::MappingError::Overlap (hidden)
+field nvx::guest::mappings::mapper::MappingError::Overlap::mapped (hidden)
+variant nvx::guest::mappings::mapper::MappingError::Reserved (hidden)
+variant nvx::guest::mappings::mapper::MappingError::SourceKind (hidden)
+variant nvx::guest::mappings::mapper::MappingError::System (hidden)
+field nvx::guest::mappings::mapper::MappingError::System::error (hidden)
+field nvx::guest::mappings::mapper::MappingError::System::step (hidden)
+variant nvx::guest::mappings::mapper::MappingError::TargetKind (hidden)
+method nvx::guest::mappings::mapper::MappingError::raw_os_error (hidden)
+struct nvx::guest::mappings::mapper::Reserved (hidden)
+method nvx::guest::mappings::mapper::Reserved::container_root (hidden)
+method nvx::guest::mappings::mapper::Reserved::new (hidden)
+struct nvx::guest::mappings::mapper::SourceRoot (hidden)
+method nvx::guest::mappings::mapper::SourceRoot::open (hidden)
+enum nvx::guest::mappings::mapper::Step (hidden)
+variant nvx::guest::mappings::mapper::Step::Attach (hidden)
+variant nvx::guest::mappings::mapper::Step::Clone (hidden)
+variant nvx::guest::mappings::mapper::Step::Create (hidden)
+variant nvx::guest::mappings::mapper::Step::Locate (hidden)
+variant nvx::guest::mappings::mapper::Step::Restrict (hidden)
+variant nvx::guest::mappings::mapper::Step::Source (hidden)
+variant nvx::guest::mappings::mapper::Step::Status (hidden)
+variant nvx::guest::mappings::mapper::Step::Unmount (hidden)
+variant nvx::guest::mappings::mapper::Step::Walk (hidden)
+struct nvx::guest::mappings::mapper::TargetRoot (hidden)
+method nvx::guest::mappings::mapper::TargetRoot::add_mount (hidden)
+method nvx::guest::mappings::mapper::TargetRoot::open (hidden)
+struct nvx::guest::mappings::mapper::TeardownError (hidden)
+method nvx::guest::mappings::mapper::TeardownError::failures (hidden)
+struct nvx::guest::mappings::mapper::UnmountFailure (hidden)
+method nvx::guest::mappings::mapper::UnmountFailure::error (hidden)
+method nvx::guest::mappings::mapper::UnmountFailure::target (hidden)
+fn nvx::guest::mappings::mapper::bind (hidden)

Tests

Every test of the area is kept: none is rewritten or retired. The mapper's 23 tests and 10 privileged tests move with it, and change only in their imports, which gain the 3 items that the mapper no longer brings into scope, and in the privileged tests' run command, in their module's docs, which names their new path. The mapping table's 10 tests stay in mappings/table/tests.rs.

check_test_changes.py reports 2 changes to existing tests, hence tests-modified: the import blocks of guest::mappings::tests (mappings/tests.rs:8) and guest::mappings::tests::privileged (mappings/tests/privileged.rs:15), which it lists as removed, since those modules moved to guest::mappings::mapper::tests and guest::mappings::mapper::tests::privileged. Its 2 added entries are their import blocks at the new path, and the 68 entries that it relocates unchanged are the moved tests and their helpers.

Validation

The Linux and Windows gates ran at 36200473, this change on #1261's earlier head 058a6146. #1261's final head differs from that one only in scripts/public_api.py, whose rustdoc no longer enables default features and which now lists re-exported enum variants, and in that script's test. The range-diff shows this change's patch unchanged, and at this head python scripts/public_api.py passes and check_test_changes.py reports the same changes.

  • Linux (Azure Linux 3, kernel 6.18): the steps of check-nvx-rs, validate-nvx and check-quality, including both clippy --bins configurations and scripts/public_api.py, pass. As root, the mapper's privileged tests pass 10 of 10 before the move, as guest::mappings::tests::privileged, and after it, as guest::mappings::mapper::tests::privileged.
  • Windows (Windows 11): the Rust, runtime-adapter and Python steps pass, py-unittest with 1796 tests (74 skipped), except for test_adversarial.py's full runs under two Pythons:
    • Under the host's Python, a Microsoft Store install, it fails its 4 containment tests, test_contained_* (2 failures and 2 errors in 84 tests), as it does at the base.
    • Under an embeddable Python 3.14.9, whose path file keeps the scripts' directory off the module path, it fails 3 tests (2 failures and 1 error), where its subprocesses can't import the scripts' modules. That Python passes the 4 containment tests run alone.
    • At this head, under a regular CPython 3.14.9 install, its full run passes: 84 tests, with the same 11 skipped as under the Store Python.
  • MicroVMs, at b9869dea, this change before its rebase onto ci: check nvx's public API against committed snapshots #1261, with the guest artifacts built from that commit (guest-binary source identity 84efc161): the six test-microvm scenarios, four of them on public sandboxes, and test-runtime-adapter pass on WHP (Intel Alder Lake) and on MSHV (AMD Genoa). On MSHV, that pass is the fifth run: the first two failed most of test-runtime-adapter, whose sockets' paths a long temporary directory made longer than Linux's 108 bytes, and with a shorter one, the next two each lost one of its tests to the time contract's 100 µs sample limit while builds loaded the host. From b9869dea to this head, the range-diff adds only the snapshot update to this change, and git diff --stat touches 10 files, none of them a runtime input: ci: check nvx's public API against committed snapshots #1261's two CI actions, three documents, its section of nvx-rs/README.md, scripts/public_api.py and its test, and the two snapshots, the Linux one with this change's update.

@esaurez Enrique Saurez (esaurez) added the tests-modified Changes existing tests, test data, or test wiring label Nov 4, 2026
@esaurez
Enrique Saurez (esaurez) requested a balanced review from Copilot November 4, 2026 02:24
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This pull request changes existing tests

It modifies or removes 2 existing test asset(s), listed below. Review each with care: a change to a test can hide a regression that the test caught. See doc/contribute.md#changes-to-existing-tests.

Test code

Change What Before After
removed imports the imports of guest::mappings::tests nvx-rs/src/guest/mappings/tests.rs:8
removed imports the imports of guest::mappings::tests::privileged nvx-rs/src/guest/mappings/tests/privileged.rs:15

Relocated unchanged: 68; added: 2. Compared the merge base 586ccf8826f9 with 6c6b40f2e7d5.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues requiring resolution before approval.

No open issues 🎉

What changed in this PR

Implements SL7.0 of #1104 by separating NVX’s internal guest-space reference code from its documented public API. Existing paths remain usable, while mapping values and MappingTable stay publicly documented.

Changes:

  • Moves the mapper and its tests into a hidden submodule, preserving existing paths through re-exports.
  • Hides root, guest GPT, and activation-application APIs without changing their implementations.
  • Updates documentation and the Linux API snapshot to reflect the supported public surface.
File Description
nvx-rs/​src/​lib.rs Distinguishes public guest APIs from internal reference code.
nvx-rs/​src/​guest/​root/​share.rs Removes a documentation link to the hidden root API.
nvx-rs/​src/​guest/​root.rs Documents internal status and clarifies bootstrap links.
nvx-rs/​src/​guest/​mod.rs Hides root and GPT modules and describes the public surface.
nvx-rs/​src/​guest/​mappings/​table.rs Updates documentation and examples to avoid hidden APIs.
nvx-rs/​src/​guest/​mappings/​mapper/​tests/​privileged.rs Relocates privileged tests and updates imports and run instructions.
nvx-rs/​src/​guest/​mappings/​mapper/​tests.rs Relocates mapper tests and adjusts imports.
nvx-rs/​src/​guest/​mappings/​mapper.rs Houses the moved mapper as internal reference code.
nvx-rs/​src/​guest/​mappings.rs Keeps public mapping contracts and hidden compatibility re-exports.
nvx-rs/​src/​guest/​gpt.rs Documents the guest GPT module’s internal status.
nvx-rs/​src/​guest/​entry.rs Removes documentation links to hidden guest-space APIs.
nvx-rs/​src/​guest/​clone/​activation/​apply.rs Hides application APIs while keeping constants documented.
nvx-rs/​src/​guest/​clone/​activation.rs Removes documentation links to hidden activation application.
nvx-rs/​src/​guest/​clone.rs Separates hidden application exports from public activation APIs.
nvx-rs/​README.md Explains public contracts and internal guest-space boundaries.
nvx-rs/​public-api/​linux.txt Records hidden items and the new hidden mapper paths.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the separation of internal guest-space reference code from the supported public API.

No open issues 🎉

Review effort: Balanced

Base automatically changed from esaurez/slim-1.1.1-sl0.4-20261103 to dev November 4, 2026 06:12
@esaurez
Enrique Saurez (esaurez) marked this pull request as ready for review November 4, 2026 15:41
@esaurez
Enrique Saurez (esaurez) marked this pull request as draft November 4, 2026 15:51
@ppenna
Pedro Henrique Penna (ppenna) marked this pull request as ready for review November 4, 2026 17:36
The guest's space, the root that an init assembles and what it mounts
in it, is each init's own. NVX's space stays usable for its current
users, but stops presenting itself as supported public API.

guest::mappings splits: the mapper moves with its tests to the hidden
guest::mappings::mapper, whose public items keep their paths through
hidden re-exports, and the module keeps its docs, the mapping values
and MappingTable, which stay public. guest::{root, gpt} and the
activation's application (apply, Applied, RootTemplate, ApplyError,
AppliedTeardownError, NetworkError) become hidden too. Each says that
it is unstable internal reference code, which becomes crate-private
once nothing outside NVX uses it, and the public docs stop linking to
hidden items. Nothing else changes.

Part of #1104.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52656ee0-ecc4-4cfd-987b-9b71e72f0f50
Copilot-Session: 383380be-1df9-4f25-bf77-97c24b2eb591
@esaurez
Enrique Saurez (esaurez) force-pushed the esaurez/slim-2.4.1-sl7.0-20261103 branch from 83da90b to 6c6b40f Compare November 4, 2026 18:30
Copilot AI balanced review requested due to automatic review settings November 4, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change separating supported public APIs from internal guest-space reference code.

No open issues 🎉

Review effort: Balanced

@ppenna
Pedro Henrique Penna (ppenna) added this pull request to the merge queue Nov 4, 2026
Merged via the queue into dev with commit 6bcb68f Nov 4, 2026
60 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the esaurez/slim-2.4.1-sl7.0-20261103 branch November 4, 2026 19:00
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Neuro-formal verification (NFV) selects nontrivial properties from PR intent and source, tries verification, then tries refutation.

NFV: 0 refuted, 8 verified in PR #1262

PR head 6c6b40f2e7d5, base 586ccf8826f9 · run and evidence

These are results for translated models under their stated assumptions, not proofs of source-code correctness or confirmed source bugs.

refuted: 0 · verified: 8 · resources exhausted: 0 · type-check/audit failure: 2

P1

Intended property: Invalid proposed property

Outcome: type-check/audit failure

Diagnostic

Inferred property lacks an exact captured-source quote

P2

Inferred property: For any mappings slice, apply_with attempts mappings in order; it returns Ok for an empty slice or after all attachments succeed, but stops at the first attachment failure and returns ApplyError containing that mapping’s zero-based index and error without attempting later mappings.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): for (entry, mapping) in mappings.iter().enumerate()

Assumptions: No additional input restrictions.

Environment models: Models one attach_with call using an abstract Result token: zero is success and a nonzero token identifies the returned MappingError.

Checked property:

ensures (|attachmentResults| == 0 ==> ok && |attempted| == 0) && |attempted| == |attachmentResults| && (ok <==> (forall k :: 0 <= k < |attachmentResults| ==> attachmentResults[k] == 0)) && (ok ==> (forall k :: 0 <= k < |attempted| ==> attempted[k])) && (!ok ==> 0 <= errorEntry < |attachmentResults| && error == attachmentResults[errorEntry] && error != 0 && (forall k :: 0 <= k < errorEntry ==> attachmentResults[k] == 0) && (forall k :: 0 <= k < |attempted| ==> attempted[k] == (k <= errorEntry)))

Evidence: 13baa4c7cad55870ecd8/verification/model.dfy; SHA-256 78348610c51674584fe0e5e8fa27babd90dc45f2a925a818b79df2c3e674c9ea.

The full verified Dafny is retained in the linked run artifact.

P3

Inferred property: For any sequence returned by unmount_with, teardown_with returns Ok exactly when the sequence is empty; otherwise it returns TeardownError containing every UnmountFailure in the same order, with only the associated indices discarded.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): if failures.is_empty() {
Ok(())
} else {
Err(TeardownError { failures })
}

Assumptions: The two input sequences encode the index and failure components of the same sequence of pairs returned by unmount_with.

Environment models: Represents the environment-dependent sequence returned by unmount_with using explicit index and UnmountFailure-token inputs.

Checked property:

ensures (ok <==> |unmountFailures| == 0) && (|unmountFailures| != 0 ==> !ok && teardownFailures == unmountFailures)

Evidence: 2525e56c58c2af0ce205/verification/model.dfy; SHA-256 f29831e3e294e2cc758f00482e651be00530804c033b06cdd1a59143c8817332.

The full verified Dafny is retained in the linked run artifact.

P4

Inferred property: For any result from attach, bind_with returns a Mapped containing that successful mount ID and an owned copy of mapping's target; on failure, it returns the failure's MappingError.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): .map(|mount| Mapped {
target: mapping.target().to_path_buf(),
mount,
})
.map_err(|failure| failure.error)

Assumptions: When attach succeeds, its mount ID is representable as Rust's u64.

Environment models: Represents attach's supplied Result outcome, preserving its successful u64 mount ID or its failure's MappingError.; Returns an owned sequence with the same contents as mapping.target().to_path_buf().

Checked property:

ensures (attachSucceeded ==> (resultSucceeded && resultMount == attachMount && resultTarget == mappingTarget)) && (!attachSucceeded ==> (!resultSucceeded && resultError == attachFailureError))

Evidence: 6274f200f0edd8bab017/verification/model.dfy; SHA-256 1ce77592fb5adb1eba97baf8a3931a3210314e34deb0af7c686a1ce414e12305.

The full verified Dafny is retained in the linked run artifact.

P5

Inferred property: For any attachment attempt, if the mapper is already latched it returns Latched without attempting or recording the mapping. Otherwise, success appends the target and returned mount to the tracked mappings; any target refusal or attachment failure latches the mapper, returns that error, and records the failed attachment as stray exactly when the failure supplies a stray tree.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): unless the mapper is latched; a refusal or failure latches it, and the mapper
/// keeps a mapping that a rename moved and that the attach failed to detach.

Assumptions: The parallel target and mount sequences represent the same tracked mapping records.; There is one target-containment result for each existing mapping.; Existing and newly returned mount identifiers fit Rust's u64 type.

Environment models: Refuses a reserved target or a target contained within an earlier mapping, and otherwise succeeds.; Returns an explicitly supplied normal attachment outcome, including the mount on success or the error and optional stray tree on failure.

Checked property:

ensures (initialLatched ==> !resultOk && resultError == -1 && latched && !attachAttempted && mappedTargetsOut == mappedTargets && mappedMountsOut == mappedMounts && hasStray == initialHasStray && strayTarget == initialStrayTarget && strayTree == initialStrayTree) && (!initialLatched && !reservedHolds && (forall i | 0 <= i < |within| :: !within[i]) && attachOk ==> resultOk && !latched && attachAttempted && mappedTargetsOut == mappedTargets + [target] && mappedMountsOut == mappedMounts + [attachMount] && hasStray == initialHasStray && strayTarget == initialStrayTarget && strayTree == initialStrayTree) && (!initialLatched && (reservedHolds || (exists i | 0 <= i < |within| :: within[i])) ==> !resultOk && resultError == checkError && latched && !attachAttempted && mappedTargetsOut == mappedTargets && mappedMountsOut == mappedMounts && !hasStray) && (!initialLatched && !reservedHolds && (forall i | 0 <= i < |within| :: !within[i]) && !attachOk ==> !resultOk && resultError == attachError && latched && attachAttempted && mappedTargetsOut == mappedTargets && mappedMountsOut == mappedMounts && hasStray == attachHasStray && (attachHasStray ==> strayTarget == target && strayTree == attachTree))

Evidence: 71b6010a3c81a1b03f07/verification/model.dfy; SHA-256 0264745350ad28b06f7720295a7305047962d18643d1cac0c31fba98c5499e41.

The full verified Dafny is retained in the linked run artifact.

P6

Inferred property: For any mapper state, unmount_with first attempts to detach an existing stray mapping, then attempts every mapped mount in reverse attachment order; it clears both stored collections regardless of failures and returns exactly the failures in attempt order, assigning the stray index mapped.len() and each ordinary failure its original attachment index.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): Detaches the mapping that a rename moved, if the mapper failed to detach it, then unmounts
/// the mappings in reverse order with `kernel`, forgets them all, and returns, in the order of
/// the attempts, each that it failed to unmount, with its index among the mapper's attaches

Assumptions: There is one abstract unmount outcome, returned error, and absolute target for each stored mapping.

Environment models: Produces mapped indices in reverse attachment order for the modeled loop interval.; Selects failed mapped indices in reverse attempt order.; Selects the absolute targets belonging to failed mapped unmount attempts.; Selects the errors belonging to failed mapped unmount attempts.; Represents the environment-dependent result of attempting to detach the stray tree.; Represents whether the captured unmount operation succeeds and, on failure, which MappingError it returns.; Represents the uncaptured absolute-path conversion used when constructing an UnmountFailure.; Represents wrapping a detach error as a system error for the Unmount step.

Checked property:

ensures attemptIndices == (if hasStray then [|mapped|] else []) + ReverseAttemptRange(|mapped|, 0) && mappedRemaining == [] && !strayRemaining && failureIndices == (if hasStray && detachFails then [|mapped|] else []) + FailureIndexRange(ordinaryFails, |mapped|, 0) && failureTargets == (if hasStray && detachFails then [absoluteStrayTarget] else []) + FailureTargetRange(ordinaryFails, absoluteMappedTargets, |mapped|, 0) && failureErrors == (if hasStray && detachFails then [straySystemError] else []) + FailureErrorRange(ordinaryFails, ordinaryErrors, |mapped|, 0)

Evidence: 1442d055d1892b1f484b/verification/model.dfy; SHA-256 78016ff3872b104ade43804abf14e6bb24a3a86ab56f46361c00241913f4c599.

The full verified Dafny is retained in the linked run artifact.

P7

Inferred property: After moving the tree succeeds, `attach` returns its mount ID only when locating the target reports that same ID as a mount root. Otherwise it attempts detachment: successful detachment reports `Moved { mounted: false }`, while failed detachment reports `Moved { mounted: true }` and preserves the tree as a stray.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): // The tree keeps the mount busy, so only a detach takes it off wherever it went.

Assumptions: The mount ID obtained from the tree status is a Rust u64 value.; The mount ID reported while locating the target is a Rust u64 value.

Environment models: Supplies whether open_source succeeds; its descriptor and kind are irrelevant to the selected property.; Supplies source-status success, mount-root status, and whether its kind converts to a mapping kind.; Supplies whether walk returns a destination.; Supplies whether the kernel opens or clones the source tree.; Supplies whether setting the requested tree attributes succeeds.; Supplies whether tree status succeeds and the mount ID it reports.; Supplies whether moving the tree to the destination succeeds.; Supplies locate's success and the mount ID and mount-root flag from the located target status.; Supplies whether detaching the moved tree succeeds.

Checked property:

ensures moved ==> ((outcome == 0 ==> returnedMount == mountInput && locateOkInput && locateMountInput == mountInput && locateMountRootInput) && (!(locateOkInput && locateMountInput == mountInput && locateMountRootInput) ==> detachAttempted && ((detachOkInput && outcome == 3 && !mounted && !stray) || (!detachOkInput && outcome == 4 && mounted && stray))))

Evidence: ff0220488dfa2864118b/verification/model.dfy; SHA-256 978d0df6369e05e185f50d3c1d798e46aeb867781149ec83a37645482007c6d7.

The full verified Dafny is retained in the linked run artifact.

P8

Inferred property: For any relative target, check_target returns Reserved when the target is reserved; otherwise it returns Overlap naming the first existing mapped target equal to or beneath that target, and returns success if no such mapping exists.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): if self.reserved.holds(target) {
return Err(MappingError::Reserved);
}

Assumptions: The encoded mapping boundary sequence contains an initial boundary.; The first mapped target starts at the beginning of mappedBytes.; The final mapping boundary is the end of mappedBytes.; Every encoded mapping boundary lies within mappedBytes.; Mapping boundaries are ordered according to Mapper.mapped.; Each target element represents an unsigned path byte.; Each stored target element represents an unsigned path byte.; The supplied target is represented as a relative byte path.; Each nonempty stored mapped target is represented as a relative byte path.

Environment models: Returns the Unix byte representation supplied for a path without changing it.; Returns true exactly when inner equals outer or begins with outer followed by a slash.; Represents absolute(&mapped.target) by prefixing the stored relative target bytes with '/'.

Checked property:

ensures (reservedHolds ==> resultStatus == 1) && (!reservedHolds ==> ((resultStatus == 0 && overlapIndex == -1 && overlapTarget == [] && (forall i | 0 <= i && i + 1 < |mappedEnds| :: !WithinSpec(mappedBytes[mappedEnds[i]..mappedEnds[i + 1]], target))) || (resultStatus == 2 && 0 <= overlapIndex && overlapIndex + 1 < |mappedEnds| && overlapTarget == AbsoluteBytes(mappedBytes[mappedEnds[overlapIndex]..mappedEnds[overlapIndex + 1]]) && WithinSpec(mappedBytes[mappedEnds[overlapIndex]..mappedEnds[overlapIndex + 1]], target) && (forall j | 0 <= j && j < overlapIndex :: !WithinSpec(mappedBytes[mappedEnds[j]..mappedEnds[j + 1]], target)))))

Evidence: eb92c87c6850b9e073ab/verification/model.dfy; SHA-256 25ebbb29c54e2da90f5777d079be01e0c183d481cb58380bebeb9504bce27504.

The full verified Dafny is retained in the linked run artifact.

P9

Inferred property: For any source and path, open_source treats an empty path as "." and otherwise uses the supplied path, opens it beneath the source without crossing mounts, obtains its status, and returns the descriptor with the corresponding directory/file Kind; path conversion, opening, or status failures become System errors at Step::Source, while any other file kind yields SourceKind.

Outcome: verified

The property was verified for the translated model.

Verification details

Captured source (inferred property): `openat2` resolves no empty path, so the root itself is `.` beneath it

Assumptions: No additional input restrictions.

Environment models: Path conversion preserves the selected path when successful; its success and error are explicit environment inputs.; The beneath-open operation uses its supplied arguments; its descriptor or error is an explicit environment result.; Status queries the opened descriptor and returns an explicit success, file-kind, or error result.; Directory and regular-file status kinds map to the corresponding Kind; every other status kind is rejected.; A system-call error is represented as MappingError::System at Step::Source with the same modeled error value.

Checked property:

ensures usedPath == (if |path| == 0 then [46] else path) && conversionCalled && openCalled == conversionOkIn && statusCalled == (conversionOkIn && openOkIn) && (openCalled ==> openDirectory == source && openPath == usedPath && openFlags == 1 && openMode == 0 && !crossMounts) && (statusCalled ==> statusDescriptor == openedDescriptorIn) && (!conversionOkIn ==> resultTag == 1 && resultStep == 0 && resultError == conversionErrorIn) && (conversionOkIn && !openOkIn ==> resultTag == 1 && resultStep == 0 && resultError == openErrorIn) && (conversionOkIn && openOkIn && !statusOkIn ==> resultTag == 1 && resultStep == 0 && resultError == statusErrorIn) && (conversionOkIn && openOkIn && statusOkIn && (statusKindIn == 0 || statusKindIn == 1) ==> resultTag == 0 && resultDescriptor == openedDescriptorIn && resultKind == statusKindIn) && (conversionOkIn && openOkIn && statusOkIn && statusKindIn != 0 && statusKindIn != 1 ==> resultTag == 2)

Evidence: 19e5a11a39056785b7cb/verification/model.dfy; SHA-256 71fa3fb9d39e3d5616a6f062cef9b599ddc08568a8e504f4042ebdfbe30946e5.

The full verified Dafny is retained in the linked run artifact.

P10

Inferred property: For terminating tree and path iterators, `new` succeeds exactly when every input is a valid canonical absolute target; on success it stores both sequences in order with the leading root removed, and if any input is invalid it returns `InvalidMapping::Target` instead of a `Reserved` value.

Outcome: type-check/audit failure

Diagnostic

'NoneType' object is not iterable

Generated by NFV PR reviewer for #1262 · copilot · gpt56 · 458.5 AIC · ⌖ 17.8 AIC · ⊞ 1.1K · ◷

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add microsoft/neuro-formal-verification/workflow@498aad98c39314a8c55c89dff42d771276b957d8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests-modified Changes existing tests, test data, or test wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants