[PATCH] D65253: [sanitizer_common] Replace forkpty with posix_spawn on Darwin

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 16:15:19 PDT 2019


yln created this revision.
Herald added subscribers: llvm-commits, Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.

On Darwin, we currently use forkpty to communicate with the "atos"
symbolizer. There are several problems that fork[pty] has, e.g. that
after fork, interceptors are still active and this sometimes causes
crashes or hangs. This is especially problematic for TSan, which uses
interceptors for OS-provided locks and mutexes, and even Libc functions
use those.

This patch replaces forkpty with posix_spawn on Darwin. Since
posix_spawn doesn't fork (at least on Darwin), the interceptors are not
a problem. Another benefit is that we'll handle post-fork failures (e.g.
sandbox disallows "exec") gracefully now.

Related revisions and previous attempts that were blocked by or had to
be revered due to test failures:
https://reviews.llvm.org/D48451
https://reviews.llvm.org/D40032


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65253

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
  compiler-rt/lib/sanitizer_common/sanitizer_posix.h
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65253.211630.patch
Type: text/x-patch
Size: 9530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190724/619117e0/attachment.bin>


More information about the llvm-commits mailing list