[all-commits] [llvm/llvm-project] e8861f: sanitizer_common: fix crashes in parsing of memory...

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Fri Oct 29 05:03:25 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8861fa6c3fd785eae6f6bb7f51a3f79cd430b65
      https://github.com/llvm/llvm-project/commit/e8861fa6c3fd785eae6f6bb7f51a3f79cd430b65
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_common.h
    M compiler-rt/lib/sanitizer_common/sanitizer_procmaps_common.cpp
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_procmaps_test.cpp

  Log Message:
  -----------
  sanitizer_common: fix crashes in parsing of memory profiles

ParseUnixMemoryProfile assumes well-formed input with \n at the end, etc.
It can over-read the input and crash on basically every line
in the case of malformed input.
ReadFileToBuffer has cap the max file size (64MB) and returns
truncated contents if the file is larger. Thus even if kernel behaves,
ParseUnixMemoryProfile crashes on too large /proc/self/smaps.
Fix input over-reading in ParseUnixMemoryProfile.

Depends on D112792.

Reviewed By: melver

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




More information about the All-commits mailing list