theRockLiu / thread-sanitizer

Automatically exported from code.google.com/p/thread-sanitizer
0 stars 0 forks source link

Deannotating benign data races #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
ThreadSanitizer allows to specify that data races inside a particular
memory region are benign. However, it is impossible to remove a region
from the list of those with benign data races. Once the region is
reallocated and used for a different purpose, real data races on it may
be missed.

I propose adding such a "deannotation" functionality to ThreadSanitizer.
A possible patch:

https://github.com/yegord/compiler-rt/commit/DeannotateBenignRace

Original issue reported on code.google.com by yegor.de...@gmail.com on 20 Nov 2013 at 2:52

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for report!

Would it suffice your needs if tsan will automatically deannotate benign race 
region when a heap block is freed (or if it's thread stack/tls, when the thread 
is finished)?
We need to do it anyway, because the region must be deannotated on free even if 
user does not say it explicitly.

Original comment by dvyu...@google.com on 20 Nov 2013 at 7:58

GoogleCodeExporter commented 9 years ago
Hi,

no, it will not suffice: TSan does not know anything about custom
allocators (which work on top of malloc/free and can reuse memory for
different purposes without reallocating it on libc/OS level).

Deannotation on free, however, is a useful thing, as long as O(N)
overhead will not hurt performance in practice (N being the number of
elements in the ExpectRace lists).

Original comment by yegor.de...@gmail.com on 20 Nov 2013 at 9:10

GoogleCodeExporter commented 9 years ago
makes sense

Original comment by dvyu...@gmail.com on 21 Nov 2013 at 1:32