[compiler-rt] d043b4b - [Sanitizer][Windows] Fix Windows buildbot failure after 64790064e82467b43c04a70b6e9873e6939be81f (#82215)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 00:42:53 PST 2024


Author: Enna1
Date: 2024-02-19T16:42:48+08:00
New Revision: d043b4bc7e61e2720fae2473db145389ccac4598

URL: https://github.com/llvm/llvm-project/commit/d043b4bc7e61e2720fae2473db145389ccac4598
DIFF: https://github.com/llvm/llvm-project/commit/d043b4bc7e61e2720fae2473db145389ccac4598.diff

LOG: [Sanitizer][Windows] Fix Windows buildbot failure after 64790064e82467b43c04a70b6e9873e6939be81f (#82215)

In #77488, a param raw_report is added for function UnmapOrDie(), causes
the Windows buildbot failure:
- https://lab.llvm.org/buildbot/#/builders/127/builds/62395
- https://lab.llvm.org/buildbot/#/builders/265/builds/2662

This patch should fix the Windows buildbot failure.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_common.h
    compiler-rt/lib/sanitizer_common/sanitizer_win.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index dd4c71640b4492..47697ef280aa0d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -599,7 +599,7 @@ class InternalMmapVectorNoCtor {
     T *new_data =
         (T *)MmapOrDie(new_capacity_bytes, "InternalMmapVector", raw_report);
     internal_memcpy(new_data, data_, size_ * sizeof(T));
-    UnmapOrDie(data_, capacity_bytes_);
+    UnmapOrDie(data_, capacity_bytes_, raw_report);
     data_ = new_data;
     capacity_bytes_ = new_capacity_bytes;
   }

diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
index 06e496523eeaa1..4e5ad8e4693b45 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
@@ -144,7 +144,7 @@ void *MmapOrDie(uptr size, const char *mem_type, bool raw_report) {
   return rv;
 }
 
-void UnmapOrDie(void *addr, uptr size) {
+void UnmapOrDie(void *addr, uptr size, bool raw_report) {
   if (!size || !addr)
     return;
 
@@ -156,10 +156,7 @@ void UnmapOrDie(void *addr, uptr size) {
   // fails try MEM_DECOMMIT.
   if (VirtualFree(addr, 0, MEM_RELEASE) == 0) {
     if (VirtualFree(addr, size, MEM_DECOMMIT) == 0) {
-      Report("ERROR: %s failed to "
-             "deallocate 0x%zx (%zd) bytes at address %p (error code: %d)\n",
-             SanitizerToolName, size, size, addr, GetLastError());
-      CHECK("unable to unmap" && 0);
+      ReportMunmapFailureAndDie(addr, size, GetLastError(), raw_report);
     }
   }
 }


        


More information about the llvm-commits mailing list