summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-09-12 09:08:13 +0000
committerKostya Serebryany <kcc@google.com>2013-09-12 09:08:13 +0000
commit79d98a851b08b560531fc0d7004231498b50e43f (patch)
tree174f4d32d32526ca9803aaeee8bd82924d4a2e4b
parent8952974e2930325237ccae42547810b5f5fd126b (diff)
downloadbcm5719-llvm-79d98a851b08b560531fc0d7004231498b50e43f.tar.gz
bcm5719-llvm-79d98a851b08b560531fc0d7004231498b50e43f.zip
[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).
llvm-svn: 190596
-rw-r--r--compiler-rt/lib/asan/asan_fake_stack.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/asan_fake_stack.h b/compiler-rt/lib/asan/asan_fake_stack.h
index b6dc23bb941..493e7e521d8 100644
--- a/compiler-rt/lib/asan/asan_fake_stack.h
+++ b/compiler-rt/lib/asan/asan_fake_stack.h
@@ -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;
OpenPOWER on IntegriCloud