File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
src/hyperlight_guest_bin/src Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ use hyperlight_guest::exit::{abort_with_code_and_message, halt};
3636use hyperlight_guest:: guest_handle:: handle:: GuestHandle ;
3737use hyperlight_guest_tracing:: { trace, trace_function} ;
3838use log:: LevelFilter ;
39- use spin:: { Mutex , Once } ;
39+ use spin:: Once ;
4040
4141// === Modules ===
4242#[ cfg( target_arch = "x86_64" ) ]
@@ -144,12 +144,11 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
144144 _panic_handler ( info)
145145}
146146
147- static PANIC_BUF : Mutex < String < 512 > > = Mutex :: new ( String :: new ( ) ) ;
148-
149147#[ inline( always) ]
150148fn _panic_handler ( info : & core:: panic:: PanicInfo ) -> ! {
151- let mut panic_buf_guard = PANIC_BUF . lock ( ) ;
152- let write_res = write ! ( panic_buf_guard, "{}\0 " , info) ;
149+ // stack allocate a 256-byte message buffer.
150+ let mut panic_buf = String :: < 256 > :: new ( ) ;
151+ let write_res = write ! ( panic_buf, "{}\0 " , info) ;
153152 if write_res. is_err ( ) {
154153 unsafe {
155154 abort_with_code_and_message (
@@ -159,7 +158,7 @@ fn _panic_handler(info: &core::panic::PanicInfo) -> ! {
159158 }
160159 }
161160
162- let c_str_res = CStr :: from_bytes_with_nul ( panic_buf_guard . as_bytes ( ) ) ;
161+ let c_str_res = CStr :: from_bytes_with_nul ( panic_buf . as_bytes ( ) ) ;
163162 if c_str_res. is_err ( ) {
164163 unsafe {
165164 abort_with_code_and_message (
You can’t perform that action at this time.
0 commit comments