Skip to content

Commit 3c5f8a1

Browse files
authored
Rollup merge of rust-lang#65102 - tmiasko:tsan-probe-stack, r=alexcrichton
Disable stack probe when thread sanitizer is enabled When thread sanitizer instrumentation is enabled during compilation of stack probe function, the function will be miscompiled and trigger segmentation fault at runtime. Disable stack probes when tsan is enabled.
2 parents 7153c92 + 6c9f218 commit 3c5f8a1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustc_codegen_llvm/attributes.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ pub fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) {
9696
}
9797

9898
// Currently stack probes seem somewhat incompatible with the address
99-
// sanitizer. With asan we're already protected from stack overflow anyway
100-
// so we don't really need stack probes regardless.
101-
if let Some(Sanitizer::Address) = cx.sess().opts.debugging_opts.sanitizer {
102-
return
99+
// sanitizer and thread sanitizer. With asan we're already protected from
100+
// stack overflow anyway so we don't really need stack probes regardless.
101+
match cx.sess().opts.debugging_opts.sanitizer {
102+
Some(Sanitizer::Address) |
103+
Some(Sanitizer::Thread) => return,
104+
_ => {},
103105
}
104106

105107
// probestack doesn't play nice either with `-C profile-generate`.

0 commit comments

Comments
 (0)