[PATCH] D29588: Use rw locks for sanitizer thread registry

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 13:36:03 PST 2017


dvyukov added a comment.

In https://reviews.llvm.org/D29588#669813, @fjricci wrote:

> Correct. We know that the data won't change in this particular case, because we know the parent isn't changing the data, and we know that our parent is holding the lock. However, this isn't what CheckLocked() is checking. CheckLocked() checks that *any* thread holds the lock, it doesn't need to be our parent to pass the check.


I still don't get the problem.
How is CheckLocked related? I don't see any CheckLocked calls in lsan code.

> That thread which is holding the lock could very well be changing the data. Even our parent could, in theory, be changing the data.

Um... well, but even the current thread can, in theory, hold the mutex and still wrongly change the data when it should not.
The parent is holding the mutex preventing all other threads from changing the data, and it should not change the data itself and it is not changing the data. Looks good to me. If parent will start changing data, we are in trouble. But there are zillion of possibilities of how we can end up in trouble if people will start randomly changing correct code to incorrect code.


https://reviews.llvm.org/D29588





More information about the llvm-commits mailing list