about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-14 22:15:35 +0000
committerbors <bors@rust-lang.org>2018-11-14 22:15:35 +0000
commit7d3b9b1640611c52eb949dd60e8b9565997c6cea (patch)
treed3552eba9d6620737255fbd531988b7908b03c53 /src/rustllvm/RustWrapper.cpp
parent6f93e93af6f823948cc13d2938957757c6486d88 (diff)
parent4032b7a429462ece781629cab9f785742991ebef (diff)
downloadrust-7d3b9b1640611c52eb949dd60e8b9565997c6cea.tar.gz
rust-7d3b9b1640611c52eb949dd60e8b9565997c6cea.zip
Auto merge of #55939 - alexcrichton:path-regression-again, r=sfackler
std: Synchronize access to global env during `exec`

This commit, after reverting #55359, applies a different fix for #46775
while also fixing #55775. The basic idea was to go back to pre-#55359
libstd, and then fix #46775 in a way that doesn't expose #55775.

The issue described in #46775 boils down to two problems:

* First, the global environment is reset during `exec` but, but if the
  `exec` call fails then the global environment was a dangling pointer
  into free'd memory as the block of memory was deallocated when
  `Command` is dropped. This is fixed in this commit by installing a
  `Drop` stack object which ensures that the `environ` pointer is
  preserved on a failing `exec`.

* Second, the global environment was accessed in an unsynchronized
  fashion during `exec`. This was fixed by ensuring that the
  Rust-specific environment lock is acquired for these system-level
  operations.

Thanks to Alex Gaynor for pioneering the solution here!

Closes #55775
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions