[dfsan] Support Linux AArch64
authorFangrui Song <i@maskray.me>
Tue, 3 Jan 2023 21:17:39 +0000 (13:17 -0800)
committerFangrui Song <i@maskray.me>
Tue, 3 Jan 2023 21:17:39 +0000 (13:17 -0800)
commitde5416cb59b0cffbc98f8fdfeaae67ca2495faa1
tree58a445840094b62be578c8df803f270025bdf689
parentb0cee1f4ba50f1140dfb2bd501e0d061c609f2ef
[dfsan] Support Linux AArch64

compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake:ALL_DFSAN_SUPPORTED_ARCH
allows AArch64 but currently the instrumentation will crash.

Port Linux AArch64 memory mappings from msan but use
SizeClassAllocator64 for a slightly more efficient allocator (used by
asan/lsan). Change dfsan/lit.cfg.py to allow Linux aarch64. All tests
should pass.

* dfsan/origin_invalid.c uses x86_64 assembly. Just make it x86_64 specific.
* dfsan/interceptors.c our mallinfo interceptor takes an argument
  instead of returning a struct. This does not work on AArch64 which
  uses different registers for the two function types. Disable AArch64
  as msan/Linux/mallinfo.cpp does.

Reviewed By: #sanitizers, vitalybuka

Differential Revision: https://reviews.llvm.org/D140770
compiler-rt/lib/dfsan/dfsan_allocator.cpp
compiler-rt/lib/dfsan/dfsan_platform.h
compiler-rt/test/dfsan/interceptors.c
compiler-rt/test/dfsan/lit.cfg.py
compiler-rt/test/dfsan/origin_invalid.c
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp