Ignore blacklist when generating __cfi_check_fail.

Summary: Fixes PR37898.

Reviewers: pcc, vlad.tsyrklevich

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335305 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evgeniy Stepanov 2018-06-21 23:22:37 +00:00
parent 8fa8ac3e9e
commit ae3ac6af8d
2 changed files with 11 additions and 0 deletions

View File

@ -3075,6 +3075,11 @@ void CodeGenFunction::EmitCfiCheckFail() {
StartFunction(GlobalDecl(), CGM.getContext().VoidTy, F, FI, Args,
SourceLocation());
// This function should not be affected by blacklist. This function does
// not have a source location, but "src:*" would still apply. Revert any
// changes to SanOpts made in StartFunction.
SanOpts = CGM.getLangOpts().Sanitize;
llvm::Value *Data =
EmitLoadOfScalar(GetAddrOfLocalVar(&ArgData), /*Volatile=*/false,
CGM.getContext().VoidPtrTy, ArgData.getLocation());

View File

@ -3,6 +3,12 @@
// RUN: -fsanitize=cfi-vcall \
// RUN: -emit-llvm -o - %s | FileCheck %s
// Check that blacklist does not affect generated code.
// RUN: echo "src:*" > %t-all.blacklist
// RUN: %clang_cc1 -triple x86_64-unknown-linux -O0 -fsanitize-cfi-cross-dso \
// RUN: -fsanitize=cfi-vcall -fsanitize-blacklist=%t-all.blacklist \
// RUN: -emit-llvm -o - %s | FileCheck %s
void caller(void (*f)()) {
f();
}