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

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 19:16:26 PDT 2019


xiangzhangllvm added inline comments.


================
Comment at: lld/ELF/Arch/X86_64.cpp:209-210
+    write32le(Buf + 5, I * sizeof(object::ELF64LE::Rela));
+    write32le(Buf + 10, -getPltEntryOffset(I) - 14);
+    Buf += sizeof(Inst);
+  }
----------------
Hi ruiu, I want to mean:
Next loop Buf += 16,  (-getPltEntryOffset(I)) -= 16
So they will write the some address for jmpq Instruction.


================
Comment at: lld/test/ELF/x86-64-cet.s:35-37
+# PLT-NEXT: 201010:	       ff 25 02 20 00 00    jmpq  *8194(%rip)
+# PLT-NEXT: 201016:	       68 00 00 00 00       pushq $0
+# PLT-NEXT: 20101b:	       e9 e0 ff ff ff       jmp   -32 <func1>
----------------
This context is not corresponding to your writePlt() function. 

```
  if (In.IBTPlt) {
    const uint8_t Inst[] = {
        0xf3, 0x0f, 0x1e, 0xfb,       // endbr32
        0xff, 0x25, 0,    0,    0, 0, // jmpq *got(%rip)
        0x66, 0x0f, 0x1f, 0x44, 0, 0, // nop
    };
```


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