[compiler-rt] r190596 - [asan] limit the size of the fake stack with a reasonable constant. This fixes a failure when the main thread's stack is considered unlimited (very large).

Kostya Serebryany kcc at google.com
Thu Sep 12 02:08:13 PDT 2013


Author: kcc
Date: Thu Sep 12 04:08:13 2013
New Revision: 190596

URL: http://llvm.org/viewvc/llvm-project?rev=190596&view=rev
Log:
[asan] limit the size of the fake stack with a reasonable constant. This fixes a failure when the main thread's stack is considered unlimited (very large).

Modified:
    compiler-rt/trunk/lib/asan/asan_fake_stack.h

Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.h?rev=190596&r1=190595&r2=190596&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_fake_stack.h (original)
+++ compiler-rt/trunk/lib/asan/asan_fake_stack.h Thu Sep 12 04:08:13 2013
@@ -67,8 +67,12 @@ class FakeStack {
 
   // CTOR: create the FakeStack as a single mmap-ed object.
   static FakeStack *Create(uptr stack_size_log) {
-    if (stack_size_log < 15)
-      stack_size_log = 15;
+    static uptr kMinStackSizeLog = 16;
+    static uptr kMaxStackSizeLog = FIRST_32_SECOND_64(23, 26);
+    if (stack_size_log < kMinStackSizeLog)
+      stack_size_log = kMinStackSizeLog;
+    if (stack_size_log > kMaxStackSizeLog)
+      stack_size_log = kMaxStackSizeLog;
     FakeStack *res = reinterpret_cast<FakeStack *>(
         MmapOrDie(RequiredSize(stack_size_log), "FakeStack"));
     res->stack_size_log_ = stack_size_log;





More information about the llvm-commits mailing list