[tsan] Check for nullptr on user_alloc_usable_size_fast
authorJin Xin Ng <njx@google.com>
Mon, 12 Jun 2023 22:33:34 +0000 (22:33 +0000)
committerJin Xin Ng <njx@google.com>
Tue, 13 Jun 2023 00:00:31 +0000 (00:00 +0000)
commitfcf92cb8008d802de4b64ae765fed1ffe3871a97
tree4e5cfb097b1fcfe80dbcdff56a747de7155f36b2
parentc4e60a7f6045efc317087f964341f74a3f1b6446
[tsan] Check for nullptr on user_alloc_usable_size_fast

MBlock could be null (in the context of a call from RunFreeHooks)
if a static object was runtime initialized before tsan finished
initializing and that object later did a free().

While having the check isn't strictly required by
__sanitizer_get_allocated_size_fast's contract, a user's static object
would expect ptrs returned from malloc to be valid inputs.

Differential Revision: https://reviews.llvm.org/D152755
compiler-rt/lib/tsan/rtl/tsan_mman.cpp