@@ -42,9 +42,6 @@ pub enum HyperlightError {
4242 /// Anyhow error
4343 #[ error( "Anyhow Error was returned: {0}" ) ]
4444 AnyhowError ( #[ from] anyhow:: Error ) ,
45- /// Memory access out of bounds
46- #[ error( "Offset: {0} out of bounds, Max is: {1}" ) ]
47- BoundsCheckFailed ( u64 , usize ) ,
4845
4946 /// Checked Add Overflow
5047 #[ error( "Couldn't add offset to base address. Offset: {0}, Base Address: {1}" ) ]
@@ -154,18 +151,6 @@ pub enum HyperlightError {
154151 #[ error( "Memory Access Violation at address {0:#x} of type {1}, but memory is marked as {2}" ) ]
155152 MemoryAccessViolation ( u64 , MemoryRegionFlags , MemoryRegionFlags ) ,
156153
157- /// Memory Allocation Failed.
158- #[ error( "Memory Allocation Failed with OS Error {0:?}." ) ]
159- MemoryAllocationFailed ( Option < i32 > ) ,
160-
161- /// Memory Protection Failed
162- #[ error( "Memory Protection Failed with OS Error {0:?}." ) ]
163- MemoryProtectionFailed ( Option < i32 > ) ,
164-
165- /// Memory region size mismatch
166- #[ error( "Memory region size mismatch: host size {0:?}, guest size {1:?} region {2:?}" ) ]
167- MemoryRegionSizeMismatch ( usize , usize , String ) ,
168-
169154 /// The memory request exceeds the maximum size allowed
170155 #[ error( "Memory requested {0} exceeds maximum size allowed {1}" ) ]
171156 MemoryRequestTooBig ( usize , usize ) ,
@@ -179,14 +164,6 @@ pub enum HyperlightError {
179164 #[ error( "Metric Not Found {0:?}." ) ]
180165 MetricNotFound ( & ' static str ) ,
181166
182- /// mmap Failed.
183- #[ error( "mmap failed with os error {0:?}" ) ]
184- MmapFailed ( Option < i32 > ) ,
185-
186- /// mprotect Failed.
187- #[ error( "mprotect failed with os error {0:?}" ) ]
188- MprotectFailed ( Option < i32 > ) ,
189-
190167 /// No Hypervisor was found for Sandbox.
191168 #[ error( "No Hypervisor was found for Sandbox" ) ]
192169 NoHypervisorFound ( ) ,
@@ -240,6 +217,10 @@ pub enum HyperlightError {
240217 #[ error( "Failed To Convert Return Value {0:?} to {1:?}" ) ]
241218 ReturnValueConversionFailure ( ReturnValue , & ' static str ) ,
242219
220+ /// Error creating or operating on memory shared with the guest
221+ #[ error( "Failed to execute shared memory operation: {0}" ) ]
222+ SharedMemory ( #[ from] crate :: mem:: shared_mem:: SharedMemoryError ) ,
223+
243224 /// Tried to restore a snapshot into a sandbox whose memory
244225 /// layout is not compatible with the snapshot's.
245226 #[ error( "Snapshot memory layout is not compatible with this sandbox" ) ]
@@ -347,7 +328,6 @@ impl HyperlightError {
347328 | HyperlightError :: PoisonedSandbox
348329 | HyperlightError :: ExecutionAccessViolation ( _)
349330 | HyperlightError :: MemoryAccessViolation ( _, _, _)
350- | HyperlightError :: MemoryRegionSizeMismatch ( _, _, _)
351331 // HyperlightVmError::Restore is already handled manually in restore(), but we mark it
352332 // as poisoning here too for defense in depth.
353333 | HyperlightError :: HyperlightVmError ( HyperlightVmError :: Restore ( _) ) => true ,
@@ -365,7 +345,6 @@ impl HyperlightError {
365345
366346 // All other errors do not poison the sandbox.
367347 HyperlightError :: AnyhowError ( _)
368- | HyperlightError :: BoundsCheckFailed ( _, _)
369348 | HyperlightError :: CheckedAddOverflow ( _, _)
370349 | HyperlightError :: CStringConversionError ( _)
371350 | HyperlightError :: Error ( _)
@@ -386,13 +365,9 @@ impl HyperlightError {
386365 | HyperlightError :: InvalidFlatBuffer ( _)
387366 | HyperlightError :: JsonConversionFailure ( _)
388367 | HyperlightError :: LockAttemptFailed ( _)
389- | HyperlightError :: MemoryAllocationFailed ( _)
390- | HyperlightError :: MemoryProtectionFailed ( _)
391368 | HyperlightError :: MemoryRequestTooBig ( _, _)
392369 | HyperlightError :: MemoryRequestTooSmall ( _, _)
393370 | HyperlightError :: MetricNotFound ( _)
394- | HyperlightError :: MmapFailed ( _)
395- | HyperlightError :: MprotectFailed ( _)
396371 | HyperlightError :: NoHypervisorFound ( )
397372 | HyperlightError :: NoMemorySnapshot
398373 | HyperlightError :: ParameterValueConversionFailure ( _, _)
@@ -409,7 +384,8 @@ impl HyperlightError {
409384 | HyperlightError :: UnexpectedParameterValueType ( _, _)
410385 | HyperlightError :: UnexpectedReturnValueType ( _, _)
411386 | HyperlightError :: UTF8StringConversionFailure ( _)
412- | HyperlightError :: VectorCapacityIncorrect ( _, _, _) => false ,
387+ | HyperlightError :: VectorCapacityIncorrect ( _, _, _)
388+ | HyperlightError :: SharedMemory ( _) => false ,
413389
414390 #[ cfg( target_os = "windows" ) ]
415391 HyperlightError :: CrossBeamReceiveError ( _) => false ,
0 commit comments