This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Use direct syscalls for internal_mmap and internal_munmap on OS X
ClosedPublic

Authored by kubamracek on Mar 24 2016, 1:30 AM.

Details

Summary

On OS X, internal_mmap just uses mmap, which can invoke callbacks into libmalloc (e.g. when MallocStackLogging is enabled). This can subsequently call other intercepted functions, and this breaks our Darwin-specific ThreadState initialization. Let's use direct syscalls in internal_mmap and internal_munmap. Added a testcase.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 51518.Mar 24 2016, 1:30 AM
kubamracek retitled this revision from to [tsan] Use direct syscalls for internal_mmap and internal_munmap on OS X.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, samsonov, glider, kcc.
dvyukov accepted this revision.Mar 24 2016, 1:44 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Mar 24 2016, 1:44 AM
This revision was automatically updated to reflect the committed changes.
glider added inline comments.Mar 24 2016, 5:00 AM
compiler-rt/trunk/test/tsan/Darwin/malloc-stack-logging.cc
1 ↗(On Diff #51537)

It's not clear from the test case what it is testing.

kubamracek added inline comments.Mar 24 2016, 6:26 AM
compiler-rt/trunk/test/tsan/Darwin/malloc-stack-logging.cc
1 ↗(On Diff #51537)

Added a comment in r264271.