[PATCH] D119296: KCFI sanitizer

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 8 15:58:55 PST 2022


nickdesaulniers added inline comments.


================
Comment at: clang/include/clang/Basic/AttrDocs.td:5419
+  typedef typeof(f1) * __attribute__((kcfi_unchecked) unchecked_t;
+  ((unchecked_t)p2)();  // unchecked
+
----------------
`p2` is already unchecked. Would it be more demonstrative to cast `p1` (which is checked) to `unchecked_t` and show that that indirect call remains unchecked?


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1590-1597
+  llvm::MDString *MDS = dyn_cast<llvm::MDString>(CreateMetadataIdentifierImpl(
+      T, MetadataIdMap, "", /*OnlyExternal=*/false));
+  if (!MDS)
+    return nullptr;
+
+  return llvm::ConstantInt::get(
+      Int64Ty,
----------------
```
if (auto *MDS =
  return llvm::ConstantInt ...
return nullptr;
```


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4706
+  else if (auto *VD = dyn_cast<VarDecl>(D))
+    if (auto *TSI = VD->getTypeSourceInfo())
+      Type = TSI->getType();
----------------
remove auto


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119296/new/

https://reviews.llvm.org/D119296



More information about the cfe-commits mailing list