@@ -22,8 +22,7 @@ use rand::{rng, RngCore};
2222use tracing:: { instrument, Span } ;
2323
2424use super :: memory_region:: MemoryRegionType :: {
25- Code , GuardPage , GuestErrorData , Heap , InputData , OutputData , PageTables , PanicContext , Peb ,
26- Stack ,
25+ Code , GuardPage , Heap , InputData , OutputData , PageTables , PanicContext , Peb , Stack ,
2726} ;
2827use super :: memory_region:: { MemoryRegion , MemoryRegionFlags , MemoryRegionVecBuilder } ;
2928use super :: mgr:: AMOUNT_OF_MEMORY_PER_PT ;
@@ -45,8 +44,6 @@ use crate::{log_then_return, new_error, Result};
4544// +-------------------------------------------+
4645// | Input Data |
4746// +-------------------------------------------+
48- // | Guest Error Log |
49- // +-------------------------------------------+
5047// | PEB Struct | (HyperlightPEB size)
5148// +-------------------------------------------+
5249// | Guest Code |
@@ -60,9 +57,6 @@ use crate::{log_then_return, new_error, Result};
6057// | PML4 |
6158// +-------------------------------------------+ 0x0_000
6259
63- /// - `GuestError` - contains a buffer for any guest error that occurred.
64- /// the length of this field is `GuestErrorBufferSize` from `SandboxConfiguration`
65- ///
6660/// - `InputData` - this is a buffer that is used for input data to the host program.
6761/// the length of this field is `InputDataSize` from `SandboxConfiguration`
6862///
@@ -95,7 +89,6 @@ pub(crate) struct SandboxMemoryLayout {
9589 peb_offset : usize ,
9690 peb_security_cookie_seed_offset : usize ,
9791 peb_guest_dispatch_function_ptr_offset : usize , // set by guest in guest entrypoint
98- peb_guest_error_offset : usize ,
9992 peb_code_and_outb_pointer_offset : usize ,
10093 peb_runmode_offset : usize ,
10194 peb_input_data_offset : usize ,
@@ -106,7 +99,6 @@ pub(crate) struct SandboxMemoryLayout {
10699
107100 // The following are the actual values
108101 // that are written to the PEB struct
109- pub ( super ) guest_error_buffer_offset : usize ,
110102 pub ( super ) input_data_buffer_offset : usize ,
111103 pub ( super ) output_data_buffer_offset : usize ,
112104 guest_panic_context_buffer_offset : usize ,
@@ -143,10 +135,6 @@ impl Debug for SandboxMemoryLayout {
143135 "Guest Dispatch Function Pointer Offset" ,
144136 & format_args ! ( "{:#x}" , self . peb_guest_dispatch_function_ptr_offset) ,
145137 )
146- . field (
147- "Guest Error Offset" ,
148- & format_args ! ( "{:#x}" , self . peb_guest_error_offset) ,
149- )
150138 . field (
151139 "Code and OutB Pointer Offset" ,
152140 & format_args ! ( "{:#x}" , self . peb_code_and_outb_pointer_offset) ,
@@ -171,10 +159,6 @@ impl Debug for SandboxMemoryLayout {
171159 "Guest Stack Offset" ,
172160 & format_args ! ( "{:#x}" , self . peb_guest_stack_data_offset) ,
173161 )
174- . field (
175- "Guest Error Buffer Offset" ,
176- & format_args ! ( "{:#x}" , self . guest_error_buffer_offset) ,
177- )
178162 . field (
179163 "Input Data Buffer Offset" ,
180164 & format_args ! ( "{:#x}" , self . input_data_buffer_offset) ,
@@ -259,7 +243,6 @@ impl SandboxMemoryLayout {
259243 peb_offset + offset_of ! ( HyperlightPEB , security_cookie_seed) ;
260244 let peb_guest_dispatch_function_ptr_offset =
261245 peb_offset + offset_of ! ( HyperlightPEB , guest_function_dispatch_ptr) ;
262- let peb_guest_error_offset = peb_offset + offset_of ! ( HyperlightPEB , guestErrorData) ;
263246 let peb_code_and_outb_pointer_offset = peb_offset + offset_of ! ( HyperlightPEB , pCode) ;
264247 let peb_runmode_offset = peb_offset + offset_of ! ( HyperlightPEB , runMode) ;
265248 let peb_input_data_offset = peb_offset + offset_of ! ( HyperlightPEB , inputdata) ;
@@ -272,12 +255,8 @@ impl SandboxMemoryLayout {
272255 // The following offsets are the actual values that relate to memory layout,
273256 // which are written to PEB struct
274257 let peb_address = Self :: BASE_ADDRESS + peb_offset;
275- let guest_error_buffer_offset = round_up_to (
276- peb_guest_stack_data_offset + size_of :: < GuestStackData > ( ) ,
277- PAGE_SIZE_USIZE ,
278- ) ;
279258 let input_data_buffer_offset = round_up_to (
280- guest_error_buffer_offset + cfg . get_guest_error_buffer_size ( ) ,
259+ peb_guest_stack_data_offset + size_of :: < GuestStackData > ( ) ,
281260 PAGE_SIZE_USIZE ,
282261 ) ;
283262 let output_data_buffer_offset = round_up_to (
@@ -305,15 +284,13 @@ impl SandboxMemoryLayout {
305284 heap_size,
306285 peb_security_cookie_seed_offset,
307286 peb_guest_dispatch_function_ptr_offset,
308- peb_guest_error_offset,
309287 peb_code_and_outb_pointer_offset,
310288 peb_runmode_offset,
311289 peb_input_data_offset,
312290 peb_output_data_offset,
313291 peb_guest_panic_context_offset,
314292 peb_heap_data_offset,
315293 peb_guest_stack_data_offset,
316- guest_error_buffer_offset,
317294 sandbox_memory_config : cfg,
318295 code_size,
319296 input_data_buffer_offset,
@@ -333,18 +310,6 @@ impl SandboxMemoryLayout {
333310 self . peb_runmode_offset
334311 }
335312
336- /// Get the offset in guest memory to the max size of the guest error buffer
337- #[ instrument( skip_all, parent = Span :: current( ) , level= "Trace" ) ]
338- pub ( super ) fn get_guest_error_buffer_size_offset ( & self ) -> usize {
339- self . peb_guest_error_offset
340- }
341-
342- /// Get the offset in guest memory to the error message buffer pointer
343- #[ instrument( skip_all, parent = Span :: current( ) , level= "Trace" ) ]
344- fn get_guest_error_buffer_pointer_offset ( & self ) -> usize {
345- self . peb_guest_error_offset + size_of :: < u64 > ( )
346- }
347-
348313 /// Get the offset in guest memory to the output data size
349314 #[ instrument( skip_all, parent = Span :: current( ) , level= "Trace" ) ]
350315 pub ( super ) fn get_output_data_size_offset ( & self ) -> usize {
@@ -542,7 +507,6 @@ impl SandboxMemoryLayout {
542507 let mut total_mapped_memory_size: usize = round_up_to ( code_size, PAGE_SIZE_USIZE ) ;
543508 total_mapped_memory_size += round_up_to ( stack_size, PAGE_SIZE_USIZE ) ;
544509 total_mapped_memory_size += round_up_to ( heap_size, PAGE_SIZE_USIZE ) ;
545- total_mapped_memory_size += round_up_to ( cfg. get_guest_error_buffer_size ( ) , PAGE_SIZE_USIZE ) ;
546510 total_mapped_memory_size += round_up_to ( cfg. get_input_data_size ( ) , PAGE_SIZE_USIZE ) ;
547511 total_mapped_memory_size += round_up_to ( cfg. get_output_data_size ( ) , PAGE_SIZE_USIZE ) ;
548512 total_mapped_memory_size +=
@@ -626,30 +590,12 @@ impl SandboxMemoryLayout {
626590 }
627591
628592 // PEB
629- let guest_error_offset = builder. push_page_aligned (
593+ let input_data_offset = builder. push_page_aligned (
630594 size_of :: < HyperlightPEB > ( ) ,
631595 MemoryRegionFlags :: READ | MemoryRegionFlags :: WRITE ,
632596 Peb ,
633597 ) ;
634598
635- let expected_guest_error_offset =
636- TryInto :: < usize > :: try_into ( self . guest_error_buffer_offset ) ?;
637-
638- if guest_error_offset != expected_guest_error_offset {
639- return Err ( new_error ! (
640- "Guest error offset does not match expected Guest error offset expected: {}, actual: {}" ,
641- expected_guest_error_offset,
642- guest_error_offset
643- ) ) ;
644- }
645-
646- // guest error
647- let input_data_offset = builder. push_page_aligned (
648- self . sandbox_memory_config . get_guest_error_buffer_size ( ) ,
649- MemoryRegionFlags :: READ | MemoryRegionFlags :: WRITE ,
650- GuestErrorData ,
651- ) ;
652-
653599 let expected_input_data_offset = TryInto :: < usize > :: try_into ( self . input_data_buffer_offset ) ?;
654600
655601 if input_data_offset != expected_input_data_offset {
@@ -818,14 +764,6 @@ impl SandboxMemoryLayout {
818764
819765 // Skip guest_dispatch_function_ptr_offset because it is set by the guest
820766
821- // Set up Guest Error Fields
822- let addr = get_address ! ( guest_error_buffer) ;
823- shared_mem. write_u64 ( self . get_guest_error_buffer_pointer_offset ( ) , addr) ?;
824- shared_mem. write_u64 (
825- self . get_guest_error_buffer_size_offset ( ) ,
826- u64:: try_from ( self . sandbox_memory_config . get_guest_error_buffer_size ( ) ) ?,
827- ) ?;
828-
829767 // Skip code, is set when loading binary
830768 // skip outb and outb context, is set when running in_proc
831769
@@ -958,8 +896,6 @@ mod tests {
958896
959897 expected_size += round_up_to ( size_of :: < HyperlightPEB > ( ) , PAGE_SIZE_USIZE ) ;
960898
961- expected_size += round_up_to ( cfg. get_guest_error_buffer_size ( ) , PAGE_SIZE_USIZE ) ;
962-
963899 expected_size += round_up_to ( cfg. get_input_data_size ( ) , PAGE_SIZE_USIZE ) ;
964900
965901 expected_size += round_up_to ( cfg. get_output_data_size ( ) , PAGE_SIZE_USIZE ) ;
0 commit comments