Repository navigation
test(sandbox): check held buffers survive resized snapshots - #1995
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The tests do not force scratch-slot reuse or directly verify release of restored owners, leaving aliasing and lease leaks undetected.
2 open issues
What changed in this PR
This PR adds sandbox regression coverage for held byte buffers across scratch-size changes, following up on #1947.
Changes:
- Exercises guest- and host-originated buffers through 8 → 2 → 16 MiB snapshots.
- Checks retained bytes after restore and traffic through both transport pools.
- Exercises release and repeated holds, then restores an 8 MiB snapshot.
| File | Description |
|---|---|
src/hyperlight_host/src/sandbox/initialized.rs |
Adds the held-buffer regression test for resized snapshots. |
Review effort: Balanced
ludfjig
left a comment
There was a problem hiding this comment.
thanks! nit: clanker comments
A held byte chunk keeps a transport pool slot live and an alias mapped to it in the transport arena. A snapshot with another scratch size moves the scratch base but leaves the arena at its fixed GPA, so the held alias is the state most likely to break on a resize. The held-buffer tests so far only take same-size snapshots. Hold guest- and host-originated chunks in an 8 MiB sandbox, then shrink it to 2 MiB and grow it to 16 MiB through snapshots taken with the chunks held. The live sandbox holds other chunks at each restore, so only the snapshot can bring the first ones back. After each restore, move bytes through both pools and read the held bytes back. Then check that release returns their length, that the freed slots serve more holds than the pools have slots, and that the sandbox can resize back to 8 MiB and hold chunks there. Signed-off-by: danbugs <danilochiarlone@gmail.com>
49ca58d to
9ca04d7
Compare
Benchmark ResultsMeasured commit: kvm / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
kvm / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / amd (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / intel (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
Reported by |

Follows up Ludvig's request on #1947 for a test of held buffers across resized snapshots. A held byte chunk keeps a pool slot live and an alias mapped into the transport arena. A resize moves the scratch base but not the arena, and the existing held-buffer tests only take same-size snapshots.