[PATCH] D119296: KCFI sanitizer

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 14:38:58 PDT 2022


nickdesaulniers accepted this revision.
nickdesaulniers added a comment.
This revision is now accepted and ready to land.

LGTM; it would be good if you could provide steps to test this on the Linux kernel. (i.e. what kernel patches are needed). Consider waiting for at least one additional review sign off.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2268-2272
+    if (!AddressTaken && F.hasLocalLinkage()) {
+      F.setPrefixData(nullptr);
+      F.removeFnAttr("kcfi");
+      continue;
+    }
----------------
Can we not compute whether the address was taken BEFORE adding the prefix + Fn Attr and avoid adding these only to remove them later?


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2271
+      F.removeFnAttr("kcfi");
+      continue;
+    }
----------------
You could probably drop this `continue`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119296



More information about the llvm-commits mailing list