Skip to content

Commit

Permalink
tsan: fix bug in shadow reset introduced in D128909
Browse files Browse the repository at this point in the history
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
  • Loading branch information
thanm committed Aug 5, 2022
1 parent 019d761 commit 24a62bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler-rt/lib/tsan/rtl/tsan_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 24a62bf

Please sign in to comment.