scudo: Add support for diagnosing memory errors when memory tagging is enabled.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 28 Jan 2020 02:43:46 +0000 (18:43 -0800)
committerPeter Collingbourne <peter@pcc.me.uk>
Sat, 18 Apr 2020 00:26:30 +0000 (17:26 -0700)
commit21d50019ca83765a655b3d67331dfb83cf3d260d
tree8c29bcfb6ddcceec95dc733ab02fe059752a1f90
parent91a6bfed61631b23deabad9986ac29b74d7491ea
scudo: Add support for diagnosing memory errors when memory tagging is enabled.

Introduce a function __scudo_get_error_info() that may be called to interpret
a crash resulting from a memory error, potentially in another process,
given information extracted from the crashing process. The crash may be
interpreted as a use-after-free, buffer overflow or buffer underflow.

Also introduce a feature to optionally record a stack trace for each
allocation and deallocation. If this feature is enabled, a stack trace for
the allocation and (if applicable) the deallocation will also be available
via __scudo_get_error_info().

Differential Revision: https://reviews.llvm.org/D77283
14 files changed:
compiler-rt/lib/CMakeLists.txt
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/common.h
compiler-rt/lib/scudo/standalone/fuchsia.cpp
compiler-rt/lib/scudo/standalone/fuzz/CMakeLists.txt [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/include/scudo/interface.h
compiler-rt/lib/scudo/standalone/linux.cpp
compiler-rt/lib/scudo/standalone/memtag.h
compiler-rt/lib/scudo/standalone/primary32.h
compiler-rt/lib/scudo/standalone/primary64.h
compiler-rt/lib/scudo/standalone/stack_depot.h [new file with mode: 0644]
compiler-rt/lib/scudo/standalone/wrappers_c.inc
compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp