<div dir="ltr">This still isn't enough space for Chrome apparently:<div><br></div><div><div>C:\src\chromium\src\out\asan>chrome</div><div>[0803/085325:ERROR:file_io.cc(30)] read: expected 4, observed 0</div><div>==7920==AddressSanitizer CHECK failed: ..\projects\compiler-rt\lib\sanitizer_common\sanitizer_coverage_libcdep.cc:429 "((idx * sizeof(uptr))) < ((atomic_load(&pc_array_size, memory_order_acquire)))" (0x40256bc, 0x4000000)</div><div>    #0 0x68cd64a7 in __asan::AsanCheckFailed c:\src\llvm\projects\compiler-rt\lib\asan\asan_rtl.cc:68</div><div>    #1 0x68cb7a43 in __sanitizer::CheckFailed c:\src\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_termination.cc:79</div><div>    #2 0x68cb8077 in __sanitizer::CoverageData::Add c:\src\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_coverage_libcdep.cc:428</div><div>    #3 0x68cbae54 in __sanitizer_cov c:\src\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_coverage_libcdep.cc:947</div><div>    #4 0x57eda1f9 in _GLOBAL__sub_I_cld2_generated_quadchrome_2.cc C:\src\chromium\src\third_party\cld_2\src\internal\cld2_generated_quadchrome_2.cc<br></div></div><div><br></div><div>Why do we need two of these kPcArrayMaxSize buffers? First we do this:</div><div><div>  pc_array = reinterpret_cast<uptr *>(</div><div>      MmapNoReserveOrDie(sizeof(uptr) * kPcArrayMaxSize, "CovInit"));</div></div><div><br></div><div>And later this:</div><div><div>  if (common_flags()->coverage_pc_buffer)</div><div>    pc_buffer = reinterpret_cast<uptr *>(MmapNoReserveOrDie(</div><div>        sizeof(uptr) * kPcArrayMaxSize, "CovInit::pc_buffer"));</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 2, 2016 at 6:19 PM, Reid Kleckner via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Tue Aug  2 20:19:46 2016<br>
New Revision: 277558<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=277558&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=277558&view=rev</a><br>
Log:<br>
Reduce coverage PC buffer size on 32-bit Windows to match 32-bit Linux<br>
<br>
In r235779, Timur bumped the buffer size up to 1<<27, or about 134<br>
million coverage points, presumably to handle Chrome. We allocate two<br>
arrays of uptrs with this size, and this reliably exhausts all available<br>
address space on 32-bit Windows (2 allocations of 512MB) when ASan is<br>
also enabled.<br>
<br>
Let's reduce the buffer size for now to stabilize the test suite. We can<br>
re-evaluate the approach later when we've brought the Chrome ASan<br>
builders back to life.<br>
<br>
Kostya said that Mike reduced the number of instrumented coverage points<br>
that LLVM emits by half since Timur made this change, so reducing this<br>
array size should also be safe.<br>
<br>
With this change, the 32-bit ASan tests reliably pass for me on Windows<br>
10.<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc<br>
<br>
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=277558&r1=277557&r2=277558&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=277558&r1=277557&r2=277558&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Tue Aug  2 20:19:46 2016<br>
@@ -125,9 +125,8 @@ class CoverageData {<br>
<br>
   // Maximal size pc array may ever grow.<br>
   // We MmapNoReserve this space to ensure that the array is contiguous.<br>
-  static const uptr kPcArrayMaxSize = FIRST_32_SECOND_64(<br>
-      1 << (SANITIZER_ANDROID ? 24 : (SANITIZER_WINDOWS ? 27 : 26)),<br>
-      1 << 27);<br>
+  static const uptr kPcArrayMaxSize =<br>
+      FIRST_32_SECOND_64(1 << (SANITIZER_ANDROID ? 24 : 26), 1 << 27);<br>
   // The amount file mapping for the pc array is grown by.<br>
   static const uptr kPcArrayMmapSize = 64 * 1024;<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>