r353120 - [Sanitizers] UBSan unreachable incompatible with Kernel ASan

Julian Lettner via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 4 15:37:50 PST 2019


Author: yln
Date: Mon Feb  4 15:37:50 2019
New Revision: 353120

URL: http://llvm.org/viewvc/llvm-project?rev=353120&view=rev
Log:
[Sanitizers] UBSan unreachable incompatible with Kernel ASan

Summary:
This is a follow up for https://reviews.llvm.org/D57278. The previous
revision should have also included Kernel ASan.

rdar://problem/40723397

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57711

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/test/CodeGen/ubsan-asan-noreturn.c

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=353120&r1=353119&r2=353120&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Feb  4 15:37:50 2019
@@ -4403,7 +4403,8 @@ RValue CodeGenFunction::EmitCall(const C
 
       // 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);

Modified: cfe/trunk/test/CodeGen/ubsan-asan-noreturn.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ubsan-asan-noreturn.c?rev=353120&r1=353119&r2=353120&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ubsan-asan-noreturn.c (original)
+++ cfe/trunk/test/CodeGen/ubsan-asan-noreturn.c Mon Feb  4 15:37:50 2019
@@ -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));
 




More information about the cfe-commits mailing list