This is an archive of the discontinued LLVM Phabricator instance.

[dfsan] Support Linux AArch64
ClosedPublic

Authored by MaskRay on Dec 29 2022, 7:10 PM.

Details

Reviewers
browneee
vitalybuka
Group Reviewers
Restricted Project
Commits
rGde5416cb59b0: [dfsan] Support Linux AArch64
Summary

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.

Diff Detail

Event Timeline

MaskRay created this revision.Dec 29 2022, 7:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2022, 7:10 PM
MaskRay requested review of this revision.Dec 29 2022, 7:10 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 29 2022, 7:10 PM

Copying maps from MSan LGTM.

Should this change also update test/dfsan/lit.cfg.py ?

Have you tested on aarch64? or submitting to have buildbot do it?

MaskRay updated this revision to Diff 485711.Dec 30 2022, 10:14 AM
MaskRay retitled this revision from [dfsan] Support AArch64 to [dfsan] Support Linux AArch64.
MaskRay edited the summary of this revision. (Show Details)

Fix interceptors.c (mallinfo somehow crashes.
unfortunately running the test in a debugger gives me

==939877==ERROR: DataflowSanitizer failed to allocate 0x1600000800000 (387028101365760) bytes at address 6fffff800000 (errno: 12))

Copying maps from MSan LGTM.

Should this change also update test/dfsan/lit.cfg.py ?

Have you tested on aarch64? or submitting to have buildbot do it?

Yes, I have tested ninja check-dfsan on a Ubuntu 22.04.1 aarch64 machine. All tests pass now.

If there is an aarch64 build bot testing compiler-rt, by default it shall test dfsan.

MaskRay updated this revision to Diff 485733.Dec 30 2022, 5:36 PM
MaskRay edited the summary of this revision. (Show Details)

Try using SizeClassAllocator64 (see D140792 for msan).
Change interceptors.c mallinfo to exclude aarch64 instead of only allowing x86_64.

vitalybuka accepted this revision.Dec 31 2022, 12:14 PM
This revision is now accepted and ready to land.Dec 31 2022, 12:14 PM
MaskRay edited the summary of this revision. (Show Details)Jan 3 2023, 1:16 PM
This revision was automatically updated to reflect the committed changes.