[compiler-rt] r335928 - [TSan] More detailed error message on failed sahdow memory madvise
Alex Shlyapnikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 14:38:34 PDT 2018
Author: alekseyshl
Date: Thu Jun 28 14:38:34 2018
New Revision: 335928
URL: http://llvm.org/viewvc/llvm-project?rev=335928&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cc?rev=335928&r1=335927&r2=335928&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cc Thu Jun 28 14:38:34 2018
@@ -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, up
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();
}
}
More information about the llvm-commits
mailing list