<div dir="ltr">Something is not right with the commit message.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 29, 2017 at 2:54 PM, Alex Shlyapnikov 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: alekseyshl<br>
Date: Thu Jun 29 14:54:36 2017<br>
New Revision: 306746<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=306746&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=306746&view=rev</a><br>
Log:<br>
Merge<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/asan/<wbr>asan_allocator.cc<br>
    compiler-rt/trunk/lib/msan/<wbr>msan_allocator.cc<br>
    compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.cc<br>
    compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.h<br>
    compiler-rt/trunk/lib/tsan/<wbr>rtl/tsan_mman.cc<br>
<br>
Modified: compiler-rt/trunk/lib/asan/<wbr>asan_allocator.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.cc?rev=306746&r1=306745&r2=306746&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/compiler-rt/trunk/lib/<wbr>asan/asan_allocator.cc?rev=<wbr>306746&r1=306745&r2=306746&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/asan/<wbr>asan_allocator.cc (original)<br>
+++ compiler-rt/trunk/lib/asan/<wbr>asan_allocator.cc Thu Jun 29 14:54:36 2017<br>
@@ -635,7 +635,7 @@ struct Allocator {<br>
   }<br>
<br>
   void *Calloc(uptr nmemb, uptr size, BufferedStackTrace *stack) {<br>
-    if (<wbr>CallocShouldReturnNullDueToOve<wbr>rflow(size, nmemb))<br>
+    if (CheckForCallocOverflow(size, nmemb))<br>
       return AsanAllocator::FailureHandler:<wbr>:OnBadRequest();<br>
     void *ptr = Allocate(nmemb * size, 8, stack, FROM_MALLOC, false);<br>
     // If the memory comes from the secondary allocator no need to clear it<br>
<br>
Modified: compiler-rt/trunk/lib/msan/<wbr>msan_allocator.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_allocator.cc?rev=306746&r1=306745&r2=306746&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/compiler-rt/trunk/lib/<wbr>msan/msan_allocator.cc?rev=<wbr>306746&r1=306745&r2=306746&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/msan/<wbr>msan_allocator.cc (original)<br>
+++ compiler-rt/trunk/lib/msan/<wbr>msan_allocator.cc Thu Jun 29 14:54:36 2017<br>
@@ -195,7 +195,7 @@ void MsanDeallocate(StackTrace *stack, v<br>
 }<br>
<br>
 void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) {<br>
-  if (<wbr>CallocShouldReturnNullDueToOve<wbr>rflow(size, nmemb))<br>
+  if (CheckForCallocOverflow(size, nmemb))<br>
     return Allocator::FailureHandler::<wbr>OnBadRequest();<br>
   return MsanReallocate(stack, nullptr, nmemb * size, sizeof(u64), true);<br>
 }<br>
<br>
Modified: compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.cc?rev=306746&r1=306745&r2=306746&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.cc?rev=306746&r1=<wbr>306745&r2=306746&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.cc (original)<br>
+++ compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.cc Thu Jun 29 14:54:36 2017<br>
@@ -160,7 +160,7 @@ void *InternalRealloc(void *addr, uptr s<br>
 }<br>
<br>
 void *InternalCalloc(uptr count, uptr size, InternalAllocatorCache *cache) {<br>
-  if (<wbr>CallocShouldReturnNullDueToOve<wbr>rflow(count, size))<br>
+  if (CheckForCallocOverflow(count, size))<br>
     return InternalAllocator::<wbr>FailureHandler::OnBadRequest()<wbr>;<br>
   void *p = InternalAlloc(count * size, cache);<br>
   if (p) internal_memset(p, 0, count * size);<br>
@@ -202,7 +202,7 @@ void SetLowLevelAllocateCallback(<wbr>LowLeve<br>
   low_level_alloc_callback = callback;<br>
 }<br>
<br>
-bool CallocShouldReturnNullDueToOve<wbr>rflow(uptr size, uptr n) {<br>
+bool CheckForCallocOverflow(uptr size, uptr n) {<br>
   if (!size) return false;<br>
   uptr max = (uptr)-1L;<br>
   return (max / size) < n;<br>
<br>
Modified: compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator.h?rev=306746&r1=306745&r2=306746&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.h?rev=306746&r1=<wbr>306745&r2=306746&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.h (original)<br>
+++ compiler-rt/trunk/lib/<wbr>sanitizer_common/sanitizer_<wbr>allocator.h Thu Jun 29 14:54:36 2017<br>
@@ -56,8 +56,10 @@ struct NoOpMapUnmapCallback {<br>
 // Callback type for iterating over chunks.<br>
 typedef void (*ForEachChunkCallback)(uptr chunk, void *arg);<br>
<br>
-// Returns true if calloc(size, n) should return 0 due to overflow in size*n.<br>
-bool CallocShouldReturnNullDueToOve<wbr>rflow(uptr size, uptr n);<br>
+// Returns true if calloc(size, n) call overflows on size*n calculation.<br>
+// The caller should "return POLICY::OnBadRequest();" where POLICY is the<br>
+// current allocator failure handling policy.<br>
+bool CheckForCallocOverflow(uptr size, uptr n);<br>
<br>
 #include "sanitizer_allocator_size_<wbr>class_map.h"<br>
 #include "sanitizer_allocator_stats.h"<br>
<br>
Modified: compiler-rt/trunk/lib/tsan/<wbr>rtl/tsan_mman.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_mman.cc?rev=306746&r1=306745&r2=306746&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/compiler-rt/trunk/lib/<wbr>tsan/rtl/tsan_mman.cc?rev=<wbr>306746&r1=306745&r2=306746&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- compiler-rt/trunk/lib/tsan/<wbr>rtl/tsan_mman.cc (original)<br>
+++ compiler-rt/trunk/lib/tsan/<wbr>rtl/tsan_mman.cc Thu Jun 29 14:54:36 2017<br>
@@ -162,7 +162,7 @@ void *user_alloc(ThreadState *thr, uptr<br>
 }<br>
<br>
 void *user_calloc(ThreadState *thr, uptr pc, uptr size, uptr n) {<br>
-  if (<wbr>CallocShouldReturnNullDueToOve<wbr>rflow(size, n))<br>
+  if (CheckForCallocOverflow(size, n))<br>
     return Allocator::FailureHandler::<wbr>OnBadRequest();<br>
   void *p = user_alloc(thr, pc, n * size);<br>
   if (p)<br>
<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>