[compiler-rt] 24a62bf - tsan: fix bug in shadow reset introduced in D128909
Than McIntosh via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 5 08:38:22 PDT 2022
Author: Than McIntosh
Date: 2022-08-05T11:36:58-04:00
New Revision: 24a62bfe9a497bb494aae24e33f4d8349720a9c8
URL: https://github.com/llvm/llvm-project/commit/24a62bfe9a497bb494aae24e33f4d8349720a9c8
DIFF: https://github.com/llvm/llvm-project/commit/24a62bfe9a497bb494aae24e33f4d8349720a9c8.diff
LOG: tsan: fix bug in shadow reset introduced in D128909
Correct a bug in the code that resets shadow memory introduced as part
of a previous change for the Go race detector (D128909). The bug was
that only the most recently added shadow segment was being reset, as
opposed to the entire extent of the segment created so far. This
fixes a bug identified in Google internal testing (b/240733951).
Differential Revision: https://reviews.llvm.org/D131256
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
index ff3bb33eb134f..db3d94518b825 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
@@ -603,8 +603,8 @@ void MapShadow(uptr addr, uptr size) {
// Second and subsequent calls map heap.
if (shadow_end <= ctx->mapped_shadow_end)
return;
- if (ctx->mapped_shadow_begin < shadow_begin)
- ctx->mapped_shadow_begin = shadow_begin;
+ if (!ctx->mapped_shadow_begin || ctx->mapped_shadow_begin > shadow_begin)
+ ctx->mapped_shadow_begin = shadow_begin;
if (shadow_begin < ctx->mapped_shadow_end)
shadow_begin = ctx->mapped_shadow_end;
VPrintf(2, "MapShadow begin/end = (0x%zx-0x%zx)\n",
More information about the llvm-commits
mailing list