<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96786>96786</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Replace pipe with internal_pipe in compiler-rt sanitizer common
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Lancern
</td>
</tr>
</table>
<pre>
Here in `compiler-rt` sanitizer common code:
https://github.com/llvm/llvm-project/blob/586114510c5fa71d1377c7f53e68a3b12c472aa2/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp#L291-L310
On line 296, the code calls `pipe`, which could be intercepted by sanitizers such as TSAN and make them produce false positives. This can be reproduced by the following example, which mixes UBSan and TSan:
```cpp
// test.cpp
// g++ -std=c++17 -fsanitize=undefined -fsanitize=thread -o test test.cpp
#include <thread>
class Foo {
public:
void produce(int) {}
void consume() {}
void run() {
w1_ = std::thread{&Foo::produce, this, 0};
w2_ = std::thread{&Foo::consume, this};
w1_.join();
w2_.join();
}
private:
std::thread w1_;
std::thread w2_;
};
int main() {
Foo f;
f.run();
return 0;
}
```
Should we replace this `pipe` call with something like `internal_pipe`? I can draft a patch for this if necessary. Or this is not a considered scenario?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVV2PqzYQ_TXOyygIbD6SBx42N0WttOqVutvnyJgh-F5jI9sku_31lSEfJHcfWikCZeb4zJljxubOyaNGLEm2I9l-xUffGVu-ci3Q6lVtms_yd7QIUgPJY2H6QSq0a-tJHoPjWnr5D1oQpu-NBmEaJOyFxHsSX56d94MLMVoRWh2l78Y6EqYntFLqdH2tB2t-oPCEVrUyNaFVtsmTJM2SWGQtL5ImYUUhijZjmG84qxMq0oJyTgmtlqpopWRYfpN2mKU9hAbj5MdByVo0OERiGAhlr3SbrF9ZEi_Ff9egpEag25zQb-A7nFoEwZVywZBBDkjyOCTPnRQdCDO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