[PATCH] D77623: [Darwin] Fix a bug where the symbolizer would examine the wrong process.

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 18:00:18 PDT 2020


yln accepted this revision.
yln marked an inline comment as done.
yln added inline comments.


================
Comment at: compiler-rt/test/sanitizer_common/TestCases/Darwin/print-stack-trace-in-code-loaded-after-fork.cpp:45
+  const char *library_to_load = argv[1];
+  void *handle = dlopen(library_to_load, RTLD_NOW | RTLD_LOCAL);
+  assert(handle);
----------------
delcypher wrote:
> yln wrote:
> > Can you explain why the separately loaded lib/dlopen is required to trigger the error condition?  From the commit message I thought that a fork should be enough? Other than that: LGTM
> I'm deliberately loading code into the child process that doesn't exist in the parent process. If atos is told examine the parent process then it will be told to examine a PC in `PrintStack` which isn't loaded in that process and so will fail.
> 
> I'll add a comment to the test case to explain the reasoning here.
So before, we were always calling atos with the wrong pid (parent pid), but it only matters in cases where we try to symbolize code that isn't actually present in the parent.  Got it, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77623





More information about the llvm-commits mailing list