[compiler-rt] r224034 - [Sanitizer] Don't modify mmap_limit_mb flag in runtime.
Alexey Samsonov
vonosmas at gmail.com
Thu Dec 11 10:45:24 PST 2014
Author: samsonov
Date: Thu Dec 11 12:45:24 2014
New Revision: 224034
URL: http://llvm.org/viewvc/llvm-project?rev=224034&view=rev
Log:
[Sanitizer] Don't modify mmap_limit_mb flag in runtime.
Instead, rely on the fact that RAW_CHECK doesn't call mmap(),
and we'll be able to print an error message and kill a program.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc?rev=224034&r1=224033&r2=224034&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Thu Dec 11 12:45:24 2014
@@ -258,12 +258,9 @@ void IncreaseTotalMmap(uptr size) {
if (!common_flags()->mmap_limit_mb) return;
uptr total_mmaped =
atomic_fetch_add(&g_total_mmaped, size, memory_order_relaxed) + size;
- if ((total_mmaped >> 20) > common_flags()->mmap_limit_mb) {
- // Since for now mmap_limit_mb is not a user-facing flag, just CHECK.
- uptr mmap_limit_mb = common_flags()->mmap_limit_mb;
- common_flags()->mmap_limit_mb = 0; // Allow mmap in CHECK.
- RAW_CHECK(total_mmaped >> 20 < mmap_limit_mb);
- }
+ // Since for now mmap_limit_mb is not a user-facing flag, just kill
+ // a program. Use RAW_CHECK to avoid extra mmaps in reporting.
+ RAW_CHECK((total_mmaped >> 20) < common_flags()->mmap_limit_mb);
}
void DecreaseTotalMmap(uptr size) {
More information about the llvm-commits
mailing list