[PATCH] [compiler-rt] atos symbolizer for OS X

Kuba Brecka kuba.brecka at gmail.com
Mon Dec 29 16:46:38 PST 2014


Updating the patch to address review comments and refactor the symbolizers interface a little bit more:

`SymbolizerInterface` becomes a generic interface that all the symbolizers implement, and has these methods:

- `bool SymbolizePC(uptr addr, SymbolizedStack *stack);`
- `bool SymbolizeData(uptr addr, DataInfo *info)`

`SymbolizerProcess` on the other hand is now a completely separate class that handles the communication with the external process. It no longer deals with modules names and offsets, it just receives a "command" and provides a "response". The new `LLVMSymbolizer` class is responsible for constructing the string command for `LLVMSymbolizerProcess` and parsing the response back into `SymbolizedStack` or `DataInfo`. This way, I can implement `AtosSymbolizerProcess` as a very simple subclass of `SymbolizerProcess`.

I changed the StartSymbolizerSubprocess() method to use the `forkpty` call (instead of fork, sock_pair and pipe) for all subprocesses. It's needed for `atos`, in order to disable buffering in the new terminal (otherwise the response gets buffered inside libc and never returned until the input stream is closed). This also simplifies this method a lot, and we don't need to handle the case when stdin/stdout/stderr are closed.

The patch also adds one more symbolizer, `DlAddrSymbolizer`, which is extremely simple, and just calls dladdr() to retrieve a symbol name, and doesn't provide any file names or line numbers. It's used as a fallback when spawning an external symbolizer fails (e.g. because we're in a no-fork-allowed sandbox).

I added some new test cases that show that we can still provide symbol names in a no-fork sandbox, and that suppressions specified by a symbol name also work.


http://reviews.llvm.org/D6588

Files:
  lib/sanitizer_common/CMakeLists.txt
  lib/sanitizer_common/sanitizer_common.cc
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_symbolizer.h
  lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
  lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
  lib/sanitizer_common/sanitizer_symbolizer_mac.cc
  lib/sanitizer_common/sanitizer_symbolizer_mac.h
  lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
  test/asan/TestCases/Darwin/sandbox-symbolizer.cc
  test/asan/TestCases/Darwin/suppressions-sandbox.cc
  test/asan/TestCases/closed-fds.cc

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6588.17698.patch
Type: text/x-patch
Size: 44797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141230/79034523/attachment.bin>


More information about the llvm-commits mailing list