From: Julian Lettner Date: Mon, 4 Feb 2019 23:37:50 +0000 (+0000) Subject: [Sanitizers] UBSan unreachable incompatible with Kernel ASan X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24c8a9a6ae8d231295b8deca1c1a47920e326fe5;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353120 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 2cb181d684..2af2379476 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -4403,7 +4403,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, // 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); diff --git a/test/CodeGen/ubsan-asan-noreturn.c b/test/CodeGen/ubsan-asan-noreturn.c index 6dc0546d48..516c58469d 100644 --- a/test/CodeGen/ubsan-asan-noreturn.c +++ b/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));