[all-commits] [llvm/llvm-project] c05095: [Asan] Don't crash if metadata is not initialized

Vitaly Buka via All-commits all-commits at lists.llvm.org
Tue Sep 8 13:58:58 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c05095cd6865a95ee848cd95d11643969a81a241
      https://github.com/llvm/llvm-project/commit/c05095cd6865a95ee848cd95d11643969a81a241
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2020-09-08 (Tue, 08 Sep 2020)

  Changed paths:
    M compiler-rt/lib/asan/asan_allocator.cpp
    A compiler-rt/test/asan/TestCases/lsan_crash.cpp

  Log Message:
  -----------
  [Asan] Don't crash if metadata is not initialized

Fixes https://github.com/google/sanitizers/issues/1193.

AsanChunk can be uninitialized yet just after return from the secondary
allocator. If lsan starts scan just before metadata assignment it can
fail to find corresponding AsanChunk.

It should be safe to ignore this and let lsan to assume that
AsanChunk is in the beginning of the block. This block is from the
secondary allocator and created with mmap, so it should not contain
any pointers and will make lsan to miss some leaks.

Similar already happens for primary allocator. If it can't find real
AsanChunk it falls back and assume that block starts with AsanChunk.
Then if the block is already returned to allocator we have  garbage in
AsanChunk and may scan dead memory hiding some leaks.
I'll fix this in D87135.

Reviewed By: morehouse

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




More information about the All-commits mailing list