This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Shadow memory setup for OS X
ClosedPublic

Authored by kubamracek on Nov 4 2015, 1:37 AM.

Details

Summary

The shadow memory initialization in tsan_platform_mac.cc needs to be updated to also initialize the meta shadow and to mprotect the memory ranges that need to be avoided. This patch moves most of the Linux implementation of InitializeShadowMemory, ProtectRange and CheckAndProtect into tsan_rt.cc so it can be reused on OS X as well.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 39172.Nov 4 2015, 1:37 AM
kubamracek retitled this revision from to [tsan] Shadow memory setup for OS X.
kubamracek updated this object.
kubamracek added reviewers: samsonov, glider, kcc, dvyukov.
dvyukov edited edge metadata.Nov 4 2015, 2:02 AM

Please shuffle code differently.
I have 2 concerns here:

  1. tsan_rtl.cc is already a bit of trash can, and I don't want it to continue moving in that direction (initially it was meant for abstract state-machine logic only).
  2. The distinction between InitializeShadowMemory and InitializeShadowMemoryPlatform is not clear, e.g. what will you put in what function on windows?

So please put the common functions into a new tsan_platform_posix.cc, put definition of CheckAndProtect into tsan_platform.h, call InitializeShadowMemoryPlatform from within InitializeShadowMemory (so that Initialize only calls InitializeShadowMemory, and then it's platform business what it does there).

kubamracek updated this revision to Diff 39174.Nov 4 2015, 2:29 AM
kubamracek edited edge metadata.

Updating patch.

dvyukov accepted this revision.Nov 4 2015, 2:36 AM
dvyukov edited edge metadata.

Thanks!

This revision is now accepted and ready to land.Nov 4 2015, 2:36 AM
This revision was automatically updated to reflect the committed changes.