[PATCH] D88559: [Sanitizer] Add interceptor for ptsname

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 00:07:11 PDT 2020


labath added a comment.

In D88559#2304679 <https://reviews.llvm.org/D88559#2304679>, @eugenis wrote:

> Consider a function that returns a pointer to a static buffer with the contents that are somehow initialized internally with proper synchronization. If the interceptor uses _WRITE, TSan will understand that as a data race because it can not see the internal synchronization. That why _INITIALIZE macro is used by MSan (the memory has somehow been initialized) but not by TSan (there may not have been a store there *right now*).
>
> Another example is strerror which sometimes returns a pointer to static data (always initialized, does not require any sanitizer handling) and sometimes to a freshly allocated thread-local buffer.

Interesting. Thanks for the explanation. So, we're preferring a false negative (not reporting a race in case the function doesn't do anything fancy -- a thing which is pretty hard to do in the ptsname case) over a false positive (reporting a race even if it does). Kind of makes sense. Not sure its the right trade-off for this function, but I don't want to revisit past design decisions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88559/new/

https://reviews.llvm.org/D88559



More information about the llvm-commits mailing list