libafl_bolts fix potentially unaligned ucontexts in signal handler (#1520)

When entering a signal handler, the ucontext_t is not necessarily 0x10-aligned, so we need to use read_unaligned instead of dereferencing.
This commit is contained in:
Fabian Freyer 2023-09-18 23:17:54 +02:00 committed by GitHub
parent 6d0d4e287a
commit 27333f9ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -390,7 +390,11 @@ unsafe fn handle_signal(sig: c_int, info: siginfo_t, void: *mut c_void) {
None => return,
}
};
handler.handle(*signal, info, &mut *(void as *mut ucontext_t));
handler.handle(
*signal,
info,
&mut ptr::read_unaligned(void as *mut ucontext_t),
);
}
/// Setup signal handlers in a somewhat rusty way.