Detect use-after-scope bugs with AddressSanitizer
Enable use-after-scope checks by default when using AddressSanitizer. They allow to detect incorrect use of stack objects after their scope have already ended. The detection is based on LLVM lifetime intrinsics. To facilitate the use of this functionality, the lifetime intrinsics are now emitted regardless of optimization level if enabled sanitizer makes use of them.
This commit is contained in:
@@ -87,8 +87,9 @@ extern "C" LLVMPassRef LLVMRustFindAndCreatePass(const char *PassName) {
|
||||
|
||||
extern "C" LLVMPassRef LLVMRustCreateAddressSanitizerFunctionPass(bool Recover) {
|
||||
const bool CompileKernel = false;
|
||||
const bool UseAfterScope = true;
|
||||
|
||||
return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover));
|
||||
return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover, UseAfterScope));
|
||||
}
|
||||
|
||||
extern "C" LLVMPassRef LLVMRustCreateModuleAddressSanitizerPass(bool Recover) {
|
||||
|
||||
Reference in New Issue
Block a user