unix: Don't override existing SIGSEGV/BUS handlers

Although `stack_overflow::init` runs very early in the process, even
before `main`, there may already be signal handlers installed for things
like the address sanitizer. In that case, just leave it alone, and don't
bother trying to allocate our own signal stacks either.
This commit is contained in:
Josh Stone 2020-03-03 15:04:57 -08:00 committed by Josh Stone
parent 2cb0b8582e
commit 676b9bc477
2 changed files with 39 additions and 8 deletions

View file

@ -0,0 +1,19 @@
// needs-sanitizer-support
// only-x86_64
//
// compile-flags: -Z sanitizer=address -O
//
// run-fail
// error-pattern: AddressSanitizer: SEGV
use std::ffi::c_void;
extern "C" {
fn free(ptr: *mut c_void);
}
fn main() {
unsafe {
free(1 as *mut c_void);
}
}