[all-commits] [llvm/llvm-project] d4d86f: tsan: always handle closing of file descriptors

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Tue Dec 21 04:35:48 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4d86fede8084f84ec6d4716378d977ffff3cf1d
      https://github.com/llvm/llvm-project/commit/d4d86fede8084f84ec6d4716378d977ffff3cf1d
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-12-21 (Tue, 21 Dec 2021)

  Changed paths:
    M compiler-rt/lib/tsan/rtl/tsan_fd.cpp
    M compiler-rt/lib/tsan/rtl/tsan_interceptors.h
    M compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

  Log Message:
  -----------
  tsan: always handle closing of file descriptors

If we miss both close of a file descriptor and a subsequent open
if the same file descriptor number, we report false positives
between operations on the old and on the new descriptors.

There are lots of ways to create new file descriptors, but for closing
there is mostly close call. So we try to handle at least it.
However, if the close happens in an ignored library, we miss it
and start reporting false positives.

Handle closing of file descriptors always, even in ignored libraries
(as we do for malloc/free and other critical functions).
But don't imitate memory accesses on close for ignored libraries.

FdClose checks validity of the fd (fd >= 0) itself,
so remove the excessive checks in the callers.

Reviewed By: melver

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




More information about the All-commits mailing list