Page MenuHomePhabricator

[winasan] Unpoison stack memory when threads exit (redux)
ClosedPublic

Authored by dmajor on Feb 25 2019, 11:42 AM.

Details

Summary

This is a second attempt at r342652 using a TLS callback instead of an interceptor.

In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a callback that unpoisons the stack memory when a thread exits.

Diff Detail

Repository
rL LLVM

Event Timeline

dmajor created this revision.Feb 25 2019, 11:42 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 25 2019, 11:42 AM
Herald added subscribers: Restricted Project, llvm-commits, jdoerfert. · View Herald Transcript

@rnk would you be able to test this out on the nacl browser_tests before landing?

rnk accepted this revision.Feb 25 2019, 3:52 PM

lgtm

Thanks for asking about the test, but honestly it's quite a lot of trouble for me to reproduce that build configuration. If you commit it, we'll know if it works by tomorrow, and I won't have to do anything.

If this approach doesn't work going forward, my next idea would be to unpoison the thread stack during thread creation. We already have a CreateThread interceptor that wraps thread startup, so this wouldn't be too hard.

asan_win.cc
366 ↗(On Diff #188229)

Let's use .CRT$XLX or Y instead. There is no guarantee that this XLZ section sorts before the XLZ section that the is used to find the bounds for thread destructors.

This revision is now accepted and ready to land.Feb 25 2019, 3:52 PM
This revision was automatically updated to reflect the committed changes.