Skip to content

Commit eb4097e

Browse files
committed
Avoid a deadlock when registering FDEs at runtime
1 parent c103773 commit eb4097e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

preload/src/api.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@ pub unsafe extern "C" fn __register_frame( fde: *const u8 ) {
559559
error!( "__register_frame call ignored since we couldn't find the original symbol" );
560560
}
561561

562+
let thread = StrongThreadHandle::acquire();
562563
unwind::register_frame_by_pointer( fde );
564+
std::mem::drop( thread );
563565
}
564566

565567
#[cfg_attr(not(test), no_mangle)]
@@ -572,5 +574,7 @@ pub unsafe extern "C" fn __deregister_frame( fde: *const u8 ) {
572574
error!( "__deregister_frame call ignored since we couldn't find the original symbol" );
573575
}
574576

577+
let thread = StrongThreadHandle::acquire();
575578
unwind::deregister_frame_by_pointer( fde );
579+
std::mem::drop( thread );
576580
}

0 commit comments

Comments
 (0)