[PATCH] D102543: [Scudo] Make -fsanitize=scudo use standalone. Migrate tests.

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 14 17:58:12 PDT 2021


hctim created this revision.
hctim added reviewers: cryptoad, pcc.
Herald added subscribers: phosek, mgorny.
hctim requested review of this revision.
Herald added projects: clang, Sanitizers.
Herald added subscribers: Sanitizers, cfe-commits.

This patch moves -fsanitize=scudo to link the standalone scudo library,
rather than the original compiler-rt based library. This is one of the
major remaining roadblocks to deleting the compiler-rt based scudo,
which should not be used any more. The standalone Scudo is better in
pretty much every way and is much more suitable for production usage.

As well as patching the litmus tests for checking that the
scudo_standalone lib is linked instead of the scudo lib, this patch also
ports all the scudo lit tests to run under scudo standalone.

This patch also adds a feature to scudo standalone that was under test
in the original scudo - that arguments passed to an aligned operator new
were checked that the alignment was a power of two.

Some lit tests could not be migrated, due to the following issues:

1. Features that aren't supported in scudo standalone, like the rss limit.
2. Different quarantine implementation where the test needs some more thought.
3. Small bugs in scudo standalone that should probably be fixed, like the Secondary allocator having a full page on the LHS of an allocation that only contains the chunk header, so underflows by <= a page aren't caught.
4. Slight differences in behaviour that's technically correct, like 'realloc(malloc(1), 0)' returns nullptr in standalone, but a real pointer in old scudo.
5. Some tests that might be migratable, but not easily.

Tests that are obviously not applicable to scudo standalone (like
testing that no sanitizer symbols made it into the DSO) have been
deleted.

After this patch, the remaining work is:

1. Update the Scudo documentation. The flags have changed, etc.
2. Delete the old version of scudo.
3. Patch up the tests in lit-unmigrated, or fix Scudo standalone.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102543

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.scudo.so
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.scudo_standalone.so
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.scudo.so
  clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.scudo_standalone.so
  clang/test/Driver/fuchsia.c
  clang/test/Driver/sanitizer-ld.c
  compiler-rt/lib/scudo/standalone/wrappers_cpp.cpp
  compiler-rt/test/scudo/CMakeLists.txt
  compiler-rt/test/scudo/aligned-new.cpp
  compiler-rt/test/scudo/alignment.c
  compiler-rt/test/scudo/dealloc-race.c
  compiler-rt/test/scudo/double-free.cpp
  compiler-rt/test/scudo/fsanitize.c
  compiler-rt/test/scudo/interface.cpp
  compiler-rt/test/scudo/lit.cfg.py
  compiler-rt/test/scudo/lit.site.cfg.py.in
  compiler-rt/test/scudo/malloc.cpp
  compiler-rt/test/scudo/memalign.c
  compiler-rt/test/scudo/mismatch.cpp
  compiler-rt/test/scudo/options.cpp
  compiler-rt/test/scudo/overflow.c
  compiler-rt/test/scudo/preinit.c
  compiler-rt/test/scudo/preload.cpp
  compiler-rt/test/scudo/quarantine.c
  compiler-rt/test/scudo/random_shuffle.cpp
  compiler-rt/test/scudo/realloc.cpp
  compiler-rt/test/scudo/rss.c
  compiler-rt/test/scudo/secondary.c
  compiler-rt/test/scudo/sized-delete.cpp
  compiler-rt/test/scudo/sizes.cpp
  compiler-rt/test/scudo/standalone/CMakeLists.txt
  compiler-rt/test/scudo/standalone/aligned-new.cpp
  compiler-rt/test/scudo/standalone/alignment.c
  compiler-rt/test/scudo/standalone/dealloc-race.c
  compiler-rt/test/scudo/standalone/double-free.cpp
  compiler-rt/test/scudo/standalone/fsanitize.c
  compiler-rt/test/scudo/standalone/lit-unmigrated/overflow.c
  compiler-rt/test/scudo/standalone/lit-unmigrated/quarantine.c
  compiler-rt/test/scudo/standalone/lit-unmigrated/realloc.cpp
  compiler-rt/test/scudo/standalone/lit-unmigrated/rss.c
  compiler-rt/test/scudo/standalone/lit-unmigrated/secondary.c
  compiler-rt/test/scudo/standalone/lit-unmigrated/sizes.cpp
  compiler-rt/test/scudo/standalone/lit-unmigrated/threads.c
  compiler-rt/test/scudo/standalone/lit-unmigrated/valloc.c
  compiler-rt/test/scudo/standalone/lit.cfg.py
  compiler-rt/test/scudo/standalone/lit.site.cfg.py.in
  compiler-rt/test/scudo/standalone/malloc.cpp
  compiler-rt/test/scudo/standalone/memalign.c
  compiler-rt/test/scudo/standalone/mismatch.cpp
  compiler-rt/test/scudo/standalone/options.cpp
  compiler-rt/test/scudo/standalone/preinit.c
  compiler-rt/test/scudo/standalone/preload.cpp
  compiler-rt/test/scudo/standalone/random_shuffle.cpp
  compiler-rt/test/scudo/standalone/sized-delete.cpp
  compiler-rt/test/scudo/standalone/stats.c
  compiler-rt/test/scudo/standalone/tsd_destruction.c
  compiler-rt/test/scudo/stats.c
  compiler-rt/test/scudo/symbols.test
  compiler-rt/test/scudo/threads.c
  compiler-rt/test/scudo/tsd_destruction.c
  compiler-rt/test/scudo/valloc.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102543.345594.patch
Type: text/x-patch
Size: 59683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210515/f8df6a47/attachment-0001.bin>


More information about the cfe-commits mailing list