[all-commits] [llvm/llvm-project] b684c1: Add a `Symbolizer::GetEnvP()` method that allows s...

danliew via All-commits all-commits at lists.llvm.org
Tue Mar 24 15:42:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b684c1a50f70a39ceb51973950c5cca520ce8b2c
      https://github.com/llvm/llvm-project/commit/b684c1a50f70a39ceb51973950c5cca520ce8b2c
  Author: Dan Liew <dan at su-root.co.uk>
  Date:   2020-03-24 (Tue, 24 Mar 2020)

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

  Log Message:
  -----------
  Add a `Symbolizer::GetEnvP()` method that allows symbolizer implementations to customise the environment of the symbolizer binary.

Summary:
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

Reviewers: kubamracek, yln, dvyukov, vitalybuka, eugenis, phosek, aizatsky, rnk

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D76666




More information about the All-commits mailing list