summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-02-07Merging r324496:llvm_60-amp-20180630release_60-f1b37feef3d-amp-20180630Hans Wennborg
------------------------------------------------------------------------ r324496 | yroux | 2018-02-07 19:27:25 +0100 (Wed, 07 Feb 2018) | 9 lines [asan] Fix filename size on linux platforms. This is a a fix for: https://bugs.llvm.org/show_bug.cgi?id=35996 Use filename limits from system headers to be synchronized with what LD_PRELOAD can handle. Differential Revision: https://reviews.llvm.org/D42900 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@324506 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-31Merging r322588:Hans Wennborg
------------------------------------------------------------------------ r322588 | eugenis | 2018-01-16 20:21:45 +0100 (Tue, 16 Jan 2018) | 9 lines [hwasan] Build runtime library with -fPIC, not -fPIE. Summary: -fPIE can not be used when building a shared library. Reviewers: alekseyshl, peter.smith Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D42121 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323850 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30Merging r323013:Hans Wennborg
------------------------------------------------------------------------ r323013 | petarj | 2018-01-20 01:06:07 +0100 (Sat, 20 Jan 2018) | 18 lines [TSan][MIPS] Expand sanitizer memory space to lower addresses MemToShadowImpl() maps lower addresses to a memory space out of sanitizers range. The simplest example is address 0 which is mapped to 0x2000000000 static const uptr kShadowBeg = 0x2400000000ull; but accessing the address during tsan execution will lead to a segmentation fault. This patch expands the range used by the sanitizer and ensures that 1/8 of the maximum valid address in the virtual address spaces is used for shadow memory. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D41777 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323767 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24Merging r323315:Hans Wennborg
------------------------------------------------------------------------ r323315 | mstorsjo | 2018-01-24 11:14:52 +0100 (Wed, 24 Jan 2018) | 9 lines [builtins] Align addresses to cache lines in __clear_cache for aarch64 This makes sure that the last cache line gets invalidated properly. This matches the example code at http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/BABJDBHI.html, and also matches what libgcc does. Differential Revision: https://reviews.llvm.org/D42196 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323338 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22Merging r323039:Hans Wennborg
------------------------------------------------------------------------ r323039 | kamil | 2018-01-20 15:16:16 +0100 (Sat, 20 Jan 2018) | 13 lines [compiler-rt] Implement __clear_cache() on OpenBSD/mips64 Summary: Make __clear_cache() invoke the platform's cache flush function on OpenBSD/mips64. Reviewers: krytarowski Reviewed By: krytarowski Subscribers: sdardis, dberris, arichardson, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42332 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@323120 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03Creating release_60 branch off revision 321711Hans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_60@321716 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03Hide some symbols to avoid a crash on shutdown when using code coverageMarco Castelluccio
Summary: gcov / gcda-based profiling crashes when shared libraries are unloaded Patch by Benoit Belley and test by Marco Castelluccio for Firefox See https://bugs.llvm.org/show_bug.cgi?id=27224 & https://bugzilla.mozilla.org/show_bug.cgi?id=1401230 Reviewers: davidxl, rnk, void Subscribers: jessicah, marco-c, belleyb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38124 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321703 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03Flush gcda files before unlocking themMarco Castelluccio
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=35464. Reviewers: zturner, rnk, void Subscribers: sylvestre.ledru, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D40610 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321702 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-02[asan] Restore asan_device_setup compatibility with older libraries.Evgeniy Stepanov
Summary: This way new asan_device_setup, which knows about the quirks of recent releases of Android, can be used with older ASan runtime library (say, from an NDK release). The library is version locked to the compiler, and is often hard or impossible to update. Reviewers: vitalybuka Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D41679 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321677 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-01[scudo] Touch memory to count as RSSJonas Hahnfeld
This should fix the test from https://reviews.llvm.org/D41128. Differential Revision: https://reviews.llvm.org/D41649 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321627 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28[msan] Intercept pthread_getname_np.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321544 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28Ignore the DISPATCH_NOESCAPE if not definedYi Kong
This macro is only defined after XCode 8, causing build breakage for build systems with prior versions. Ignore DISPATCH_NOESCAPE if not defined. Differential Revision: https://reviews.llvm.org/D41601 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321543 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-28-fsanitize=vptr warnings on bad static types in dynamic_cast and typeidStephan Bergmann
...when such an operation is done on an object during con-/destruction. (This adds a test case to compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp that, unlike the existing test cases there, wants to detect multiple UBSan warnings in one go. Therefore, that file had to be changed from globally using -fno-sanitize-recover to individually using halt_on_error only where appropriate.) This is the compiler-rt part of a patch covering both cfe and compiler-rt. Differential Revision: https://reviews.llvm.org/D40295 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-27[XRay] Add missing include to unit testJonas Hahnfeld
FDRLoggingTest::MultiThreadedCycling uses std::array so we need to include the right C++ header and not rely on transitive dependencies. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321485 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-24Fix PR35739: chkstk and chkst2 should only be built for WindowsDimitry Andric
As reported in PR35739, rL252927 added the Windows specific chkstk and chkstk2 sources unconditionally, and since these are assembly without a NO_EXEC_STACK_DIRECTIVE at the end, automated vulnerability scanners warned about the objects having an executable stack. Avoid the problem by only including these files when Windows is targeted. Reviewers: compnerd, rnk, martell Reviewed By: martell Subscribers: mstorsjo, mgorny, martell, javed.absar, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41567 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-23[Sanitizers] Export aligned new/delete from runtimes.Alex Shlyapnikov
Summary: Export aligned new/delete to make dynamic runtimes work again. Remove all valid new/delete cases from ASan test, there's a test in common for that. Reviewers: eugenis Subscribers: srhines, kubamracek, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41548 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321394 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22Reland "[mips][compiler-rt] Provide 64bit atomic add and sub"Simon Dardis
r318733 introduced a build failure for native MIPS32 systems for xray due to the lack of __sync_fetch_and_add / __syn_fetch_and_sub support. This patch extends the existing support providing atomics so that xray can be successfully built. The initial patch was reverted in r321292, as I suspected it may have caused the buildbot failure. Another patch in the updates the bot fetched caused the test failures which was reverted. Reviewers: atanasyan, dberris Differential Revision: https://reviews.llvm.org/D40385 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321383 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22[Sanitizers] Disable new_delete_test.cc on Android until it's supported.Alex Shlyapnikov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321374 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22[Sanitizers, CMake] Basic sanitizer Solaris support (PR 33274)Alex Shlyapnikov
Summary: This patch, on top of https://reviews.llvm.org/D40898, contains the build system changes necessary to enable the Solaris/x86 sanitizer port. The only issue of note is the libclang_rt.sancov_{begin, end} libraries: clang relies on the linker automatically defining __start_SECNAME and __stop_SECNAME labels for sections whose names are valid C identifiers. This is a GNU ld extension not present in the ELF gABI, also implemented by gold and lld, but not by Solaris ld. To work around this, I automatically link the sancov_{begin,end} libraries into every executable for now. There seems to be now way to build individual startup objects like crtbegin.o/crtend.o, so I've followed the lead of libclang_rt.asan-preinit which also contains just a single object. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: srhines, kubamracek, mgorny, fedor.sergeev, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40899 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321373 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-22[MSan,TSan] Add aligned new/delete interceptors.Alex Shlyapnikov
Summary: Providing aligned new/delete implementations to match ASan. Unlike ASan, MSan and TSan do not perform any additional checks on overaligned memory, hence no sanitizer specific tests. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41532 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21Include process.h for getpid on Windows in instr profilingReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321313 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[sanitizer] Make function declarations C-compatiblePetr Hosek
The public sanitizer headers are intended to be usable from either C++ or C, but they declare no-argument functions with the syntax that is not a proper prototype declaration in C. This goes unnoticed until someone uses -Wsystem-headers. Patch By: mcgrathr Reviewers: phosek, vitalybuka Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D41475 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321305 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[CMake] Allow passing extra CMake arguments to custom libc++Petr Hosek
This can be used to customize the libc++ build. Differential Revision: https://reviews.llvm.org/D41103 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321299 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21Revert "[mips][compiler-rt] Provide 64bit atomic add and sub"Simon Dardis
This reverts commit r321260. It appears to have broken the sanitizer bot sanitizer-ppc64be-linux. http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/5029 Reverting to see if the buildbot turns green. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[mips][compiler-rt] Provide 64bit atomic add and subSimon Dardis
r318733 introduced a build failure for native MIPS32 systems for xray due to the lack of __sync_fetch_and_add / __syn_fetch_and_sub support. This patch extends the existing support providing atomics so that xray can be successfully built. Reviewers: atanasyan, dberris Differential Revision: https://reviews.llvm.org/D40385 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-21[ubsan] Diagnose noreturn functions which return (compiler-rt)Vedant Kumar
This is paired with the clang change: https://reviews.llvm.org/D40698 Differential Revision: https://reviews.llvm.org/D40700 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321232 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20[libfuzzer] Fix UB when calculating Log(0) in StackDepthStepFunction().Max Moroz
Summary: __builtin_clz used for Log calculation returns an undefined result when argument is 0. I noticed that issue when was testing some fuzzers: ``` /src/libfuzzer/FuzzerTracePC.h:282:33: runtime error: shift exponent 450349 is too large for 32-bit type 'uint32_t' (aka 'unsigned int') #0 0x43d83f in operator() /src/libfuzzer/FuzzerTracePC.h:283:33 #1 0x43d83f in void fuzzer::TracePC::CollectFeatures<fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1>(fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*)::$_1) const /src/libfuzzer/FuzzerTracePC.h:290 #2 0x43cbd4 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:445:7 #3 0x43e5f1 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:706:5 #4 0x43e9e1 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:739:3 #5 0x432f8c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:754:6 #6 0x42ee18 in main /src/libfuzzer/FuzzerMain.cpp:20:10 #7 0x7f17ffeb182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #8 0x407838 in _start (/out/rotate_fuzzer+0x407838) Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D41457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321211 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20[hwasan] Implement -fsanitize-recover=hwaddress.Evgeniy Stepanov
Summary: Very similar to AddressSanitizer, with the exception of the error type encoding. Reviewers: kcc, alekseyshl Subscribers: cfe-commits, kubamracek, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D41417 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321203 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20[builtins] Implement __chkstk for arm64 windowsMartin Storsjo
Differential Revision: https://reviews.llvm.org/D41134 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321151 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-20[hwasan] Remove --check-prefix=CHECK (NFC)Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19[hwasan] Fix handling of store errors.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-19[hwasan] Remove unused -check-prefix in tests.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18Fix more inconsistent line endings. NFC.Dimitry Andric
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321016 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18[PGO] Test case changes for D41059Xinliang David Li
Differential Revision: http://reviews.llvm.org/D41059 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320999 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18[asan] Add interceptor for printf_chkMaxim Ostapenko
There could be a situation when a specific DSO was built with FORTIFY_SOURCE option. In case asan-ed binary link against that DSO, libasan can't handle the possible memory error because it does not have interceptors for spinrtf_chk, snprintf_chk, vprintf_chk, vsnprintf_chk, __fprintf_chk functions. Let's interceptors for them. Patch by Denis Khalikov. Differential Revision: https://reviews.llvm.org/D40951 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320990 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18Revert r320977 "No -fsanitize=function warning when calling noexcept ↵Stephan Bergmann
function through non-noexcept pointer in C++17" At least <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/ builds/6013/steps/annotate/logs/stdio> complains about __ubsan::__ubsan_handle_function_type_mismatch_abort (compiler-rt lib/ubsan/ubsan_handlers.cc) returning now despite being declared 'noreturn', so looks like a different approach is needed for the function_type_mismatch check to be called also in cases that may ultimately succeed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320981 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-18No -fsanitize=function warning when calling noexcept function through ↵Stephan Bergmann
non-noexcept pointer in C++17 As discussed in the mail thread <https://groups.google.com/a/isocpp.org/forum/ #!topic/std-discussion/T64_dW3WKUk> "Calling noexcept function throug non- noexcept pointer is undefined behavior?", such a call should not be UB. However, Clang currently warns about it. There is no cheap check whether two function type_infos only differ in noexcept,so pass those two type_infos as additional data to the function_type_mismatch handler (with the optimization of passing a null "static callee type" info when that is already noexcept, so the additional check can be avoided anyway). For the Itanium ABI (which appears to be the only one that happens to be used on platforms that support -fsanitize=function, and which appears to only record noexcept information for pointer-to-function type_infos, not for function type_infos themselves), we then need to check the mangled names for occurrence of "Do" representing "noexcept". This is the compiler-rt part of a patch covering both cfe and compiler-rt. Differential Revision: https://reviews.llvm.org/D40720 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320977 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-16[sanitizer] Define __sanitizer_clockid_t on FreeBSDKostya Kortchinsky
Summary: https://reviews.llvm.org/D41121 broke the FreeBSD build due to that type not being defined on FreeBSD. As far as I can tell, it is an int, but I do not have a way to test the change. Reviewers: alekseyshl, kparzysz Reviewed By: kparzysz Subscribers: kparzysz, emaste, kubamracek, krytarowski, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41325 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320931 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15[ubsan-minimal] Add a path for non-POSIX (and bare-metal) use of the libraryFilipe Cabecinhas
Summary: Hook on -DKERNEL_USE (which is also used in lib/builtins) to not import strlen and not rely on write() being implemented with the stderr on fd 2. With this, the only requirements to use this library are: - "Good enough" std::atomic<void*> and std::atomic<int> - abort() being implemented - ubsan_message(const char*) being implemented Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39791 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320831 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15Added a separate install target for compilert-rt-headersIlya Biryukov
Summary: This patch adds a new install target `install-compilert-rt-headers`, that is similar to `install-clang-headers`. It allows to install the headers without installing all of compiler-rt. Reviewers: alekseyshl, beanz Reviewed By: beanz Subscribers: smeenai, beanz, mgorny, #sanitizers, kcc, llvm-commits Differential Revision: https://reviews.llvm.org/D41244 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320808 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-15[libFuzzer] make the tests depend on ubsanKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[scudo] Refactor ScudoChunkKostya Kortchinsky
Summary: The initial implementation used an ASan like Chunk class that was deriving from a Header class. Due to potential races, we ended up working with local copies of the Header and never using the parent class fields. ScudoChunk was never constructed but cast, and we were using `this` as the pointer needed for our computations. This was meh. So we refactored ScudoChunk to be now a series of static functions within the namespace `__scudo::Chunk` that take a "user" pointer as first parameter (former `this`). A compiled binary doesn't really change, but the code is more sensible. Clang tends to inline all those small function (in -O2), but GCC left a few not inlined, so we add the `INLINE` keyword to all. Since we don't have `ScudoChunk` pointers anymore, a few variables were renamed here and there to introduce a clearer distinction between a user pointer (usually `Ptr`) and a backend pointer (`BackendPtr`). Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41200 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320745 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[Sanitizers] Basic sanitizer Solaris support (PR 33274)Kamil Rytarowski
Summary: This is the first mostly working version of the Sanitizer port to 32-bit Solaris/x86. It is currently based on Solaris 11.4 Beta. This part was initially developed inside libsanitizer in the GCC tree and should apply to both. Subsequent parts will address changes to clang, the compiler-rt build system and testsuite. I'm not yet sure what the right patch granularity is: if it's profitable to split the patch up, I'd like to get guidance on how to do so. Most of the changes are probably straightforward with a few exceptions: * The Solaris syscall interface isn't stable, undocumented and can change within an OS release. The stable interface is the libc interface, which I'm using here, if possible using the internal _-prefixed names. * While the patch primarily target 32-bit x86, I've left a few sparc changes in. They cannot currently be used with clang due to a backend limitation, but have worked fine inside the gcc tree. * Some functions (e.g. largefile versions of functions like open64) only exist in 32-bit Solaris, so I've introduced a separate SANITIZER_SOLARIS32 to check for that. The patch (with the subsequent ones to be submitted shortly) was tested on i386-pc-solaris2.11. Only a few failures remain, some of them analyzed, some still TBD: AddressSanitizer-i386-sunos :: TestCases/Posix/concurrent_overflow.cc AddressSanitizer-i386-sunos :: TestCases/init-order-atexit.cc AddressSanitizer-i386-sunos :: TestCases/log-path_test.cc AddressSanitizer-i386-sunos :: TestCases/malloc-no-intercept.c AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/concurrent_overflow.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/start-deactivated.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/default_options.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/init-order-atexit.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/log-path_test.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/malloc-no-intercept.c SanitizerCommon-Unit :: ./Sanitizer-i386-Test/MemoryMappingLayout.DumpListOfModules SanitizerCommon-Unit :: ./Sanitizer-i386-Test/SanitizerCommon.PthreadDestructorIterations Maybe this is good enough the get the ball rolling. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: srhines, jyknight, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40898 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320740 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[profile] Port the runtime to Solaris (retry)Vedant Kumar
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Hopefully the Windows support is fixed now. Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the ↵Vedant Kumar
runtime to Solaris" This reverts commit r320726. It looks like flock isn't available on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[profile] Port the runtime to SolarisVedant Kumar
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320726 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[scudo] Disabling the interface test on armhfKostya Kortchinsky
Summary: I will investigate the breakage tomorrow, disable on armhf to turn the bots green over the night. http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/2952/steps/ninja%20check%202/logs/FAIL%3A%20Scudo-armhf%3A%3A%20interface.cpp This is post https://reviews.llvm.org/D41128. Reviewers: alekseyshl Subscribers: aemerson, kristof.beyls, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D41218 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overheadDean Michael Berris
Summary: Before this change, XRay would conservatively patch sections of the code one sled at a time. Upon testing/profiling, this turns out to take an inordinate amount of time and cycles. For an instrumented clang binary, the cycles spent both in the patching/unpatching routine constituted 4% of the cycles -- this didn't count the time spent in the kernel while performing the mprotect calls in quick succession. With this change, we're coalescing the number of calls to mprotect from being linear to the number of instrumentation points, to now being a lower constant when patching all the sleds through `__xray_patch()` or `__xray_unpatch()`. In the case of calling `__xray_patch_function()` or `__xray_unpatch_function()` we're now doing an mprotect call once for all the sleds for that function (reduction of at least 2x calls to mprotect). Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41153 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14Set of corrections for MSan/NetBSDKamil Rytarowski
Summary: Changes: - Don't attempt to intercept GLIBC specific functions like __strtol_internal. This is required to stop intercepting it as we leak dlerror(3) for dlsym(3) that cannot manage to find a symbol. - Correct interception of fstatat(2). - Don't run a test for fgetgrent_r() that is missing on NetBSD. - Correct link_map location (offset) in Obj_Entry on x86_64 and i386. - Stop intercepting getpshared-like functions in pthread(3). This is feature is not enabled by default on NetBSD as it's unfinished. - Switch intercepting from UTMP to UTMPX functions. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, kcc Reviewed By: vitalybuka Subscribers: llvm-commits, srhines, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D41053 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14[asan] Use linker initialization for the allocatorKuba Mracek
This saves ~2 MB of dirty memory footprint. Can be a big deal on mobile devices especially when running multiple processes with ASan. Differential Revision: https://reviews.llvm.org/D40627 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320660 91177308-0d34-0410-b5e6-96231b3b80d8