[compiler-rt] [compiler-rt][common] Only unmap stacks the runtime has actually mapped (PR #179000)

Dan Blackwell via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 14 09:38:32 PST 2026


DanBlackwell wrote:

Good spot regarding the THREADLOCAL, I can see that `SetAlternateSignalStack()` gets called from `InstallDeadlySignalHandlers` in `AsanInitInternal`. I suspect that this is too early to behave well on Apple platforms. 

Ok, I went and checked and the current patch does not work on macOS - I tried the trick that TSan uses to get around this (using `pthread_(get|set)specific`), but that TSD slot can be destroyed before `UnsetAlternateSignalStack` gets called.

I think @vitalybuka's idea "Maybe you have to keep pointer in AsanThread." is the way to go - I tested this (messy patch) on macOS and it behaves correctly: https://github.com/DanBlackwell/llvm-project/commit/beeacaa10d016f690479cd9375885349a9420880.



https://github.com/llvm/llvm-project/pull/179000


More information about the llvm-commits mailing list