-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Description
Clang version: 18.0.0
The following assertion is hit when using asan:
AddressSanitizer: CHECK failed: sanitizer_thread_registry.cpp:161 "((tctx->status)) == ((ThreadStatusInvalid))" (0xae0ee3a0, 0x0) (tid=2095999)
The value of the tctx->status field does not have any of the values in the related enum. Looks like a race condition since the the status value passes the assertion just after the creation of the object but has changed when the assertion is actually triggered. The QuarantinePop function returns nullptr in this scenario. I have seen other but similar assertion failures (value is not in the enum range) in other parts of the related code but this is the most common that I can trigger.
Suspicion goes to the following commit: https://reviews.llvm.org/D158786
Looks like there was a local allocator used together with a local mutex. Then the allocator was changed to a global one while the same mutex is still used. I have reverted back to using the local allocator in the GetAsanThreadContext function and can no longer reproduce the issue.
I have not been able to create a minimal test case for this. It reproduces in a chromium derivative but I can't share the code unfortunately.