[hwasan] Fix vfork handling with large stack limit.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 28 Feb 2019 20:43:24 +0000 (20:43 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 28 Feb 2019 20:43:24 +0000 (20:43 +0000)
Remove the maximum stack cleanup size check. With ulimit -s unlimited
main thread stack can be very large, but we don't really have a choice
other than cleaning all of it. It should be reasonably fast - hwasan
cleans large shadow ranges with a single madvise call.

This change fixes check-hwasan after ulimit -s unlimited.

llvm-svn: 355137

compiler-rt/lib/hwasan/hwasan.cpp

index efcb311e00e05ed3768185a47a47996530168581..d10318251fb06524f9e5fdedd414cc27a2d5fd58 100644 (file)
@@ -488,9 +488,7 @@ void __hwasan_handle_vfork(const void *sp_dst) {
   CHECK(t);
   uptr top = t->stack_top();
   uptr bottom = t->stack_bottom();
-  static const uptr kMaxExpectedCleanupSize = 64 << 20;  // 64M
-  if (top == 0 || bottom == 0 || sp < bottom || sp >= top ||
-      sp - bottom > kMaxExpectedCleanupSize) {
+  if (top == 0 || bottom == 0 || sp < bottom || sp >= top) {
     Report(
         "WARNING: HWASan is ignoring requested __hwasan_handle_vfork: "
         "stack top: %zx; current %zx; bottom: %zx \n"