[dfsan] Add origin chain utils
authorJianzhou Zhao <jianzhouzh@google.com>
Fri, 5 Feb 2021 18:06:14 +0000 (18:06 +0000)
committerJianzhou Zhao <jianzhouzh@google.com>
Thu, 11 Feb 2021 19:10:11 +0000 (19:10 +0000)
commit2d9c6e10e92e983fb3ad497f29bea697a94c935a
tree272b253d34f374a2a9e9418af1687c11bb9419c7
parente3c6fa36119ea428b17cef468e4aceee786433bf
[dfsan] Add origin chain utils

This is a part of https://reviews.llvm.org/D95835.

The design is based on MSan origin chains.

An 4-byte origin is a hash of an origin chain. An origin chain is a
pair of a stack hash id and a hash to its previous origin chain. 0 means
no previous origin chains exist. We limit the length of a chain to be
16. With origin_history_size = 0, the limit is removed.

The change does not have any test cases yet. The following change
will be adding test cases when the APIs are used.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96160
compiler-rt/lib/dfsan/CMakeLists.txt
compiler-rt/lib/dfsan/dfsan.cpp
compiler-rt/lib/dfsan/dfsan.h
compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp [new file with mode: 0644]
compiler-rt/lib/dfsan/dfsan_chained_origin_depot.h [new file with mode: 0644]
compiler-rt/lib/dfsan/dfsan_flags.h [new file with mode: 0644]
compiler-rt/lib/dfsan/dfsan_flags.inc
compiler-rt/lib/dfsan/dfsan_origin.h [new file with mode: 0644]