Skip to content

Commit 81af612

Browse files
committed
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 hyperlight-dev#1525. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent aba172e commit 81af612

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • src/hyperlight_host/src/mem

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use hyperlight_common::flatbuffer_wrappers::function_types::FunctionCallResult;
2222
use hyperlight_common::flatbuffer_wrappers::guest_log_data::GuestLogData;
2323
use hyperlight_common::flatbuffer_wrappers::host_function_details::HostFunctionDetails;
2424
use hyperlight_common::vmem::{self, PAGE_TABLE_SIZE};
25-
#[cfg(feature = "crashdump")]
25+
#[cfg(crashdump)]
2626
use hyperlight_common::vmem::{BasicMapping, MappingKind};
2727
use tracing::{Span, instrument};
2828

@@ -37,7 +37,7 @@ use crate::mem::memory_region::{CrashDumpRegion, MemoryRegionFlags, MemoryRegion
3737
use crate::sandbox::snapshot::{NextAction, Snapshot};
3838
use crate::{Result, new_error};
3939

40-
#[cfg(feature = "crashdump")]
40+
#[cfg(crashdump)]
4141
fn mapping_kind_to_flags(kind: &MappingKind) -> (MemoryRegionFlags, MemoryRegionType) {
4242
match kind {
4343
MappingKind::Basic(BasicMapping {
@@ -75,7 +75,7 @@ fn mapping_kind_to_flags(kind: &MappingKind) -> (MemoryRegionFlags, MemoryRegion
7575
/// in both guest and host address space and has the same flags.
7676
///
7777
/// Returns `true` if the region was coalesced, `false` if a new region is needed.
78-
#[cfg(feature = "crashdump")]
78+
#[cfg(crashdump)]
7979
fn try_coalesce_region(
8080
regions: &mut [CrashDumpRegion],
8181
virt_base: usize,
@@ -581,7 +581,7 @@ impl SandboxMemoryManager<HostSharedMemory> {
581581
///
582582
/// By default, walks the guest page tables to discover
583583
/// GVA→GPA mappings and translates them to host-backed regions.
584-
#[cfg(feature = "crashdump")]
584+
#[cfg(crashdump)]
585585
pub(crate) fn get_guest_memory_regions(
586586
&mut self,
587587
root_pt: u64,

0 commit comments

Comments
 (0)