[llvm-commits] [compiler-rt] r157249 - in /compiler-rt/trunk/lib/asan: asan_linux.cc asan_thread.h
Kostya Serebryany
kcc at google.com
Tue May 22 04:54:45 PDT 2012
Author: kcc
Date: Tue May 22 06:54:44 2012
New Revision: 157249
URL: http://llvm.org/viewvc/llvm-project?rev=157249&view=rev
Log:
[asan] increase the stack size limit to 256M (yes, that happens); also CHECK that the stack size is less than that on a non-main thread
Modified:
compiler-rt/trunk/lib/asan/asan_linux.cc
compiler-rt/trunk/lib/asan/asan_thread.h
Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=157249&r1=157248&r2=157249&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_linux.cc Tue May 22 06:54:44 2012
@@ -39,6 +39,8 @@
namespace __asan {
+const size_t kMaxThreadStackSize = 256 * (1 << 20); // 256M
+
void *AsanDoesNotSupportStaticLinkage() {
// This will fail to link with -static.
return &_DYNAMIC; // defined in link.h
@@ -294,6 +296,9 @@
size_t stacksize = rl.rlim_cur;
if (stacksize > end - prev_end)
stacksize = end - prev_end;
+ // When running with unlimited stack size, we still want to set some limit.
+ // The unlimited stack size is caused by 'ulimit -s unlimited'.
+ // Also, for some reason, GNU make spawns subrocesses with unlimited stack.
if (stacksize > kMaxThreadStackSize)
stacksize = kMaxThreadStackSize;
stack_top_ = end;
@@ -310,12 +315,7 @@
stack_top_ = (uintptr_t)stackaddr + stacksize;
stack_bottom_ = (uintptr_t)stackaddr;
- // When running with unlimited stack size, we still want to set some limit.
- // The unlimited stack size is caused by 'ulimit -s unlimited'.
- // Also, for some reason, GNU make spawns subrocesses with unlimited stack.
- if (stacksize > kMaxThreadStackSize) {
- stack_bottom_ = stack_top_ - kMaxThreadStackSize;
- }
+ CHECK(stacksize < kMaxThreadStackSize); // Sanity check.
CHECK(AddrIsInStack((uintptr_t)&attr));
}
Modified: compiler-rt/trunk/lib/asan/asan_thread.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.h?rev=157249&r1=157248&r2=157249&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.h (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.h Tue May 22 06:54:44 2012
@@ -21,8 +21,6 @@
namespace __asan {
-const size_t kMaxThreadStackSize = 16 * (1 << 20); // 16M
-
class AsanThread;
// These objects are created for every thread and are never deleted,
More information about the llvm-commits
mailing list