Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 29 May 2015 22:31:28 +0000 (22:31 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 29 May 2015 22:31:28 +0000 (22:31 +0000)
commit8e9c70be7fc52db0a08d58ecfa29d33dd505a957
tree941722642a9e981cdfd8ac196cbfef6f1fb338e5
parent2cfd9d574d8f75491a5054116bae1f52fc75748c
Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.

This is done by creating a named shared memory region, unlinking it
and setting up a private (i.e. copy-on-write) mapping of that instead
of a regular anonymous mapping. I've experimented with regular
(sparse) files, but they can not be scaled to the size of MSan shadow
mapping, at least on Linux/X86_64 and ext3 fs.

Controlled by a common flag, decorate_proc_maps, disabled by default.

This patch has a few shortcomings:
* not all mappings are annotated, especially in TSan.
* our handling of memset() of shadow via mmap() puts small anonymous
  mappings inside larger named mappings, which looks ugly and can, in
  theory, hit the mapping number limit.

llvm-svn: 238621
20 files changed:
compiler-rt/cmake/config-ix.cmake
compiler-rt/lib/asan/CMakeLists.txt
compiler-rt/lib/asan/asan_internal.h
compiler-rt/lib/asan/asan_poisoning.h
compiler-rt/lib/asan/asan_rtl.cc
compiler-rt/lib/asan/tests/CMakeLists.txt
compiler-rt/lib/msan/msan_linux.cc
compiler-rt/lib/sanitizer_common/sanitizer_common.h
compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
compiler-rt/lib/sanitizer_common/sanitizer_posix.cc
compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc
compiler-rt/lib/sanitizer_common/sanitizer_win.cc
compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
compiler-rt/lib/tsan/go/buildgo.sh
compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
compiler-rt/lib/tsan/rtl/tsan_rtl.cc
compiler-rt/lib/tsan/rtl/tsan_rtl.h
compiler-rt/test/sanitizer_common/TestCases/Posix/decorate_proc_maps.cc [new file with mode: 0644]
compiler-rt/test/sanitizer_common/TestCases/Posix/lit.local.cfg [new file with mode: 0644]
compiler-rt/test/sanitizer_common/lit.common.cfg