nickdesaulniers added a comment.

In D126137#3530777 <https://reviews.llvm.org/D126137#3530777>, @kristof.beyls 
wrote:

> Therefore, I wonder if it wouldn't be better to name this -mharden-sls=retbr 
> for more consistency across architectures?

I think it's best to maintain compatibility with GCC; to do so otherwise might 
be surprising for users.

> Or is the indirect function call case not relevant for x86 (sorry - I'm not 
> up to speed on the details on the x86 side)?

Looks like GCC does not instrument indirect calls from what I can tell:

  $ cat x.c
  void bar(void (*x)(void)) {
    x();
    x();
  }
  $ gcc -mharden-sls=all x.c -c -O2
  $ llvm-objdump -dr x.o           
  ...
  0000000000000000 <bar>:
         0: 53                                  pushq   %rbx
         1: 48 89 fb                            movq    %rdi, %rbx
         4: ff d7                               callq   *%rdi
         6: 48 89 d8                            movq    %rbx, %rax
         9: 5b                                  popq    %rbx
         a: ff e0                               jmpq    *%rax
         c: cc                                  int3

so the indirect `call` instruction is not hardened. The indirect jmp (tail 
call) is.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126137

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to