[PATCH] D86694: [scudo] Allow -fsanitize=scudo on Linux and Windows (WIP, don't land as is)

Russell Gallop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 09:14:13 PST 2020


russell.gallop updated this revision to Diff 312827.
russell.gallop edited the summary of this revision.
russell.gallop added a comment.

Apologies for the delay, I've had other things taking my time.

Latest version uploaded. This fixes stage1 lit tests (on Windows and Linux) and adds scudo_cxx to linking.

Usage has changed slightly, now -DLLVM_INTEGRATED_CRT_ALLOC should point to the directory with scudo built libraries (e.g. c:/git/llvm-project/stage1/lib/clang/12.0.0/lib/windows) rather than the library itself. -fsanitize=scudo works for the lit tests (as clang adds the libraries when driving the linker) but doesn't work for building LLVM as cmake links with the linker directly so this uses LLVM_INTEGRATED_CRT_ALLOC.

There are two issues I'm aware of now:

- Linking c-index-test.exe with scudo fails due to new being redefined

  lld-link: error: void * __cdecl operator new(unsigned __int64) was replaced

Or from link.exe

  clang_rt.scudo_cxx-x86_64.lib(scudo_new_delete.cpp.obj) : error LNK2005: "void * __cdecl operator new(unsigned __int64)" (??2 at YAPEAX_K@Z) already defined in libclang.lib(libclang.dll)
  ...



- With scudo all lit tests (generally) pass, but there are some intermittent failures (Access Violation) on the following tests:

> ExecutionEngine/MCJIT/test-global-init-nonzero-sm-pic.ll
> ExecutionEngine/MCJIT/test-ptr-reloc-sm-pic.ll
> ExecutionEngine/MCJIT/multi-module-sm-pic-a.ll

This happens with VS2019 or clang-cl as the toolchain. I've run multiple times without scudo and don't see these. Unfortunately I haven't been able to get this to fail in a debugger.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86694/new/

https://reviews.llvm.org/D86694

Files:
  clang/lib/Driver/ToolChains/MSVC.cpp
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
  compiler-rt/lib/scudo/CMakeLists.txt
  compiler-rt/lib/scudo/scudo_allocator.cpp
  compiler-rt/lib/scudo/scudo_crc32.cpp
  compiler-rt/lib/scudo/scudo_new_delete.cpp
  compiler-rt/lib/scudo/scudo_platform.h
  compiler-rt/lib/scudo/scudo_tsd.h
  compiler-rt/lib/scudo/scudo_tsd_shared.cpp
  compiler-rt/lib/scudo/scudo_tsd_shared.inc
  compiler-rt/test/scudo/cxx_threads.cpp
  compiler-rt/test/scudo/dealloc-race.c
  compiler-rt/test/scudo/fsanitize.c
  compiler-rt/test/scudo/interface.cpp
  compiler-rt/test/scudo/lit.cfg.py
  compiler-rt/test/scudo/malloc.cpp
  compiler-rt/test/scudo/memalign.c
  compiler-rt/test/scudo/mismatch.cpp
  compiler-rt/test/scudo/overflow.c
  compiler-rt/test/scudo/preload.cpp
  compiler-rt/test/scudo/rss.c
  compiler-rt/test/scudo/secondary.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
  llvm/CMakeLists.txt
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/lib/Support/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86694.312827.patch
Type: text/x-patch
Size: 28562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201218/dbeab6ab/attachment-0001.bin>


More information about the llvm-commits mailing list