[PATCH] D57711: [Sanitizers] UBSan unreachable incompatible with Kernel ASan
Julian Lettner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 4 13:49:53 PST 2019
yln created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This is a follow up for https://reviews.llvm.org/D57278. The previous
revision should have also included Kernel ASan.
rdar://problem/40723397
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D57711
Files:
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGen/ubsan-asan-noreturn.c
llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
Index: llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
===================================================================
--- llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
+++ llvm/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
@@ -35,6 +35,15 @@
; CHECK-NOT: call void @__asan_handle_no_return
; CHECK: call void @NoReturnFunc
+; Do *not* instrument functions without ASan
+define i32 @Call4() {
+ call void @NoReturnFunc() noreturn
+ unreachable
+}
+; CHECK-LABEL: @Call4
+; CHECK-NOT: call void @__asan_handle_no_return
+; CHECK: call void @NoReturnFunc
+
declare i32 @__gxx_personality_v0(...)
define i64 @Invoke1() nounwind uwtable ssp sanitize_address personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
Index: clang/test/CodeGen/ubsan-asan-noreturn.c
===================================================================
--- clang/test/CodeGen/ubsan-asan-noreturn.c
+++ clang/test/CodeGen/ubsan-asan-noreturn.c
@@ -1,6 +1,7 @@
// Ensure compatiblity of UBSan unreachable with ASan in the presence of
// noreturn functions.
-// RUN: %clang_cc1 -fsanitize=unreachable,address -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=unreachable,address -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fsanitize=unreachable,kernel-address -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s
void my_longjmp(void) __attribute__((noreturn));
Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -4403,7 +4403,8 @@
// Avoid incompatibility with ASan which relies on the `noreturn`
// attribute to insert handler calls.
- if (SanOpts.has(SanitizerKind::Address)) {
+ if (SanOpts.hasOneOf(SanitizerKind::Address |
+ SanitizerKind::KernelAddress)) {
SanitizerScope SanScope(this);
llvm::IRBuilder<>::InsertPointGuard IPGuard(Builder);
Builder.SetInsertPoint(CI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57711.185153.patch
Type: text/x-patch
Size: 2135 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190204/f3b985e6/attachment.bin>
More information about the cfe-commits
mailing list