[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
Tue Mar 31 19:18:50 PDT 2020


xiangzhangllvm added a comment.

I find your patch will not deal with internal function. 
I tested GCC, It really will generate endbr for static functions:

  gcc version 9.3.1 20200317 (Red Hat 9.3.1-1) (GCC)
   [xiangzh1 at gnu-tgl-1 ~/tmp]$cat t.c
  extern int foo2(int a);
  
  extern int foo2(int a)
  {
    return a*6;
  }
  
  static int foo3(int a)
  {
    return a*7;
  }
  
  int foo(int a){
  //  int (*pf3)(int) = foo;
  //  int b = foo2(a) +foo3(a) + pf3(a);
    int b = foo2(a) +foo3(a);
    return b;
  }
   [xiangzh1 at gnu-tgl-1 ~/tmp]$
  [xiangzh1 at gnu-tgl-1 ~/tmp]$gcc -fcf-protection t.c -S -o t.s
  [xiangzh1 at gnu-tgl-1 ~/tmp]$cat t.s
          .file   "t.c"
          .text
          .globl  foo2
          .type   foo2, @function
  foo2:
  .LFB0:
          .cfi_startproc
          endbr64
          pushq   %rbp
          ....
  
          .size   foo2, .-foo2
          .type   foo3, @function
  foo3:
  .LFB1:
          .cfi_startproc
          endbr64
          pushq   %rbp
          .cfi_def_cfa_offset 16
        ....


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

https://reviews.llvm.org/D76900





More information about the llvm-commits mailing list