-
Couldn't load subscription status.
- Fork 13.9k
[beta] std: Synchronize access to global env during exec
#55978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nt in Command::exec" This reverts commit 36fe3b6.
This commit, after reverting rust-lang#55359, applies a different fix for rust-lang#46775 while also fixing rust-lang#55775. The basic idea was to go back to pre-rust-lang#55359 libstd, and then fix rust-lang#46775 in a way that doesn't expose rust-lang#55775. The issue described in rust-lang#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 rust-lang#55775 Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
|
@bors r+ p=1 |
|
📌 Commit 9609a91 has been approved by |
[beta] std: Synchronize access to global env during `exec` This is a beta backport of #55939
|
☀️ Test successful - status-appveyor, status-travis |
|
Please remove the |
This is a beta backport of #55939