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:
parent
2cb0b8582e
commit
676b9bc477
2 changed files with 39 additions and 8 deletions
19
src/test/ui/sanitize/badfree.rs
Normal file
19
src/test/ui/sanitize/badfree.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue