diff options
author | Alex Shlyapnikov <alekseys@google.com> | 2018-06-28 21:38:34 +0000 |
---|---|---|
committer | Alex Shlyapnikov <alekseys@google.com> | 2018-06-28 21:38:34 +0000 |
commit | 7f2c081778b0f58703c85971bde710afce5f49e9 (patch) | |
tree | 2e7236f9aa75eb94e89a3c281a81e09ca9313b0c /lib/tsan | |
parent | c967293495916f511d3f4048919bbeca4ecc0e43 (diff) |
[TSan] More detailed error message on failed sahdow memory madvise
Summary:
Report errno value on failed shadow memory madvise attempt and add a
hint message with the possible workaround.
Reviewers: eugenis
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48668
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan')
-rw-r--r-- | lib/tsan/rtl/tsan_platform_posix.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/tsan/rtl/tsan_platform_posix.cc b/lib/tsan/rtl/tsan_platform_posix.cc index 22b649ef3..d2345c79c 100644 --- a/lib/tsan/rtl/tsan_platform_posix.cc +++ b/lib/tsan/rtl/tsan_platform_posix.cc @@ -16,6 +16,7 @@ #if SANITIZER_POSIX #include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_errno.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_procmaps.h" #include "tsan_platform.h" @@ -24,13 +25,18 @@ namespace __tsan { static const char kShadowMemoryMappingWarning[] = - "FATAL: %s can not madvise shadow region [%zx, %zx] with %s\n"; + "FATAL: %s can not madvise shadow region [%zx, %zx] with %s (errno: %d)\n"; +static const char kShadowMemoryMappingHint[] = + "HINT: if %s is not supported in your environment, you may set " + "TSAN_OPTIONS=%s=0\n"; static void NoHugePagesInShadow(uptr addr, uptr size) { if (common_flags()->no_huge_pages_for_shadow) if (!NoHugePagesInRegion(addr, size)) { Printf(kShadowMemoryMappingWarning, SanitizerToolName, addr, addr + size, - "MADV_NOHUGEPAGE"); + "MADV_NOHUGEPAGE", errno); + Printf(kShadowMemoryMappingHint, "MADV_NOHUGEPAGE", + "no_huge_pages_for_shadow"); Die(); } } @@ -39,7 +45,8 @@ static void DontDumpShadow(uptr addr, uptr size) { if (common_flags()->use_madv_dontdump) if (!DontDumpShadowMemory(addr, size)) { Printf(kShadowMemoryMappingWarning, SanitizerToolName, addr, addr + size, - "MADV_DONTDUMP"); + "MADV_DONTDUMP", errno); + Printf(kShadowMemoryMappingHint, "MADV_DONTDUMP", "use_madv_dontdump"); Die(); } } |