[compiler-rt] r292955 - Fix pc_array bounds check to use elements instead of bytes

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 10:53:36 PST 2017


thanks!
Note: I hope to kill this code sometime soon.

On Tue, Jan 24, 2017 at 9:45 AM, Reid Kleckner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rnk
> Date: Tue Jan 24 11:45:35 2017
> New Revision: 292955
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292955&view=rev
> Log:
> Fix pc_array bounds check to use elements instead of bytes
>
> pc_array_size and kPcArrayMaxSize appear to be measured in elements, not
> bytes, so we shouldn't multiply idx by sizeof(uptr) in this bounds
> check.  32-bit Chrome was tripping this assertion because it has 64
> million coverage points. I don't think it's worth adding a test that has
> that many coverage points.
>
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_
> coverage_libcdep.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/
> sanitizer_common/sanitizer_coverage_libcdep.cc?rev=
> 292955&r1=292954&r2=292955&view=diff
> ============================================================
> ==================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
> (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
> Tue Jan 24 11:45:35 2017
> @@ -415,8 +415,7 @@ void CoverageData::Add(uptr pc, u32 *gua
>    uptr idx = -guard_value - 1;
>    if (idx >= atomic_load(&pc_array_index, memory_order_acquire))
>      return;  // May happen after fork when pc_array_index becomes 0.
> -  CHECK_LT(idx * sizeof(uptr),
> -           atomic_load(&pc_array_size, memory_order_acquire));
> +  CHECK_LT(idx, atomic_load(&pc_array_size, memory_order_acquire));
>    uptr counter = atomic_fetch_add(&coverage_counter, 1,
> memory_order_relaxed);
>    pc_array[idx] = BundlePcAndCounter(pc, counter);
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170124/fa80ad9f/attachment.html>


More information about the llvm-commits mailing list