[PATCH] D15367: Cross-DSO control flow integrity (Clang part)

Peter Collingbourne via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 15:00:56 PST 2015


pcc added a comment.

Please add documentation. At the very least please document flags in `docs/ControlFlowIntegrity.rst` and `docs/UsersManual.rst`. We should also document the design in `docs/ControlFlowIntegrityDesign.rst`.


================
Comment at: lib/CodeGen/CGExpr.cpp:3868
@@ +3867,3 @@
+        isa<llvm::MDNode>(MD) && dyn_cast<llvm::MDNode>(MD)->isDistinct();
+    if (CGM.getCodeGenOpts().SanitizeCfiCrossDso && !hasLocalScope) {
+      EmitCfiSlowPathCheck(BitSetTest, MD, CastedCallee);
----------------
Yes, sorry.

================
Comment at: lib/CodeGen/CodeGenModule.cpp:1037
@@ -972,15 +1036,3 @@
 
-  // If we are checking indirect calls and this is not a non-static member
-  // function, emit a bit set entry for the function type.
-  if (LangOpts.Sanitize.has(SanitizerKind::CFIICall) &&
-      !(isa<CXXMethodDecl>(FD) && !cast<CXXMethodDecl>(FD)->isStatic())) {
-    llvm::NamedMDNode *BitsetsMD =
-        getModule().getOrInsertNamedMetadata("llvm.bitsets");
-
-    llvm::Metadata *BitsetOps[] = {
-        CreateMetadataIdentifierForType(FD->getType()),
-        llvm::ConstantAsMetadata::get(F),
-        llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int64Ty, 0))};
-    BitsetsMD->addOperand(llvm::MDTuple::get(getLLVMContext(), BitsetOps));
-  }
+  CreateFunctionBitSetEntry(FD, F);
 }
----------------
Yes, that's because you fixed it :)

================
Comment at: lib/CodeGen/CodeGenModule.cpp:1041
@@ -988,3 +1040,3 @@
 void CodeGenModule::addUsedGlobal(llvm::GlobalValue *GV) {
   assert(!GV->isDeclaration() &&
          "Only globals with definition can force usage.");
----------------
What about callers of `EmitCfiSlowPathCheck`?


Repository:
  rL LLVM

http://reviews.llvm.org/D15367





More information about the cfe-commits mailing list