[PATCH] D76666: Add a `Symbolizer::GetEnvP()` method that allows symbolizer implementations to customise the environment of the symbolizer binary.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 21:13:34 PDT 2020


delcypher created this revision.
delcypher added reviewers: kubamracek, yln, dvyukov, vitalybuka, eugenis, phosek, aizatsky, rnk.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

This change introduces the `Symbolizer::GetEnvP()` method that returns a
pointer to environment array used for spawning the symbolizer process.
The motivation is to allow implementations to customise the environment
if required.  The default implementation just returns
`__sanitizer::GetEnviron()` which (provided it's implemented) should
preserve the existing behaviours of the various implementations.

This change has been plumbed through the `internal_spawn(...)` and
`StartSubprocess(...)` process spawning implementations.

For the `StartSubprocess()` implementation we need to call `execve()`
rather than `execv()` to pass the environment. However, it appears that
`internal_execve(...)` exists in sanitizer_common so this patch use that
which seems like a nice clean up.

Support in the Windows implementation of
`SymbolizerProcess:StartSymbolizerSubprocess()` has not been added
because the Windows sanitizer runtime doesn't implement `GetEnviron()`.

rdar://problem/58789439


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76666

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_file.h
  compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_posix.h
  compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h
  compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
  compiler-rt/lib/sanitizer_common/tests/sanitizer_linux_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76666.252212.patch
Type: text/x-patch
Size: 6769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200324/3c5f81df/attachment.bin>


More information about the llvm-commits mailing list