- Jul 28, 2020
-
-
Julian Lettner authored
Checking the OS version via `GetMacosAlignedVersion()` now works in simulators [1]. Let's use it to simplify `DyldNeedsEnvVariable()`. [1] 3fb0de82 Reviewed By: delcypher Differential Revision: https://reviews.llvm.org/D81197
-
Julian Lettner authored
compiler-rt checks OS versions by querying the Darwin kernel version. This is not necessarily correct inside the simulators if the simulator runtime is not aligned with the host macOS. Let's instead check the `SIMULATOR_RUNTIME_VERSION` env var. rdar://63031937 Reviewed By: delcypher Differential Revision: https://reviews.llvm.org/D83977
-
Arthur Eubanks authored
In a build with -DLLVM_ENABLE_LTO=Thin: $ ninja TSanitizer-x86_64-Test-Nolibc [1/1] Generating Sanitizer-x86_64-Test-Nolibc FAILED: projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc sanitizer_nolibc_test_main.x86_64.o: file not recognized: file format not recognized because -flto=thin is getting passed to the clang_compile step. For non-standalone builds, global compilation flags shouldn't be passed to compiler-rt tests, only the flags the test specifies. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D84466
-
Rainer Orth authored
Neither the Illumos `ld` nor the Solaris 11.3 one support the `--version-script` and `z gnu-linker-script-compat` options, which breaks the `compiler-rt` build. This patch checks for both options instead of hardcoding their use. Tested on `amd-pc-solaris2.11` (all of Solaris 11.4, 11.3, and Illumos). Differential Revision: https://reviews.llvm.org/D84559
-
Hans Wennborg authored
make_unique is a C++14 feature, and this prevents us from building on Ubuntu Trusty. While we do use a C++14 compatible toolchain for building in general, we fall back to the system toolchain for building the compiler-rt tests. The reason is that those tests get cross-compiled for e.g. 32-bit and 64-bit x86, and while the toolchain provides libstdc++ in those flavours, the resulting compiler-rt test binaries don't get RPATH set and so won't start if they're linked with that toolchain. We've tried linking the test binaries against libstdc++ statically, by passing COMPILER_RT_TEST_COMPILER_CFLAGS=-static-libstdc++. That mostly works, but some test targets append -lstdc++ to the compiler invocation. So, after spending way too much time on this, let's just avoid C++14 here for now.
-
- Jul 27, 2020
-
-
Sergej Jaskiewicz authored
The commit 8372d505 has been reverted (eafeb8af) because it broke asan tests on green dragon buildbots. The underlying issue has been fixed in 4dd5c2be.
-
Matt Morehouse authored
This adds a new extern "C" function that serves the same purpose. This removes the need for external users to depend on internal headers in order to use this feature. It also standardizes the interface in a way that other fuzzing engines will be able to match. Patch By: IanPudney Reviewed By: kcc Differential Revision: https://reviews.llvm.org/D84561
-
Dokyung Song authored
Recommit "[libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given." Summary: This patch disables implicit builtin knowledge about memcmp-like functions when compiling the program for fuzzing, i.e., when -fsanitize=fuzzer(-no-link) is given. This allows libFuzzer to always intercept memcmp-like functions as it effectively disables optimizing calls to such functions into different forms. This is done by adding a set of flags (-fno-builtin-memcmp and others) in the clang driver. Individual -fno-builtin-* flags previously used in several libFuzzer tests are now removed, as it is now done automatically in the clang driver. The patch was once reverted in 8ef9e2bf, as this patch was dependent on a reverted commit f78d9fce. This reverted commit was recommitted in 831ae45e, so relanding this dependent patch too. Reviewers: morehouse, hctim Subscribers: cfe-commits, #sanitizers Tags: #clang, #sanitizers Differential Revision: https://reviews.llvm.org/D83987
-
Mitch Phillips authored
Summary: Fix up a slight bug with the crash handler API, where we say that we return the size of the collected trace (instead of the size of the trace that's returned) when the return buffer is too small, and the result is truncated. Also, as a result, patch up a small uninitialized memory bug. Reviewers: morehouse, eugenis Reviewed By: eugenis Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84652
-
Mitch Phillips authored
Fix up a small bug where we used a partially-uninitialized sigaction struct in the optional signal handler. Shouldn't be a user-visible change.
-
Hans Wennborg authored
-
- Jul 26, 2020
-
-
Alex Richardson authored
Like Android, FreeBSDs libc calls memchr which causes this test to fail. Reviewed By: emaste Differential Revision: https://reviews.llvm.org/D84541
-
- Jul 24, 2020
-
-
Jinsong Ji authored
We added -nostdinc++ to clang_rt.profile in https://reviews.llvm.org/D84205. This will cause warnings when building with LLVM_ENABLE_LIBCXX, and failure if with Werror on. This patch is to fix it by removing unused -stdlib, similar to what we have done in https://reviews.llvm.org/D42238. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D84543
-
Jon Roelofs authored
It broke one of the buildbots: http://lab.llvm.org:8080/green/job/clang-stage1-RA/13026/console
-
Kostya Kortchinsky authored
Summary: On 32-b, the release algo loops multiple times over the freelist for a size class, which lead to a decrease in performance when there were a lot of free blocks. This changes the release functions to loop only once over the freelist, at the cost of using a little bit more memory for the release process: instead of working on one region at a time, we pass the whole memory area covered by all the regions for a given size class, and work on sub-areas of `RegionSize` in this large area. For 64-b, we just have 1 sub-area encompassing the whole region. Of course, not all the sub-areas within that large memory area will belong to the class id we are working on, but those will just be left untouched (which will not add to the RSS during the release process). Reviewers: pcc, cferris, hctim, eugenis Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D83993
-
Dokyung Song authored
Summary: This patch disables (i) noasan-memcmp64.test on Windows as libFuzzer's interceptors are only supported on Linux for now, and (ii) bcmp.test as on Windows bcmp is not available in strings.h. Reviewers: morehouse, hctim, kcc Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84536
-
Fangrui Song authored
If we define memcmp in an archive, bcmp should be defined as well (many libc define bcmp/memcmp in one object file). Otherwise if the application calls bcmp or strcmp which gets optimized to bcmp (SimplifyLibCalls), the undefined reference may pull in an optimized bcmp/strcmp implementation (libc replacement) later on the linker command line. If both libFuzzer's memcmp and the optimized memcmp are strong => there will be a multiple definition error.
-
Petr Hosek authored
Rather than handling zlib handling manually, use find_package from CMake to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB, HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is set to YES, which requires the distributor to explicitly select whether zlib is enabled or not. This simplifies the CMake handling and usage in the rest of the tooling. This is a reland of abb00753 with all followup changes and fixes that should address issues that were reported in PR44780. Differential Revision: https://reviews.llvm.org/D79219
-
Mitch Phillips authored
This reverts commit 22a376e7.
-
Dokyung Song authored
Summary: FuzzerInterceptors.cpp includes <sanitizer/common_interface_defs.h>, and this patch adds a missing include_directories to make sure the included file is found. Reviewers: morehouse, hctim, dmajor Subscribers: mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84474
-
Petr Hosek authored
This reverts commit 1d09ecf3 since it breaks sanitizer bots.
-
Peter Collingbourne authored
This guarantees that we will detect a buffer overflow or underflow that overwrites an adjacent block. This spatial guarantee is similar to the temporal guarantee that we provide for immediate use-after-free. Enabling odd/even tags involves a tradeoff between use-after-free detection and buffer overflow detection. Odd/even tags make it more likely for buffer overflows to be detected by increasing the size of the guaranteed "red zone" around the allocation, but on the other hand use-after-free is less likely to be detected because the tag space for any particular chunk is cut in half. Therefore we introduce a tuning setting to control whether odd/even tags are enabled. Differential Revision: https://reviews.llvm.org/D84361
-
- Jul 23, 2020
-
-
Petr Hosek authored
Rather than handling zlib handling manually, use find_package from CMake to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB, HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is set to YES, which requires the distributor to explicitly select whether zlib is enabled or not. This simplifies the CMake handling and usage in the rest of the tooling. This is a reland of abb00753 with all followup changes and fixes that should address issues that were reported in PR44780. Differential Revision: https://reviews.llvm.org/D79219
-
Matt Morehouse authored
Support fast16labels in `dfsan_has_label`, and print an error for all other API functions. For `dfsan_dump_labels` we return silently rather than crashing since it is also called from the atexit handler where it is undefined behavior to call exit() again. Reviewed By: kcc Differential Revision: https://reviews.llvm.org/D84215
-
Peter Collingbourne authored
Differential Revision: https://reviews.llvm.org/D84454
-
Mitch Phillips authored
Summary: Allows other-language libFuzzer derivatives to invoke the driver. Patch By: Ian Eldred Pudney <ipudney@google.com> Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84425
-
Matt Morehouse authored
This reverts commit 19d9c039 due to buildbot failure.
-
Dokyung Song authored
Summary: libFuzzer's interceptor support added in 831ae45e currently only works on Linux. This patch disables the test cases added as part of that commit on non-Linux platforms. Reviewers: morehouse, hctim Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84434
-
Gui Andrade authored
-
Dokyung Song authored
Recommit "[libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked." Summary: libFuzzer intercepts certain library functions such as memcmp/strcmp by defining weak hooks. Weak hooks, however, are called only when other runtimes such as ASan is linked. This patch defines libFuzzer's own interceptors, which is linked into the libFuzzer executable when other runtimes are not linked, i.e., when -fsanitize=fuzzer is given, but not others. The patch once landed but was reverted in 8ef9e2bf due to an assertion failure caused by calling an intercepted function, strncmp, while initializing the interceptors in fuzzerInit(). This issue is now fixed by calling libFuzzer's own implementation of library functions (i.e., internal_*) when the fuzzer has not been initialized yet, instead of recursively calling fuzzerInit() again. Reviewers: kcc, morehouse, hctim Subscribers: #sanitizers, krytarowski, mgorny, cfe-commits Tags: #clang, #sanitizers Differential Revision: https://reviews.llvm.org/D83494
-
Matt Morehouse authored
-
Rainer Orth authored
A last-minute silent change in D84046 <https://reviews.llvm.org/D84046> broke the Solaris buildbots (Solaris/sparcv9 <http://lab.llvm.org:8014/builders/clang-solaris11-sparcv9/builds/6772>, Solaris/amd64 <http://lab.llvm.org:8014/builders/clang-solaris11-amd64/builds/5434>): [2/3679] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o FAILED: projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o /opt/llvm-buildbot/bin/c++ -DHAVE_RPC_XDR_H=1 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/sanitizer_common -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common -Iinclude -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/Support/Solaris -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3 -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -UNDEBUG -std=c++14 -MD -MT projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o -MF projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o.d -o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o -c /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:50:16: error: conflicting declaration of C function ‘int madvise(caddr_t, std::size_t, int)’ extern "C" int madvise(caddr_t, size_t, int); ^~~~~~~ In file included from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:32:0: /usr/include/sys/mman.h:232:12: note: previous declaration ‘int madvise(void*, std::size_t, int)’ extern int madvise(void *, size_t, int); ^~~~~~~ This patch undoes that change. Tested on `amd64-pc-solaris2.11` (Solaris 11.4 and OpenIndiana). Differential Revision: https://reviews.llvm.org/D84388
-
Fangrui Song authored
A malloc implementation may return a pointer to some allocated space. It is undefined for libclang_rt.profile- to access the object - which actually happens in instrumentTargetValueImpl, where ValueCounters[CounterIndex] may access a ValueProfNode (from another allocated object) and crashes when the code accesses the object referenced by CurVNode->Next.
-
Logan Smith authored
Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories." add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it. Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
-
Matt Morehouse authored
Summary: Support fast16labels in `dfsan_has_label`, and print an error for all other API functions. Reviewers: kcc, vitalybuka, pcc Reviewed By: kcc Subscribers: jfb, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84215
-
Fangrui Song authored
This reverts commit 4a539faf. There is a __llvm_profile_instrument_range related crash in PGO-instrumented clang: ``` (gdb) bt llvm::ConstantRange const&, llvm::APInt const&, unsigned int, bool) () llvm::ScalarEvolution::getRangeForAffineAR(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, unsigned int) () ``` (The body of __llvm_profile_instrument_range is inlined, so we can only find__llvm_profile_instrument_target in the trace) ``` 23│ 0x000055555dba0961 <+65>: nopw %cs:0x0(%rax,%rax,1) 24│ 0x000055555dba096b <+75>: nopl 0x0(%rax,%rax,1) 25│ 0x000055555dba0970 <+80>: mov %rsi,%rbx 26│ 0x000055555dba0973 <+83>: mov 0x8(%rsi),%rsi # %rsi=-1 -> SIGSEGV 27│ 0x000055555dba0977 <+87>: cmp %r15,(%rbx) 28│ 0x000055555dba097a <+90>: je 0x55555dba0a76 <__llvm_profile_instrument_target+342> ```
-
Logan Smith authored
Revert "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories." This reverts commit 388c9fb1.
-
- Jul 22, 2020
-
-
Logan Smith authored
Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories. Using add_compile_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
-
Andrew Grieve authored
Summary: Came up in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1103108#c21 Reviewers: eugenis Reviewed By: eugenis Subscribers: #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D84237
-
Louis Dionne authored
This upgrade should be friction-less because we've already been ensuring that CMake >= 3.13.4 is used. This is part of the effort discussed on llvm-dev here: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html Differential Revision: https://reviews.llvm.org/D78648
-