Which are CFI (Control Flow Integrity) related files?

Hi

I want to trace the code of clang/llvm CFI (Control Flow Integrity) mechanism

I found that there is ForwardControlFlowIntegrity.cpp in llvm 3.6

https://github.com/llvm-mirror/llvm/blob/release_36/lib/CodeGen/ForwardControlFlowIntegrity.cpp

But I don’t know which files implement CFI (Control Flow Integrity) in later version

(1)

If I use this command

clang-6.0 -fsanitize=cfi-icall -fvisibility=hidden -flto ./test.c

Which files implement CFI ?

(2)

I found these two files

but I set break point in gdb , and didn’t find anything

(gdb) b llvm::CrossDSOCFI::buildCFICheck

https://github.com/llvm-mirror/llvm/blob/release_60/lib/Transforms/IPO/LowerTypeTests.cpp

https://github.com/llvm-mirror/llvm/blob/release_60/lib/Transforms/IPO/CrossDSOCFI.cpp

(3)

What’s “MCCFIInstruction” ?

Does it relate to CFI (Control Flow Integrity) ?

http://llvm.org/doxygen/classllvm_1_1MCCFIInstruction.html

Thanks

Hi

I want to trace the code of clang/llvm CFI (Control Flow Integrity) mechanism

I found that there is ForwardControlFlowIntegrity.cpp in llvm 3.6

https://github.com/llvm-mirror/llvm/blob/release_36/lib/CodeGen/ForwardControlFlowIntegrity.cpp

But I don’t know which files implement CFI (Control Flow Integrity) in later version

(1)

If I use this command

clang-6.0 -fsanitize=cfi-icall -fvisibility=hidden -flto ./test.c

Which files implement CFI ?

In that case it would be LowerTypeTests.cpp as well as parts of clang/lib/CodeGen (grep for CFIICall).

(2)

I found these two files

but I set break point in gdb , and didn’t find anything

(gdb) b llvm::CrossDSOCFI::buildCFICheck

https://github.com/llvm-mirror/llvm/blob/release_60/lib/Transforms/IPO/LowerTypeTests.cpp

https://github.com/llvm-mirror/llvm/blob/release_60/lib/Transforms/IPO/CrossDSOCFI.cpp

The CrossDSOCFI.cpp file is only involved in implementing cross-DSO CFI (i.e. -fsanitize-cfi-cross-dso). If you don’t request cross-DSO CFI only LowerTypeTests.cpp is used.

(3)

What’s “MCCFIInstruction” ?

Does it relate to CFI (Control Flow Integrity) ?

http://llvm.org/doxygen/classllvm_1_1MCCFIInstruction.html

No, that’s a different CFI.

Peter