mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 15:26:47 +00:00

On thread creation, asan/hwasan/msan/tsan unpoison the thread stack and static TLS blocks in case the blocks reuse previously freed memory that is possibly poisoned. glibc nptl/allocatestack.c allocates thread stack using a hidden, non-interceptable function. nsan is similar: the shadow types for the thread stack and static TLS blocks should be set to unknown, otherwise if the static TLS blocks reuse previous shadow memory, and `*p += x` instead of `*p = x` is used for the first assignment, the mismatching user and shadow memory could lead to false positives. NsanThread is also needed by the next patch to use the sanitizer allocator. Pull Request: https://github.com/llvm/llvm-project/pull/102718