[PATCH] D49383: [cfi-verify] Support cross-DSO by treating certain calls as traps.

Joel Galenson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 14:39:54 PDT 2018


jgalenson added a comment.

In https://reviews.llvm.org/D49383#1175738, @pcc wrote:

> I agree with eugenis that the PLT symbolization should live in lib/Object. That would also help us implement PLT symbolization in llvm-objdump. I was imagining that there would be a function that would take an object file and return a list of (PLT entry address, symbol) pairs. That would seem to be sufficient for llvm-objdump as well as for this code.
>
> I was discussing PLT symbolization offline with eugenis and did a little more investigation. It turns out that it shouldn't be that hard to symbolize the PLT, at least not on aarch64. All of bfd/gold/lld start their PLT entries with a straightforward ADRP/LDR sequence, which you can pretty straighforwardly map onto a GOT entry and then onto a symbol.


As I said initially, I did think putting this logic in core LLVM was the best way, but I still don't understand how to do it (other than the way I did).  Do you have more details or a sample patch?



================
Comment at: tools/llvm-cfi-verify/lib/FileAnalysis.cpp:539
+  TrapOnFailFunctions.insert("__cfi_slowpath");
+  TrapOnFailFunctions.insert("abort");
+  TrapOnFailFunctions.insert("__cfi_slowpath at plt");
----------------
eugenis wrote:
> pcc wrote:
> > Where does `abort` come from? In the diagnostic mode the failure path will end up calling `__ubsan_handle_cfi_check_fail` or `__ubsan_handle_cfi_check_fail_abort`.
> I think it comes from a combination of -fsanitize-trap and -ftrap-function=abort.
Yes, I figured it was a common function that might get used instead of a trap instruction.  I can remove it.

I didn't add the diagnostic ones because I couldn't easily generate a test file using them and I didn't want to add them without a test.


https://reviews.llvm.org/D49383





More information about the llvm-commits mailing list