This is an archive of the discontinued LLVM Phabricator instance.

[TSan] Fix madvise(MADV_NOHUGEPAGE) for meta shadow memory
ClosedPublic

Authored by alekseyshl on Jun 12 2018, 2:26 PM.

Details

Summary

Move madvise(MADV_NOHUGEPAGE) for the meta shadow memory after the meta
shadow memory is mapped (currently it silently fails with ENOMEM).

Add a diagnostic message to detect similar problems in the future.

Event Timeline

alekseyshl created this revision.Jun 12 2018, 2:26 PM
Herald added subscribers: Restricted Project, delcypher, kubamracek. · View Herald TranscriptJun 12 2018, 2:26 PM
dvyukov added inline comments.Jun 12 2018, 10:50 PM
lib/tsan/rtl/tsan_platform_posix.cc
32

If we want to notice this in future we need to Die.
We never print anything unless there is a bug in program, or we terminate the program. Altered output breaks programs in surprising ways (consider altering output of protoc). Also if this happened in chrome or in our server code base all the time, we will never notice a warning line in output and nobody will notify us.

  • Die on madvise-ing shadow memory failure.
alekseyshl marked an inline comment as done.Jun 13 2018, 7:59 AM
dvyukov accepted this revision.Jun 13 2018, 8:03 AM
This revision is now accepted and ready to land.Jun 13 2018, 8:03 AM

Thanks!

lib/tsan/rtl/tsan_platform_posix.cc
33

By the way, do you think we should hint on the flag name controlling this feature here (like "set no_huge_pages_for_shadow=0 if it does not work for you") or we'd rather hear about the problem? I think the latter is preferred. The same for MADV_DONTDUMP below.

This revision was automatically updated to reflect the committed changes.