[all-commits] [llvm/llvm-project] f831d6: tsan: fix false positive during fd close

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Tue Mar 8 01:41:12 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f831d6fc800ccf22c1c09888fce3e3c8ebc2c992
      https://github.com/llvm/llvm-project/commit/f831d6fc800ccf22c1c09888fce3e3c8ebc2c992
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_defs.h
    M compiler-rt/lib/tsan/rtl/tsan_fd.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl_access.cpp
    M compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp
    A compiler-rt/test/tsan/fd_close_race.cpp
    M compiler-rt/test/tsan/stress.cpp

  Log Message:
  -----------
  tsan: fix false positive during fd close

FdClose is a subjet to the same atomicity problem as MemoryRangeFreed
(memory state is not "monotoic" wrt race detection).
So we need to lock the thread slot in FdClose the same way we do
in MemoryRangeFreed.
This fixes the modified stress.cpp test.

Reviewed By: vitalybuka, melver

Differential Revision: https://reviews.llvm.org/D121143




More information about the All-commits mailing list