This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Fix a crash when demangling Swift symbols
ClosedPublic

Authored by kubamracek on May 5 2016, 7:39 AM.

Details

Summary

To invoke the Swift demangler, we use dlsym to locate swift_demangle. However, dlsym malloc's storage and stores it in thread-local storage. Since allocations from the symbolizer are done with the system allocator (at least in TSan, interceptors are skipped when inside the symbolizer), we will crash when we try to deallocate later using the sanitizer allocator again.

To fix this, let's just not call dlsym from the demangler, and call it during initialization.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 56285.May 5 2016, 7:39 AM
kubamracek retitled this revision from to [sanitizer] Fix a crash when demangling Swift symbols.
kubamracek updated this object.
kubamracek added a project: Restricted Project.
kubamracek added subscribers: llvm-commits, dcoughlin.
aizatsky accepted this revision.May 5 2016, 1:32 PM
aizatsky added a reviewer: aizatsky.
This revision is now accepted and ready to land.May 5 2016, 1:32 PM
This revision was automatically updated to reflect the committed changes.

Had to revert in r268723 due to test failures on Linux.