[all-commits] [llvm/llvm-project] 691111: [Scudo] Make -fsanitize=scudo use standalone. Migr...

Mitch Phillips via All-commits all-commits at lists.llvm.org
Wed May 26 10:13:23 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6911114d8cbed06a8a809c34ae07f4e3e89ab252
      https://github.com/llvm/llvm-project/commit/6911114d8cbed06a8a809c34ae07f4e3e89ab252
  Author: Mitch Phillips <31459023+hctim at users.noreply.github.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

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

  Log Message:
  -----------
  [Scudo] Make -fsanitize=scudo use standalone. Migrate tests.

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.

Reviewed By: cryptoad, vitalybuka

Differential Revision: https://reviews.llvm.org/D102543




More information about the All-commits mailing list