[all-commits] [llvm/llvm-project] 2e74b6: [llvm-cov gcov] Don't require NUL terminator when ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Jul 19 00:32:12 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e74b6d80f347203ae17ec8b09e6b3e86ff6c179
      https://github.com/llvm/llvm-project/commit/2e74b6d80f347203ae17ec8b09e6b3e86ff6c179
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-07-19 (Sun, 19 Jul 2020)

  Changed paths:
    M llvm/lib/ProfileData/GCOV.cpp
    M llvm/tools/llvm-cov/gcov.cpp

  Log Message:
  -----------
  [llvm-cov gcov] Don't require NUL terminator when reading files

.gcno, .gcda and source files can be modified while we are reading them. If the
concurrent modification of a file being read nullifies the NUL terminator
assumption, llvm-cov can trip over an assertion failure in MemoryBuffer::init.
This is not so rare - the source files can be in an editor and .gcda can be
written by an running process (if the process forks, when .gcda gets written is
probably more unpredictable).

There is no accompanying test because an assertion failure requires data
races with some involved setting.




More information about the All-commits mailing list