summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
* [RISCV-V] Provide muldi3 builtin assembly implementationkamlesh kumar2020-06-253-19/+46
| | | | | | | | | | Provides an assembly implementation of muldi3 for RISC-V, to solve bug 43388. Since the implementation is the same as for mulsi3, that code was moved to `riscv/int_mul_impl.inc` and is now reused by both `mulsi3.S` and `muldi3.S`. Differential Revision: https://reviews.llvm.org/D80465 (cherry picked from commit e31ccee1b01acf703889312ee86023ff87bd39fe)
* [compiler-rt] Reduce the number of threads in gcov test to avoid failureCalixte Denizet2020-06-231-15/+5
| | | | | | | | | | | | | | | | | | | | Summary: Patch in D78477 introduced a new test for gcov and this test is failing on arm: - http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-full-sh/builds/4752/steps/ninja%20check%202/logs/stdio - http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/10501/steps/ninja%20check%202/logs/stdio So try to fix it in reducing the number of threads. Reviewers: marco-c Reviewed By: marco-c Subscribers: dberris, kristof.beyls, #sanitizers, serge-sans-paille, sylvestre.ledru Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D79621 (cherry picked from commit 0da37bedc2667da371eda30595a06210595881d0)
* [profile] Don't crash when forking in several threadsCalixte Denizet2020-05-073-2/+98
| | | | | | | | | | | | | | | | | | | Summary: When forking in several threads, the counters were written out in using the same global static variables (see GCDAProfiling.c): that leads to crashes. So when there is a fork, the counters are resetted in the child process and they will be dumped at exit using the interprocess file locking. When there is an exec, the counters are written out and in case of failures they're resetted. Reviewers: jfb, vsk, marco-c, serge-sans-paille Reviewed By: marco-c, serge-sans-paille Subscribers: llvm-commits, serge-sans-paille, dmajor, cfe-commits, hiraditya, dexonsmith, #sanitizers, marco-c, sylvestre.ledru Tags: #sanitizers, #clang, #llvm Differential Revision: https://reviews.llvm.org/D78477 (cherry picked from commit bec223a9bc4eb9747993ee9a4c1aa135c32123e6)
* Revert abb00753 "build: reduce CMake handling for zlib" (PR44780)Hans Wennborg2020-03-031-1/+1
| | | | | | | | | | | | | and follow-ups: a2ca1c2d "build: disable zlib by default on Windows" 2181bf40 "[CMake] Link against ZLIB::ZLIB" 1079c68a "Attempt to fix ZLIB CMake logic on Windows" This changed the output of llvm-config --system-libs, and more importantly it broke stand-alone builds. Instead of piling on more fix attempts, let's revert this to reduce the risk of more breakages. (cherry picked from commit 916be8fd6a0a0feea4cefcbeb0c22c65848d7a2e)
* Revert "[compiler-rt] Add a critical section when flushing gcov counters"Hans Wennborg2020-02-261-24/+1
| | | | | | See the discussion on PR44792. This reverts commit 02ce9d8ef5a84bc884de4105eae5f8736ef67634.
* [TSan] Ensure we can compile the runtime with older SDKsJulian Lettner2020-02-051-1/+8
| | | | | | | | | | | | | | | | | | | | | One of my changes [1] included in this release silently bumped the minimal macOS SDK required for building the TSan runtime to SDK 10.12. Let's ensure release 10 does not unexpectedly break builders with old SDKs and add proper minimal SDK checking in CMake for subsequent releases. This fix `#ifdef`s out interceptors for newer APIs. Note that the resulting TSan runtime is less complete: when these newer APIs are used TSan will report false positives. Fixes llvm 10 release blocker: #44682 https://bugs.llvm.org/show_bug.cgi?id=44682 [1] 894abb46f891cba2e0ef581650f27f512a7824b4 Reviewed By: dmajor Differential Revision: https://reviews.llvm.org/D74059
* [scudo][standalone] Fork supportKostya Kortchinsky2020-01-1418-42/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: fork() wasn't well (or at all) supported in Scudo. This materialized in deadlocks in children. In order to properly support fork, we will lock the allocator pre-fork and unlock it post-fork in parent and child. This is done via a `pthread_atfork` call installing the necessary handlers. A couple of things suck here: this function allocates - so this has to be done post initialization as our init path is not reentrance, and it doesn't allow for an extra pointer - so we can't pass the allocator we are currently working with. In order to work around this, I added a post-init template parameter that gets executed once the allocator is initialized for the current thread. Its job for the C wrappers is to install the atfork handlers. I reorganized a bit the impacted area and added some tests, courtesy of cferris@ that were deadlocking prior to this fix. Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D72470
* [profile] Support merge pool size >= 10Fangrui Song2020-01-122-19/+34
| | | | | | | | | | | The executable acquires an advisory record lock (`fcntl(fd, F_SETLKW, *)`) on a profile file. Merge pool size >= 10 may be beneficial when the concurrency is large. Also fix a small problem about snprintf. It can cause the filename to be truncated after %m. Reviewed By: davidxl Differential Revision: https://reviews.llvm.org/D71970
* Summary: update macro for OFF_T so that sanitizer works on AARCH64.Lirong Yuan2020-01-105-12/+5
| | | | | | | | | | | | Reviewers: vitalybuka, eugenis, MaskRay Reviewed By: eugenis, MaskRay Subscribers: MaskRay, kristof.beyls, #sanitizers, llvm-commits, jkz, scw Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D72367
* [cfi][test] cross-dso/stats.cpp: don't assume the order of static constructorsFangrui Song2020-01-081-4/+4
| | | | | | | | __sanitizer_stat_init is called for the executable first, then the shared object. In WriterModuleReport(), the information for the shared object will be recorded first. It'd be nice to get rid of the order requirement of static constructors. (This should make .ctors platforms work.)
* [msan] Fix underflow in qsort interceptor.Evgenii Stepanov2020-01-062-10/+21
|
* [msan] Check qsort input.Evgenii Stepanov2020-01-062-0/+19
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [compiler-rt] [netbsd] Switch to syscall for ThreadSelfTlsTcb()Kamil Rytarowski2020-01-031-11/+2
| | | | | This change avoids using internal, namespaced per-CPU calls that are not a stable interface to read the TSL base value.
* build: reduce CMake handling for zlibSaleem Abdulrasool2020-01-021-1/+1
| | | | | | | | | | | | | 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 restores 68a235d07f9e7049c7eb0c8091f37e385327ac28, e6c7ed6d2164a0659fd9f6ee44f1375d301e3cad. The problem with the windows bot is a need for clearing the cache.
* Check for aarch64 when not using .init_arraysSterling Augustine2020-01-021-2/+2
| | | | | | | | | | Reviewers: vvereschaka Subscribers: kristof.beyls, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D72005
* Revert "build: reduce CMake handling for zlib"James Henderson2020-01-021-1/+1
| | | | | | | This reverts commit 68a235d07f9e7049c7eb0c8091f37e385327ac28. This commit broke the clang-x64-windows-msvc build bot and a follow-up commit did not fix it. Reverting to fix the bot.
* build: reduce CMake handling for zlibSaleem Abdulrasool2020-01-011-1/+1
| | | | | | | | | 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.
* [CMake] Fix lld detection after D69685Fangrui Song2019-12-281-1/+1
| | | | | | | | | | | | | | | | | | | D69685 actually broke lld detection for my build (probably due to CMake processing order). Before: ``` build projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc: ... bin/clang || ... ``` After: ``` build projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc: ... bin/clang bin/lld || ... ``` Differential Revision: https://reviews.llvm.org/D71950
* [sanitizer] Link Sanitizer-x86_64-Test-Nolibc with -staticFangrui Song2019-12-271-1/+1
| | | | | | | | | | | Pass -static so that clang will not pass -Wl,--dynamic-linker,... to the linker. The test is not expected to run under a ld.so. (Technically it works under a ld.so but glibc expects to see a PT_DYNAMIC. lld intentionally does not follow GNU ld's complex rules regarding PT_DYNAMIC.) This allows commit 1417558e4a61794347c6bfbafaff7cd96985b2c3 to be relanded.
* Support powerpc and sparc when building without init_array.Sterling Augustine2019-12-271-7/+25
| | | | | | | | | | | | Summary: Support powerpc and sparc when building without init_array. Reviewers: rdhindsa, gribozavr Subscribers: jyknight, nemanjai, fedor.sergeev, jsji, shchenz, steven.zhang, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71944
* Reland "[msan] Intercept qsort, qsort_r."Reid Kleckner2019-12-273-0/+165
| | | | | | | This reverts commit 8fcce5ac73d49981656d9126e6c88391c1f6bf01. I spoke too soon, the revert does not actually cause the startup crash to go away.
* Revert "[msan] Intercept qsort, qsort_r."Reid Kleckner2019-12-273-165/+0
| | | | | | | | | | | | | | | | | | | This reverts commit 7a9ebe95125ea87a494d0c18f44f10bd70e12188, and dependent commit 54c522420347e58aa7bae1892cf5c5672b57c875, which disables qsort interception for some iOS platforms. After this change, the -Nolibc sanitizer common test binary crashes on startup on my regular Linux workstation, as well as on our bots: https://ci.chromium.org/p/chromium/builders/try/linux_upload_clang/740 ******************** Failing Tests (1): SanitizerCommon-Unit :: ./Sanitizer-x86_64-Test/SanitizerCommon.NolibcMain Loading it up in gdb shows that it crashes during relocation processing, which suggests that some glibc loader versions do not support the THREADLOCAL data added in this interceptor.
* [compiler-rt] [netbsd] Add support for versioned statvfs interceptorsKamil Rytarowski2019-12-274-1/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for NetBSD 9.0 and newer versions of interceptors operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo, getvfsstat, statvfs, statvfs1. The default promoted interceptors are for NetBSD 9.99.26. Older ones (currently 9.0) are kept in a new NetBSD specific file: /sanitizer_common_interceptors_netbsd_compat.inc. This file defines compat interceptors and mangles `INIT_*` macros, concatenating the current interceptors and the compat ones. This redefinition is not elegant, but it avoids preprocessor madness. Define struct_statvfs90_sz for the compat purposes. Reviewers: mgorny, kcc, vitalybuka, joerg Reviewed By: mgorny Subscribers: dberris, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71700
* Temporarily Revert "[compiler-rt] [netbsd] Add support for versioned statvfs ↵Eric Christopher2019-12-264-176/+1
| | | | | | | | | | | interceptors" as it's failing the netbsd specific linter parts of the sanitizer linter: llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_netbsd_compat.inc:23: Lines should be <= 80 characters long [whitespace/line_length] llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp:2450: Do not use variable-length arrays. Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size. This reverts commit 78f714f824fac8aa3fdd85908c41538bccefb959.
* [compiler-rt] [netbsd] Add support for versioned statvfs interceptorsKamil Rytarowski2019-12-274-1/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add support for NetBSD 9.0 and newer versions of interceptors operating on struct statvfs: fstatvfs, fstatvfs1, getmntinfo, getvfsstat, statvfs, statvfs1. The default promoted interceptors are for NetBSD 9.99.26. Older ones (currently 9.0) are kept in a new NetBSD specific file: /sanitizer_common_interceptors_netbsd_compat.inc. This file defines compat interceptors and mangles `INIT_*` macros, concatenating the current interceptors and the compat ones. This redefinition is not elegant, but it avoids preprocessor madness. Define struct_statvfs90_sz for the compat purposes. Reviewers: mgorny, kcc, vitalybuka, joerg Reviewed By: mgorny Subscribers: dberris, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71700
* Revert "[msan] Check qsort input."Evgenii Stepanov2019-12-262-23/+0
| | | | | | | | | | | | | This change breaks LLVM bootstrap with ASan and MSan. FAILED: lib/ToolDrivers/llvm-lib/Options.inc OptParser.td:137:1: error: Option is equivalent to def INPUT : Option<[], "<input>", KIND_INPUT>; ^ OptParser.td:137:1: error: Other defined here def INPUT : Option<[], "<input>", KIND_INPUT>; This reverts commit caa48a6b88aeed8ae80e6ddb1eae8c6a7cbe260b.
* [compiler-rt] Disable QSORT interception on watchOS and tvOS.Florian Hahn2019-12-261-1/+14
| | | | | | | | | | Building the sanitizers for watchOS currently fails with sanitizer_common_interceptors.inc:9656:8: error: thread-local storage is not supported for the current target static THREADLOCAL SIZE_T qsort_size; I've also speculatively disabled QSORT interception for tvOS to unblock failing builds. I'll ask someone with more sanitizer knowledge to check after the holidays.
* [compiler-rt] [netbsd] Correct the fallback definition of PT_LWPNEXTKamil Rytarowski2019-12-251-2/+2
| | | | Fixes build on NetBSD 9.0.
* [compiler-rt] [netbsd] Define _RTLD_SOURCE to fix buildKamil Rytarowski2019-12-251-0/+4
| | | | | The TLS base (LWP private pointer) functions are namespaced and hidden i.e. inside the _RTLD_SOURCE namespace.
* [compiler-rt] Adapt for ptrace(2) changes in NetBSD-9.99.30Kamil Rytarowski2019-12-245-3/+64
| | | | | Enable compat support for now legacy PT_LWPINFO. Support PT_LWPSTATUS and PT_LWPNEXT.
* [compiler-rt] Adapt stop-the-world for ptrace changes in NetBSD-9.99.30Kamil Rytarowski2019-12-241-2/+10
| | | | Handle PT_LWPNEXT for newer kernels and keep PT_LWPINFO for older ones.
* [msan] Check qsort input.Evgenii Stepanov2019-12-232-0/+23
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [msan] Intercept qsort, qsort_r.Evgenii Stepanov2019-12-233-0/+152
| | | | | | | | | | | | | | | Summary: This fixes qsort-related false positives with glibc-2.27. I'm not entirely sure why they did not show up with the earlier versions; the code seems similar enough. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71740
* Revert "[msan] Check qsort input." and "[msan] Intercept qsort, qsort_r."Jonas Devlieghere2019-12-203-169/+0
| | | | | | | | | | | | | | Temporarily revert the qsort changes because they fail to build on bots that build with modules: > error: thread-local storage is not supported for the current > target (iossim) http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/1820/console http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/4983/console This reverts commit ddf897fc80499ece298bc33201db6b697d2af50e. This reverts commit 07861e955d0095f25639d84c5726c73b528567cb.
* [iOS sim] Ensure simulator device is booted in iossim_prepare.pyJulian Lettner2019-12-201-1/+13
| | | | | | | | | | | | | | Recent versions of the iOS simulator require that a "simulator device" is booted before we can use `simctl spawn` (see iossim_run.py) to start processes. We can use `simctl bootstatus` to ensure that the simulator device is booted before we run any tests via lit. The `-b` option starts the device if necessary. Reviewed By: delcypher Differential Revision: https://reviews.llvm.org/D71449
* [compiler-rt] [test] Disable MPROTECT for XRay tests on NetBSDMichał Górny2019-12-201-0/+3
|
* [scudo][standalone] Support __BIONIC__Kostya Kortchinsky2019-12-201-1/+5
| | | | | | | | | | | | | | Summary: Some Android builds that we are interested in define `__BIONIC__` but not `__ANDROID__`, so expand `SCUDO_ANDROID` to encompass those. Reviewers: cferris, hctim, pcc, eugenis, morehouse Subscribers: krytarowski, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71772
* [msan] Check qsort input.Evgenii Stepanov2019-12-202-0/+23
| | | | | | | | | | | | | | | | | | Summary: Qsort interceptor suppresses all checks by unpoisoning the data in the wrapper of a comparator function, and then unpoisoning the output array as well. This change adds an explicit run of the comparator on all elements of the input array to catch any sanitizer bugs. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71780
* [msan] Intercept qsort, qsort_r.Evgenii Stepanov2019-12-203-0/+146
| | | | | | | | | | | | | | | Summary: This fixes qsort-related false positives with glibc-2.27. I'm not entirely sure why they did not show up with the earlier versions; the code seems similar enough. Reviewers: vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71740
* [compiler-rt] [test] Disable MPROTECT on two builtin testsMichał Górny2019-12-204-8/+18
| | | | | | | | Introduce a new %run_nomprotect substitution to run tests that do not work with MPROTECT enabled. This uses paxctl via a wrapper on NetBSD, and evaluates to plain %run on other systems. Differential Revision: https://reviews.llvm.org/D71513
* [scudo][standalone] Implement TSD registry disablingKostya Kortchinsky2019-12-205-8/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to implement `malloc_{enable|disable}` we were just disabling (or really locking) the Primary and the Secondary. That meant that allocations could still be serviced from the TSD as long as the cache wouldn't have to be filled from the Primary. This wasn't working out for Android tests, so this change implements registry disabling (eg: locking) so that `getTSDAndLock` doesn't return a TSD if the allocator is disabled. This also means that the Primary doesn't have to be disabled in this situation. For the Shared Registry, we loop through all the TSDs and lock them. For the Exclusive Registry, we add a `Disabled` boolean to the Registry that forces `getTSDAndLock` to use the Fallback TSD instead of the thread local one. Disabling the Registry is then done by locking the Fallback TSD and setting the boolean in question (I don't think this needed an atomic variable but I might be wrong). I clang-formatted the whole thing as usual hence the couple of extra whiteline changes in this CL. Reviewers: cferris, pcc, hctim, morehouse, eugenis Subscribers: jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71719
* [compiler-rt] [test] Add missing %run to fread_fwrite MSAN testMichał Górny2019-12-191-1/+1
| | | | | | | | Add a missing %run substitution to fread_fwrite test. This fixes the test on NetBSD where %run disables ASLR as necessary for MSAN to function. Differential Revision: https://reviews.llvm.org/D71623
* Revert "Support powerpc when builing without init_array."Dmitri Gribenko2019-12-191-17/+3
| | | | | This reverts commit 5789e83dedb97588ad75cca36d01ba6c5142d6d3. It broke the build on aarch64.
* [compiler-rt] Enable SANITIZER_CAN_USE_PREINIT_ARRAY on NetBSDKamil Rytarowski2019-12-191-1/+1
| | | | .preinit_array is supported since 9.0.
* [compiler-rt] [fuzzer] Enable LSan in libFuzzer tests on NetBSDKamil Rytarowski2019-12-191-1/+0
|
* [compiler-rt] [fuzzer] Include stdarg.h for va_listKamil Rytarowski2019-12-191-0/+1
| | | | Fixes build on NetBSD after 139e216e6610091b7ee3c30bc11114f5d73cbd3e.
* Support powerpc when builing without init_array.Sterling Augustine2019-12-181-3/+17
| | | | | | | | | | Summary: Also add an error case when targetting an unimplement architecture. Subscribers: nemanjai, jsji, shchenz, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D71670
* Correct version check 9.9.26 -> 9.99.26Kamil Rytarowski2019-12-181-1/+1
|
* [NFC] Fix sanitizer lint problem that's breaking Android bot.Mitch Phillips2019-12-181-1/+1
| | | | | Fixes the lint issue introduced by e14ff22694c28b5e731502bfc30192b3208d4d8d
* [compiler-rt] [test] Disable ASLR on UBSAN+[AMT]SAN tests on NetBSDMichał Górny2019-12-181-0/+2
|
OpenPOWER on IntegriCloud