[PATCH] D77696: [Darwin] Teach `AtosSymbolizerProcess` to work on a copy of the environment.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 17:27:58 PDT 2020


delcypher created this revision.
delcypher added reviewers: kubamracek, yln.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

This refactor is a pre-requisite to fixing rdar://problem/58789439. In
future patches we will modify this copy to pass a different environment
to `atos`. Due to working on a copy of the existing environment it is
expected that this patch will produce no functional change in most
cases.

The storage size for the copy of the environment is set statically so we
avoid doing a heap allocation at symbolization time where we might be
unable to allocate heap memory (e.g. when an out-of-memory situation has
been hit). Note that although `AtosSymbolizerProcess` is itself heap
allocated it is done so during early init where we should have enough
available heap memory.

In the case that the current process has more environment variables than
can be stored (currently 511 + 1 for null terminator) then a warning is
produced and the copy of the environment is truncated. A test case is
included for this scenario which should hopefully be rare.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77696

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp
  compiler-rt/test/sanitizer_common/TestCases/Darwin/symbolizer-large-env.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77696.255865.patch
Type: text/x-patch
Size: 4644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200408/c8cf1bba/attachment.bin>


More information about the llvm-commits mailing list