[PATCH] D59780: Support Intel Control-flow Enforcement Technology

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 21:40:32 PDT 2019


xiangzhangllvm added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:627
+    while (!Desc.empty()) {
+      if (Desc.size() < 8)
+        fatal(toString(Obj) + ": .note.gnu.property: section too short");
----------------
Should be < 12 ? Desc must have at least 3 elements: type(4B), datasz(4B), data(4B)


================
Comment at: lld/ELF/InputFiles.cpp:631
+      uint32_t Type = *reinterpret_cast<const uint32_t *>(Desc.data());
+      uint32_t Size = *reinterpret_cast<const uint32_t *>(Desc.data() + 4) * 4;
+      if (Size == 0)
----------------
The Size calculation here seems strange.  Why *4 ?
*(Desc.data()+4) is datasz, it is the feature size. 
I think it should be
uint32_t Size = *reinterpret_cast<const uint32_t *>(Desc.data() + 4) + 8 +Pading;
(for 32-bit the Pading is always 0, and 64-bit is 4, due to their alignments)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59780





More information about the llvm-commits mailing list