about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-10-10 14:26:13 +0000
committerbors <bors@rust-lang.org>2017-10-10 14:26:13 +0000
commitec016f80cf725a9c8a613cdcd2ac97588d5f9af2 (patch)
tree4f4e84981f557883337fdde6aa77ba2874bc3efa /src/libstd/sys/unix/stack_overflow.rs
parent0217315bf23edee385a7042b5a23b3e7e376820c (diff)
parent8628d51c3b4c9a45e9066019f0e0853da7643794 (diff)
downloadrust-ec016f80cf725a9c8a613cdcd2ac97588d5f9af2.tar.gz
rust-ec016f80cf725a9c8a613cdcd2ac97588d5f9af2.zip
Auto merge of #45170 - rust-lang:aphs-no-unsynchronised-llvm-err-global, r=alexcrichton
Band-aid fix to stop race conditions in llvm errors

This is a big hammer, but should be effective at completely removing a
few issues, including inconsistent error messages and segfaults when
LLVM workers race to report results

`LLVM_THREAD_LOCAL` has been present in LLVM since 8 months before 3.7
(the earliest supported LLVM version that Rust can use)

Maybe fixes #43402 (third time lucky?)

r? @alexcrichton

------

You can see that in https://github.com/rust-lang/rust/blob/5f578dfad0dd5d43b28eff71a7e857d10c3f55fe/src/librustc_trans/back/write.rs#L75-L100 there's a small window where the static global error message (made thread local in this PR) could be altered by another thread.

Note that we can't use `thread_local` because gcc 4.7 (permitted according to the readme) does not support it.

Maybe ideally all the functions should be modified to not use a global, but this PR makes things deterministic at least. My only hesitation is whether errors are checked in different threads to where they occur, but I figure that's probably unlikely (and is less bad than racing code).

As an aside, segfault evidence before this patch when I was doing some debugging:
```
$ while grep 'No such file or directory' log2; do RUST_LOG=debug ./build/x86_64-unknown-linux-gnu/stage1/bin/rustc -o "" y.rs >log2 2>&1; done
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
Segmentation fault (core dumped)
error: could not write output to : No such file or directory
error: could not write output to : No such file or directory
```
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions