Repository navigation
tests: map the host's mapping tables in the adapter's VMs - #878
Open
Enrique Saurez (esaurez) wants to merge 1 commit into
Open
Enrique Saurez (esaurez) wants to merge 1 commit into
Enrique Saurez (esaurez) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The test-focused changes are consistent with the mapping contracts, with no unresolved blocking findings; runtime validation was not rerun during this review.
No open issues 🎉
What changed in this PR
This PR extends the runtime adapter’s end-to-end sandbox coverage by replacing guest-local mapping fixtures with real host exports, building on the host and guest mapping order.
Changes:
- Updates mapping probes to inspect host-provided mappings and run mapper checks from the export.
- Adds layered VM scenarios covering mapping access, hidden paths, failed-mapping teardown, and pre-launch refusals.
- Documents the revised probes and scenarios.
| File | Description |
|---|---|
| tests/runtime-adapter/tests/vm_layered.rs | Adds host-share fixtures, mapping scenarios, and guest/host assertions. |
| tests/runtime-adapter/src/worker/probes.rs | Exposes helpers and mount metadata to mapping probes. |
| tests/runtime-adapter/src/worker/mapping.rs | Inspects applied mappings and runs checks using host exports. |
| tests/runtime-adapter/src/worker.rs | Passes the mounted export to mapping probes. |
| tests/runtime-adapter/README.md | Documents probe arguments, facts, and mapping scenarios. |
Review effort: Balanced
This was referenced Oct 24, 2026
Enrique Saurez (esaurez)
force-pushed
the
esaurez/822-pr07-host-order-20261023
branch
2 times, most recently
from
October 26, 2026 18:37
8031d11 to
eaa4ebf
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/822-pr08-mapping-tables-vms-20261023
branch
from
October 26, 2026 19:03
4edd9d5 to
9f0c445
Compare
Pedro Henrique Penna (ppenna)
force-pushed
the
esaurez/822-pr07-host-order-20261023
branch
from
October 26, 2026 19:19
eaa4ebf to
e54abbc
Compare
Enrique Saurez (esaurez)
force-pushed
the
esaurez/822-pr08-mapping-tables-vms-20261023
branch
from
October 26, 2026 20:13
9f0c445 to
090de0a
Compare
The runtime adapter's mapping probes wrote their own sources below /tmp in the guest and mapped them through the root themselves, so no layered scenario mapped a host path: every launch shared nothing, and its guest applied an empty table. The probes now inspect what the host's mapping table put beneath the root, and map from the host export. map [NAME=PATH...] reports the export's mount, with its options, and the mode and owner of the directory above it; the mounts below the root, in order; and for each path, its mount options, what it shows, its entries or contents, whether a write is allowed, and what the overlay's upper holds there. map-checks DIR FILE maps the export's directory DIR and file FILE through mappers of the adapter's own, as it mapped its own sources before. map-refused is gone: a failed mapping of the table now latches the root. The layered scenarios share host directories and a file with the root through the launch's --share options: - the table over each image and upper, in the plan's order, whose writes reach the writable host sources alone, and which hides a denied path; - a failed mapping, which blocks Start: the launch stops the VM, which tears the root down and leaves the sources as they were; - a read-only share inside a writable one, shares at and over a tree that the adapter reserves, and a share outside the host directories that it authorizes, which the launch refuses before it spawns the VM. Without shares, the image over the scratch checks that zero mappings do no work: the guest mounts no export, and nothing is mounted below the root. Part of #822. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 04632931-537b-49f9-acc9-b12024ad6f3a
Pedro Henrique Penna (ppenna)
force-pushed
the
esaurez/822-pr08-mapping-tables-vms-20261023
branch
from
October 26, 2026 22:39
090de0a to
47f8bcd
Compare
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.
Stacked on #875; this PR retargets to dev when it merges.
Part of #822 (PR 8 of 11: mapping tables in VMs).
The runtime adapter's mapping probes wrote their own sources below
/tmpin the guest and mapped them through the root themselves, so no layered VM scenario mapped a host path: every launch shared nothing, and its guest applied an empty table. With the guest's and the host's order in place (#872, #875), the probes now inspect what the host's mapping table put beneath the root, and the layered scenarios share real host paths.Changes
Probes (
tests/runtime-adapter/src/worker/mapping.rs):map [NAME=PATH...]inspects the mappings that the worker applied from the host's table: the export's mount athostfs/root(export.count,export.type,export.options), the mode and owner ofhostfs, and the mount points below the root, in the mount table's order (mounts). For eachNAME=PATH, it reports the options of the topmost mount and the kind:directory,file SIZE,link,other,absent, ordeniedfor a path that the guest may not look up. It also reports a directory's entries or a file's contents, whether a write isallowedorrefused, and what the overlay's upper holds there. Last, it reports whether the root islatched.map-checks DIR FILEruns the adapter's own mapper checks from the export's directory DIR and file FILE instead of guest-local sources. The checks cover links and magic links at each component, wrong kinds, nested targets, reserved sets, and the read-only race. The race now uses a directory that the guest may write through the export, so only the mapping keeps it read-only.map-refusedis removed: a failed mapping of the table now latches the root in a VM.Scenarios (
tests/runtime-adapter/tests/vm_layered.rs). A scenario with the mapping table writessources/in its sandbox directory. It sharesdirread-only at/srv/maps/dir,dir/innerread-write inside it,file.txtread-only, andoutread-write. It hidesdir/secretwith--denyand authorizessourcesalone with--share-root:erofs_over_scratch(no shares)erofs_over_scratch_maps_the_tablerw,nosuid,nodevbelow a root-ownedhostfsof mode 0700. The four mappings, in the plan's order, each with its access,nosuid, andnodev. Targets created on the overlay, but none inside another mapping. The denied file, which its directory does not list and whose lookup the host refuses. Writes that reach only the writable host sources. Thenmap-checksfrom the exporterofs_over_ram_maps_the_table,gpt_over_scratch_maps_the_table,gpt_over_ram_maps_the_tablea_failed_mapping_tears_the_vm_downoutonto/usr/lib/os-release, a file of the image, and is fourth in the plan's order. The launch reportstable=failedandmapped=3, sends noStart, and stops the VM gracefully withsuccess 0and a complete teardown. It exits with 6, and the sources are unchangeda_read_only_share_inside_a_writable_one_is_refused_before_launcha_share_inside_a_reserved_tree_is_refused_before_launch,a_share_over_a_reserved_tree_is_refused_before_launch--reservedan_unauthorized_host_path_is_refused_before_launch--share-rootcheck_recordchecks the announced mapping count, and every launch that starts the sandbox checksmappedagainst its table. The README documents the mapping probes and the layered scenarios.Validation
On #875's head (
e54abbce, ondev4c29c1c5with #872 merged):host_session20 times on Linux and on Windows, without a failure.vm_layered32,vm_restart3,vm_steps3): WHP 38/38 and MSHV 38/38. KVM runs in CI once this PR targetsdev.