forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#69685 - cuviper:soft-segv, r=sfackler
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. Fixes rust-lang#69524.
- Loading branch information
Showing
2 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |