diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2015-07-15 12:15:56 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-07-15 12:15:56 +0000 |
| commit | 6fccf95aadba3c5aec1f41723ceae6168d64ac80 (patch) | |
| tree | e95a8dc2c6a71a3d05197d3b6720f78b57073b70 /clang/lib/CodeGen | |
| parent | 3bed68cfc7c7f336e4ae1f48798ceb3e60e6c888 (diff) | |
| download | bcm5719-llvm-6fccf95aadba3c5aec1f41723ceae6168d64ac80.tar.gz bcm5719-llvm-6fccf95aadba3c5aec1f41723ceae6168d64ac80.zip | |
CodeGen: Improve CFI type blacklisting mechanism.
We now use the sanitizer special case list to decide which types to blacklist.
We also support a special blacklist entry for types with a uuid attribute,
which are generally COM types whose virtual tables are defined externally.
Differential Revision: http://reviews.llvm.org/D11096
llvm-svn: 242286
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 8 |
2 files changed, 6 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index c49f182c21d..9c18b860920 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -2190,15 +2190,6 @@ void CodeGenFunction::EmitVTablePtrCheckForCast(QualType T, if (!ClassDecl->isCompleteDefinition() || !ClassDecl->isDynamicClass()) return; - SmallString<64> MangledName; - llvm::raw_svector_ostream Out(MangledName); - CGM.getCXXABI().getMangleContext().mangleCXXRTTI(T.getUnqualifiedType(), - Out); - - // Blacklist based on the mangled type. - if (CGM.getContext().getSanitizerBlacklist().isBlacklistedType(Out.str())) - return; - if (!SanOpts.has(SanitizerKind::CFICastStrict)) ClassDecl = LeastDerivedClassWithSameLayout(ClassDecl); diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index e36051c2053..373009e8bf9 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -841,8 +841,12 @@ void CodeGenModule::EmitDeferredVTables() { } bool CodeGenModule::IsCFIBlacklistedRecord(const CXXRecordDecl *RD) { - // FIXME: Make this user configurable. - return RD->isInStdNamespace(); + if (RD->hasAttr<UuidAttr>() && + getContext().getSanitizerBlacklist().isBlacklistedType("attr:uuid")) + return true; + + return getContext().getSanitizerBlacklist().isBlacklistedType( + RD->getQualifiedNameAsString()); } void CodeGenModule::EmitVTableBitSetEntries(llvm::GlobalVariable *VTable, |

