[all-commits] [llvm/llvm-project] 216956: [Sanitizer Common] Show command used to launch sym...

danliew via All-commits all-commits at lists.llvm.org
Mon Apr 13 13:37:03 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2169568d9f535a5ffa921d7ec0869c0f8b18f6ac
      https://github.com/llvm/llvm-project/commit/2169568d9f535a5ffa921d7ec0869c0f8b18f6ac
  Author: Dan Liew <dan at su-root.co.uk>
  Date:   2020-04-13 (Mon, 13 Apr 2020)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
    A compiler-rt/test/sanitizer_common/TestCases/symbolize_debug_argv.cpp

  Log Message:
  -----------
  [Sanitizer Common] Show command used to launch symbolizer process at high verbosity level.

Summary:
In preparation for writing a test for a bug fix we need to be able to
see the command used to launch the symbolizer process. This feature
will likely be useful for debugging how the Sanitizers use the
symbolizer in general.

This patch causes the command line used to launch the process to be
shown at verbosity level 3 and higher.

A small test case is included.

Reviewers: kubamracek, yln, vitalybuka, eugenis, kcc

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D77622


  Commit: 8efc3ccaf808caeba395f71449524830f7fe1d09
      https://github.com/llvm/llvm-project/commit/8efc3ccaf808caeba395f71449524830f7fe1d09
  Author: Dan Liew <dan at su-root.co.uk>
  Date:   2020-04-13 (Mon, 13 Apr 2020)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
    A compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace-in-code-loaded-after-fork.cpp

  Log Message:
  -----------
  [Darwin] Fix a bug where the symbolizer would examine the wrong process.

Summary:
Previously `AtosSymbolizer` would set the PID to examine in the
constructor which is called early on during sanitizer init. This can
lead to incorrect behaviour in the case of a fork() because if the
symbolizer is launched in the child it will be told examine the parent
process rather than the child.

To fix this the PID is determined just before the symbolizer is
launched.

A test case is included that triggers the buggy behaviour that existed
prior to this patch. The test observes the PID that `atos` was called
on. It also examines the symbolized stacktrace. Prior to this patch
`atos` failed to symbolize the stacktrace giving output that looked
like...

```
  #0 0x100fc3bb5 in __sanitizer_print_stack_trace asan_stack.cpp:86
  #1 0x10490dd36 in PrintStack+0x56 (/path/to/print-stack-trace-in-code-loaded-after-fork.cpp.tmp_shared_lib.dylib:x86_64+0xd36)
  #2 0x100f6f986 in main+0x4a6 (/path/to/print-stack-trace-in-code-loaded-after-fork.cpp.tmp_loader:x86_64+0x100001986)
  #3 0x7fff714f1cc8 in start+0x0 (/usr/lib/system/libdyld.dylib:x86_64+0x1acc8)
```

After this patch stackframes `#1` and `#2` are fully symbolized.

This patch is also a pre-requisite refactor for rdar://problem/58789439.

Reviewers: kubamracek, yln

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D77623


Compare: https://github.com/llvm/llvm-project/compare/bb0e6cc1dd13...8efc3ccaf808


More information about the All-commits mailing list