[PATCH] D94212: scudo: Add support for tracking stack traces of secondary allocations.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 20:37:18 PST 2021


pcc created this revision.
pcc added reviewers: eugenis, hctim, cryptoad.
Herald added subscribers: pengfei, jfb, kristof.beyls, mgorny.
Herald added a reviewer: jfb.
pcc requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added a subscriber: Sanitizers.

There is no centralized store of information related to secondary
allocations. Moreover the allocations themselves become inaccessible
when the allocation is freed in order to implement UAF detection,
so we can't store information there to be used in case of UAF
anyway.

Therefore our storage location for tracking stack traces of secondary
allocations is a secondary ring buffer. The ring buffer is copied to
the process creating the crash dump when a fault occurs.

In order to support the scenario where an access to the ring buffer
is interrupted by a concurrently occurring crash, the secondary
ring buffer is accessed in a lock-free manner. This requires the
use of 128-bit atomics, which are generally only supported on 64-bit
platforms. Therefore the secondary ring buffer is disabled on 32-bit
platforms. The ring buffer would be unused on such platforms anyway
due to the lack of support for memory tagging on platforms other
than arm64.

This change enables 16-byte compare-exchange instructions on x86 in
order to avoid a warning where 128-bit atomics are used. Since the code
wouldn't actually be called in production on x86 as mentioned, this is
mostly in order to provide compile-time coverage and support fuzzing.

Depends on D93731 <https://reviews.llvm.org/D93731>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94212

Files:
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/scudo/standalone/CMakeLists.txt
  compiler-rt/lib/scudo/standalone/combined.h
  compiler-rt/lib/scudo/standalone/fuzz/get_error_info_fuzzer.cpp
  compiler-rt/lib/scudo/standalone/include/scudo/interface.h
  compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
  compiler-rt/lib/scudo/standalone/wrappers_c_bionic.cpp
  llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94212.315040.patch
Type: text/x-patch
Size: 21581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210107/81962155/attachment.bin>


More information about the llvm-commits mailing list