<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Yes, that's similar. I have just looked at the code gen and the
vtable re-assignment races. Thanks a lot!</p>
<p>Oleg.<br>
</p>
<div class="moz-cite-prefix">On 2019-03-14 12:09, Kostya Serebryany
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAN=P9pgVnQeysVnhV=ibXNsw4nPuYvqnCY36WGnBeRAb_6NnoA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">I think this case is described in <a
href="https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces#data-race-on-vptr"
moz-do-not-send="true">https://github.com/google/sanitizers/wiki/ThreadSanitizerPopularDataRaces#data-race-on-vptr</a></div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Mar 14, 2019 at 9:23
AM Oleg Smolsky <<a href="mailto:oleg@cohesity.com"
moz-do-not-send="true">oleg@cohesity.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I've
hit a funky TSan warning: "data race on vptr (ctor/dtor vs
virtual <br>
call) in StartImpl()". I fail to see a race as the object is
constructed <br>
in the main thread and then a worker thread is started:<br>
<br>
struct Client : public ClientInterface {<br>
Client() {<br>
auto op = new Op{this};<br>
thread_ = std::thread([op] { op->StartImpl(); });<br>
}<br>
...<br>
};<br>
<br>
void Op::StartImpl() {<br>
std::cout << "This is a race: " <<
owner_->VirtualFunction() << "\n";<br>
}<br>
<br>
struct TestClient : public Client {};<br>
<br>
int main(int argc, char **argv) {<br>
TestClient().Wait();<br>
return 0;<br>
}<br>
<br>
The full report with a minimal/complete repro is here: <br>
<a href="https://github.com/google/sanitizers/issues/1063"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://github.com/google/sanitizers/issues/1063</a><br>
<br>
What am I missing? Does TSan miss the fact that all data
stores happen <br>
before the worker thread is started? Or is this about the
vtable pointer <br>
which is adjusted during the object's construction in the main
thread?<br>
<br>
Thanks!<br>
Oleg.<br>
<br>
</blockquote>
</div>
</blockquote>
</body>
</html>