Skip to content

Commit 0a193b3

Browse files
authored
Remove i686-guest, nanvix-unstable and guest-counter features (#1525)
* Remove i686-guest, nanvix-unstable and guest-counter features Removes the experimental 32-bit i686 guest support along with the nanvix-unstable and guest-counter cargo features that depended on or accompanied it. This deletes the i686 arch modules, the PEB file-mapping plumbing (labels, preallocated FileMappingInfo array), the GuestCounter API, and the associated cfg gating, tests, Justfile recipes, CI matrix entries and docs. As part of the cleanup, the ReadableSharedMemory trait machinery in mem::layout is now gated on a precise 'readable_shared_mem' cfg alias (gdb debug path or shared-snapshot mem_profile path) instead of a blanket Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> #[allow(unused)], so it is compiled out entirely when unused. * Gate crashdump helpers on the crashdump cfg-alias Four crashdump-only items in mem::mgr (the BasicMapping/MappingKind import, mapping_kind_to_flags, try_coalesce_region and get_guest_memory_regions) were gated on the raw `crashdump` feature rather than the `crashdump` cfg-alias from build.rs (all(feature = "crashdump", target_arch = "x86_64")). They reference CrashDumpRegion/MemoryRegionFlags/MemoryRegionType, which are imported under #[cfg(crashdump)], so enabling the feature on a non-x86_64 target would compile the code without the types and fail to build. Switch them to #[cfg(crashdump)] for consistency with the rest of the crashdump codepath. Addresses Copilot review feedback on #1525. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Remove unused multi-root snapshot plumbing Drop unused multi-root page-table snapshot machinery introduced by the old aliasing work: - Remove PtRootFinder/set_pt_root_finder and root_pt_gpas plumbing from MultiUseSandbox and SandboxMemoryManager snapshot flow. - Simplify Snapshot::new to walk and rebuild from a single root (CR3) using virt_to_phys + map only. - Remove unused multi-space API/types from hyperlight_common::vmem: SpaceId, SpaceReferenceMapping, SpaceAwareMapping, walk_va_spaces, and space_aware_map, plus arch stubs. This keeps only the single-root walker path now used by the host and eliminates dead code and extra complexity. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Update CHANGLOG Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Further review changes Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> * Address review feedback Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com> --------- Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent c5d709c commit 0a193b3

41 files changed

Lines changed: 172 additions & 2335 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dep_code_checks.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ jobs:
8282
- name: Verify MSRV
8383
run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common
8484

85-
- name: Check 32-bit builds (Nanvix compatibility)
86-
run: |
87-
rustup target add i686-unknown-linux-gnu
88-
just check-i686 debug
89-
9085
- name: Check cargo features compile
9186
run: just check
9287

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
44

55
## [Prerelease] - Unreleased
66

7+
### Changed
8+
* **Breaking:** `MultiUseSandbox::map_file_cow` and `UninitializedSandbox::map_file_cow` no longer take a label argument. The APIs now accept only `(file_path, guest_base)`.
9+
10+
### Removed
11+
* Removed the experimental `i686-guest`, `nanvix-unstable`, and `guest-counter` feature flags, along with 32-bit (i686) guest support and its page-table/snapshot code paths. Hyperlight guests are now 64-bit only (x86_64 and aarch64).
12+
713
## [v0.15.0] - 2026-05-06
814

915
### Added

Justfile

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ code-checks-like-ci config=default-target hypervisor="kvm":
133133
@# Verify MSRV
134134
./dev/verify-msrv.sh hyperlight-common hyperlight-guest hyperlight-guest-bin hyperlight-host hyperlight-component-util hyperlight-component-macro hyperlight-guest-tracing
135135

136-
@# Check 32-bit guests
137-
{{ if os() == "linux" { "just check-i686 " + config } else { "" } }}
138-
139136
@# Check cargo features compile
140137
just check
141138

@@ -274,14 +271,6 @@ test-rust-tracing target=default-target features="":
274271
{{ cargo-cmd }} test -p hyperlight-common -F trace_guest --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }}
275272
{{ cargo-cmd }} test -p hyperlight-host --profile={{ if target == "debug" { "dev" } else { target } }} {{ if features =="" {'--features trace_guest'} else { "--features trace_guest," + features } }} {{ target-triple-flag }}
276273

277-
# verify hyperlight-common and hyperlight-guest build for 32-bit (for Nanvix compatibility - uses i686 as proxy for Nanvix's custom 32-bit x86 target)
278-
check-i686 target=default-target:
279-
cargo check -p hyperlight-common --target i686-unknown-linux-gnu --profile={{ if target == "debug" { "dev" } else { target } }}
280-
cargo check -p hyperlight-guest --target i686-unknown-linux-gnu --profile={{ if target == "debug" { "dev" } else { target } }}
281-
cargo check -p hyperlight-common --target i686-unknown-linux-gnu --features i686-guest --profile={{ if target == "debug" { "dev" } else { target } }}
282-
# Verify that trace_guest correctly fails on i686 (compile_error should trigger)
283-
! cargo check -p hyperlight-guest --target i686-unknown-linux-gnu --features trace_guest --profile={{ if target == "debug" { "dev" } else { target } }} 2>/dev/null
284-
285274
test-doc target=default-target features="":
286275
{{ cargo-cmd }} test --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} {{ if features =="" {''} else { "--features " + features } }} --doc
287276

@@ -301,9 +290,8 @@ check:
301290
{{ cargo-cmd }} check -p hyperlight-host --features print_debug {{ target-triple-flag }}
302291
{{ cargo-cmd }} check -p hyperlight-host --features gdb {{ target-triple-flag }}
303292
{{ cargo-cmd }} check -p hyperlight-host --features trace_guest,mem_profile {{ target-triple-flag }}
304-
{{ cargo-cmd }} check -p hyperlight-host --features i686-guest {{ target-triple-flag }}
305-
{{ cargo-cmd }} check -p hyperlight-host --features i686-guest,executable_heap {{ target-triple-flag }}
306293
{{ cargo-cmd }} check -p hyperlight-host --features hw-interrupts {{ target-triple-flag }}
294+
{{ cargo-cmd }} check -p hyperlight-host --features executable_heap {{ target-triple-flag }}
307295

308296
fmt-check: (ensure-nightly-fmt)
309297
cargo +{{nightly-toolchain}} fmt --all -- --check

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
"x86_64-unknown-linux-gnu"
8383
"x86_64-pc-windows-msvc" "x86_64-unknown-none"
8484
"wasm32-wasip1" "wasm32-wasip2" "wasm32-unknown-unknown"
85-
"i686-unknown-linux-gnu"
8685
];
8786
extensions = [ "rust-src" ] ++ (if args.channel == "nightly" then [ "miri-preview" ] else []);
8887
});

src/hyperlight_common/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ fuzzing = ["dep:arbitrary"]
3434
trace_guest = []
3535
mem_profile = []
3636
std = ["thiserror/std", "log/std", "tracing/std"]
37-
i686-guest = []
38-
nanvix-unstable = ["i686-guest"]
39-
guest-counter = []
4037

4138
[dev-dependencies]
4239
quickcheck = "1.0.3"

src/hyperlight_common/src/arch/aarch64/vmem.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,6 @@ pub unsafe fn virt_to_phys<'a, Op: TableReadOps + 'a>(
4646
core::iter::empty()
4747
}
4848

49-
/// Stub — see [`crate::vmem::walk_va_spaces`].
50-
#[allow(clippy::missing_safety_doc)]
51-
pub unsafe fn walk_va_spaces<Op: TableReadOps>(
52-
_op: &Op,
53-
_roots: &[Op::TableAddr],
54-
_address: u64,
55-
_len: u64,
56-
) -> ::alloc::vec::Vec<(
57-
crate::vmem::SpaceId,
58-
::alloc::vec::Vec<crate::vmem::SpaceAwareMapping>,
59-
)> {
60-
::alloc::vec::Vec::new()
61-
}
62-
63-
/// Stub — see [`crate::vmem::space_aware_map`].
64-
#[allow(clippy::missing_safety_doc)]
65-
pub unsafe fn space_aware_map<Op: TableOps>(
66-
_op: &Op,
67-
_ref_map: crate::vmem::SpaceReferenceMapping,
68-
_built_roots: &::alloc::collections::BTreeMap<crate::vmem::SpaceId, Op::TableAddr>,
69-
) {
70-
}
71-
7249
pub trait TableMovability<Op: TableReadOps + ?Sized, TableMoveInfo> {}
7350
impl<Op: TableOps<TableMovability = crate::vmem::MayMoveTable>> TableMovability<Op, Op::TableAddr>
7451
for crate::vmem::MayMoveTable

src/hyperlight_common/src/arch/amd64/vmem.rs

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -329,100 +329,6 @@ unsafe fn map_page<
329329
/// 3. PD (29:21) - allocate PT if needed
330330
/// 4. PT (20:12) - write final PTE with physical address and flags
331331
///
332-
/// Multi-space page-table walking on amd64: walks each root
333-
/// independently and emits all leaves as `ThisSpace`. Aliased
334-
/// intermediate-table detection is not implemented here because no
335-
/// current embedder exercises that pattern on amd64.
336-
///
337-
/// TODO: align with the i686 implementation and detect aliased
338-
/// intermediate tables to avoid semantic divergence across arches.
339-
/// Tracking: follow-up issue.
340-
#[allow(clippy::missing_safety_doc)]
341-
pub unsafe fn walk_va_spaces<Op: TableReadOps>(
342-
op: &Op,
343-
roots: &[Op::TableAddr],
344-
address: u64,
345-
len: u64,
346-
) -> ::alloc::vec::Vec<(
347-
crate::vmem::SpaceId,
348-
::alloc::vec::Vec<crate::vmem::SpaceAwareMapping>,
349-
)> {
350-
use ::alloc::vec::Vec;
351-
352-
let mut out: Vec<(crate::vmem::SpaceId, Vec<crate::vmem::SpaceAwareMapping>)> =
353-
Vec::with_capacity(roots.len());
354-
355-
let addr = address & ((1u64 << VA_BITS) - 1);
356-
let vmin = addr & !(PAGE_SIZE as u64 - 1);
357-
let vmax = core::cmp::min(addr + len, 1u64 << VA_BITS);
358-
359-
for &root in roots {
360-
#[allow(clippy::unnecessary_cast)]
361-
let root_id: crate::vmem::SpaceId = Op::to_phys(root) as u64;
362-
let mut mappings: Vec<crate::vmem::SpaceAwareMapping> = Vec::new();
363-
364-
let iter = modify_ptes::<47, 39, Op, _>(MapRequest {
365-
table_base: root,
366-
vmin,
367-
len: vmax.saturating_sub(vmin),
368-
update_parent: UpdateParentNone {},
369-
})
370-
.filter_map(|r| unsafe { require_pte_exist(op, r) })
371-
.flat_map(modify_ptes::<38, 30, Op, _>)
372-
.filter_map(|r| unsafe { require_pte_exist(op, r) })
373-
.flat_map(modify_ptes::<29, 21, Op, _>)
374-
.filter_map(|r| unsafe { require_pte_exist(op, r) })
375-
.flat_map(modify_ptes::<20, 12, Op, _>);
376-
377-
for r in iter {
378-
let Some(pte) = (unsafe { read_pte_if_present(op, r.entry_ptr) }) else {
379-
continue;
380-
};
381-
let phys_addr = pte & PTE_ADDR_MASK;
382-
let sgn_bit = r.vmin >> (VA_BITS - 1);
383-
let sgn_bits = 0u64.wrapping_sub(sgn_bit) << VA_BITS;
384-
let virt_addr = sgn_bits | r.vmin;
385-
386-
let executable = (pte & PAGE_NX) == 0;
387-
let avl = pte & PTE_AVL_MASK;
388-
let kind = if avl == PAGE_AVL_COW {
389-
MappingKind::Cow(CowMapping {
390-
readable: true,
391-
executable,
392-
})
393-
} else {
394-
MappingKind::Basic(BasicMapping {
395-
readable: true,
396-
writable: (pte & PAGE_RW) != 0,
397-
executable,
398-
})
399-
};
400-
mappings.push(crate::vmem::SpaceAwareMapping::ThisSpace(Mapping {
401-
phys_base: phys_addr,
402-
virt_base: virt_addr,
403-
len: PAGE_SIZE as u64,
404-
kind,
405-
user_accessible: false,
406-
}));
407-
}
408-
409-
out.push((root_id, mappings));
410-
}
411-
412-
out
413-
}
414-
415-
/// See [`walk_va_spaces`]: amd64 never emits `AnotherSpace`, so this
416-
/// is unreachable in practice. It silently no-ops (rather than
417-
/// panicking) to keep the architecture-independent re-export usable.
418-
#[allow(clippy::missing_safety_doc)]
419-
pub unsafe fn space_aware_map<Op: TableOps>(
420-
_op: &Op,
421-
_ref_map: crate::vmem::SpaceReferenceMapping,
422-
_built_roots: &::alloc::collections::BTreeMap<crate::vmem::SpaceId, Op::TableAddr>,
423-
) {
424-
}
425-
426332
#[allow(clippy::missing_safety_doc)]
427333
pub unsafe fn map<Op: TableOps>(op: &Op, mapping: Mapping) {
428334
modify_ptes::<47, 39, Op, _>(MapRequest {
@@ -510,7 +416,6 @@ pub unsafe fn virt_to_phys<'a, Op: TableReadOps + 'a>(
510416
virt_base: virt_addr,
511417
len: PAGE_SIZE as u64,
512418
kind,
513-
user_accessible: false,
514419
})
515420
})
516421
}
@@ -692,7 +597,6 @@ mod tests {
692597
writable: true,
693598
executable: false,
694599
}),
695-
user_accessible: false,
696600
};
697601

698602
unsafe { map(&ops, mapping) };
@@ -726,7 +630,6 @@ mod tests {
726630
writable: false,
727631
executable: true,
728632
}),
729-
user_accessible: false,
730633
};
731634

732635
unsafe { map(&ops, mapping) };
@@ -750,7 +653,6 @@ mod tests {
750653
writable: true,
751654
executable: false,
752655
}),
753-
user_accessible: false,
754656
};
755657

756658
unsafe { map(&ops, mapping) };
@@ -784,7 +686,6 @@ mod tests {
784686
writable: true,
785687
executable: false,
786688
}),
787-
user_accessible: false,
788689
};
789690
unsafe { map(&ops, mapping1) };
790691
let tables_after_first = ops.table_count();
@@ -799,7 +700,6 @@ mod tests {
799700
writable: true,
800701
executable: false,
801702
}),
802-
user_accessible: false,
803703
};
804704
unsafe { map(&ops, mapping2) };
805705

@@ -825,7 +725,6 @@ mod tests {
825725
writable: true,
826726
executable: false,
827727
}),
828-
user_accessible: false,
829728
};
830729

831730
unsafe { map(&ops, mapping) };
@@ -848,7 +747,6 @@ mod tests {
848747
writable: true,
849748
executable: false,
850749
}),
851-
user_accessible: false,
852750
};
853751

854752
unsafe { map(&ops, mapping) };
@@ -871,7 +769,6 @@ mod tests {
871769
writable: true,
872770
executable: false,
873771
}),
874-
user_accessible: false,
875772
};
876773

877774
unsafe { map(&ops, mapping) };
@@ -894,7 +791,6 @@ mod tests {
894791
writable: true,
895792
executable: false,
896793
}),
897-
user_accessible: false,
898794
};
899795

900796
unsafe { map(&ops, mapping) };
@@ -916,7 +812,6 @@ mod tests {
916812
virt_base: 0x1000,
917813
len: PAGE_SIZE as u64,
918814
kind,
919-
user_accessible: false,
920815
};
921816
unsafe { map(&ops, mapping) };
922817
let result = unsafe { virt_to_phys(&ops, 0x1000, 1).next() };
@@ -974,7 +869,6 @@ mod tests {
974869
writable: true,
975870
executable: false,
976871
}),
977-
user_accessible: false,
978872
};
979873

980874
unsafe { map(&ops, mapping) };

src/hyperlight_common/src/arch/i686/layout.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)