r335305 - Ignore blacklist when generating __cfi_check_fail.

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 21 16:22:37 PDT 2018


Author: eugenis
Date: Thu Jun 21 16:22:37 2018
New Revision: 335305

URL: http://llvm.org/viewvc/llvm-project?rev=335305&view=rev
Log:
Ignore blacklist when generating __cfi_check_fail.

Summary: Fixes PR37898.

Reviewers: pcc, vlad.tsyrklevich

Subscribers: cfe-commits

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

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/test/CodeGen/cfi-check-fail2.c

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=335305&r1=335304&r2=335305&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Jun 21 16:22:37 2018
@@ -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());

Modified: cfe/trunk/test/CodeGen/cfi-check-fail2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/cfi-check-fail2.c?rev=335305&r1=335304&r2=335305&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/cfi-check-fail2.c (original)
+++ cfe/trunk/test/CodeGen/cfi-check-fail2.c Thu Jun 21 16:22:37 2018
@@ -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();
 }




More information about the cfe-commits mailing list