[PATCH] D40032: [compiler-rt] Replace forkpty with posix_spawn

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 09:08:21 PST 2017


kubamracek created this revision.
kubamracek added a project: Sanitizers.

On Darwin, we currently use forkpty to communicate with the "atos" symbolizer. There are several problems that fork or forkpty 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. Since posix_spawn doesn't fork (at least on Darwin), the interceptors are not a problem. Additionally, this also fixes a latent threading problem with ptsname (it's unsafe to use this function in multithreaded programs). Yet another benefit is that we'll handle post-fork failures (e.g. sandbox disallows "exec") gracefully now.


Repository:
  rL LLVM

https://reviews.llvm.org/D40032

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40032.122853.patch
Type: text/x-patch
Size: 9160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/c02e9013/attachment.bin>


More information about the llvm-commits mailing list