[PATCH] D76900: Enable IBT(Indirect Branch Tracking) in JIT with CET(Control-flow Enforcement Technology)

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 20:40:17 PDT 2020


xiangzhangllvm marked an inline comment as done.
xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/Target/X86/X86TargetMachine.cpp:217
           OL),
-      TLOF(createTLOF(getTargetTriple())) {
+      TLOF(createTLOF(getTargetTriple())), IsJIT(JIT) {
   // On PS4, the "return address" of a 'noreturn' call must still be within
----------------
xiangzhangllvm wrote:
> LuoYuanke wrote:
> > Can you add an test for it? Where to pass the JIT information to compiler?
> There is already JIT tests in llvm unit test at /llvm/unittests/ExecutionEngine/, and some examples at llvm/example.
> 
> This patch base on the build of llvm and libllvm.
> To test this patch, we need to build llvm self source code with CET enabled(-fcf-protection).
> JIT test mainly test runtime status (running fail/correct), not like lit test.
> So current is enough to test it.  
Yes, Usually we pass options information to JIT within the code self which JIT will handle.
But for CET, it different. because:
At **runtime** JIT don't know its caller program is CET enable or not.
So we do this:
If we build the LLVM code with CET enabled (e.g. use gcc -fcf-protection), the __CET__ macro will pass to LLVM compiler. If this Macro is defined, we default enable IBT for JIT in this patch. 


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

https://reviews.llvm.org/D76900





More information about the llvm-commits mailing list