summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* Add missing header definitionFrancis Ricci2017-09-291-0/+1
| | | | llvm-svn: 314521
* Remove recursion from FindModuleForAddress. NFC.Francis Ricci2017-09-291-11/+24
| | | | llvm-svn: 314520
* Refactor android fallback procmaps init. NFC.Francis Ricci2017-09-291-10/+19
| | | | llvm-svn: 314518
* Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci2017-09-289-80/+33
| | | | | | | | This causes the gcc sanitizer buildbot to timeout. This reverts commit 81f388fe570e5b6460dd5bc9b9a36b72714eeb68. llvm-svn: 314453
* Add support for custom loaders to the sanitizer symbolizerFrancis Ricci2017-09-289-33/+80
| | | | | | | | | | | | | | | | | Summary: Adds a fallback mode to procmaps when the symbolizer fails to locate a module for a given address by using dl_iterate_phdr. Reviewers: kubamracek, rnk, vitalybuka, eugenis Reviewed By: eugenis Subscribers: srhines, llvm-commits Differential Revision: https://reviews.llvm.org/D37269 llvm-svn: 314431
* Revert "Add support for custom loaders to symbolizer"Francis Ricci2017-09-279-78/+33
| | | | | | | | This broke the windows buildbots, revert for now. This reverts commit 24050b5ddef42f6f3306aa94d4a1f42a7893a9a7. llvm-svn: 314347
* Add support for custom loaders to symbolizerFrancis Ricci2017-09-279-33/+78
| | | | | Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60 llvm-svn: 314342
* [Sanitizer] Disable compact size class tests on AndroidAlex Shlyapnikov2017-09-271-0/+2
| | | | | | | Fixing test failure on Android introduced in D38245. Compact size class maps defined there are not to be used on Android. llvm-svn: 314318
* [Sanitizers] Allocator: new "release memory to OS" implementationAlex Shlyapnikov2017-09-272-47/+573
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The current implementation of the allocator returning freed memory back to OS (controlled by allocator_release_to_os_interval_ms flag) requires sorting of the free chunks list, which has two major issues, first, when free list grows to millions of chunks, sorting, even the fastest one, is just too slow, and second, sorting chunks in place is unacceptable for Scudo allocator as it makes allocations more predictable and less secure. The proposed approach is linear in complexity (altough requires quite a bit more temporary memory). The idea is to count the number of free chunks on each memory page and release pages containing free chunks only. It requires one iteration over the free list of chunks and one iteration over the array of page counters. The obvious disadvantage is the allocation of the array of the counters, but even in the worst case we support (4T allocator space, 64 buckets, 16 bytes bucket size, full free list, which leads to 2 bytes per page counter and ~17M page counters), requires just about 34Mb of the intermediate buffer (comparing to ~64Gb of actually allocated chunks) and usually it stays under 100K and released after each use. It is expected to be a relatively rare event, releasing memory back to OS, keeping the buffer between those runs and added complexity of the bookkeeping seems unnesessary here (it can always be improved later, though, never say never). The most interesting problem here is how to calculate the number of chunks falling into each memory page in the bucket. Skipping all the details, there are three cases when the number of chunks per page is constant: 1) P >= C, P % C == 0 --> N = P / C 2) C > P , C % P == 0 --> N = 1 3) C <= P, P % C != 0 && C % (P % C) == 0 --> N = P / C + 1 where P is page size, C is chunk size and N is the number of chunks per page and the rest of the cases, where the number of chunks per page is calculated on the go, during the page counter array iteration. Among the rest, there are still cases where N can be deduced from the page index, but they require not that much less calculations per page than the current "brute force" way and 2/3 of the buckets fall into the first three categories anyway, so, for the sake of simplicity, it was decided to stick to those two variations. It can always be refined and improved later, should we see that brute force way slows us down unacceptably. Reviewers: eugenis, cryptoad, dvyukov Subscribers: kubamracek, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D38245 llvm-svn: 314311
* Invalidate symbolizer module list from dlopen/dlclose interceptorsFrancis Ricci2017-09-264-4/+14
| | | | | | | | | | | | | | Summary: The module list should only be invalidated by dlopen and dlclose, so the symbolizer should only re-generate it when we've hit one of those functions. Reviewers: kubamracek, rnk, vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37268 llvm-svn: 314219
* Add missing include to sanitizer procmapsFrancis Ricci2017-09-251-0/+2
| | | | llvm-svn: 314162
* Fix style in sanitizer_procmaps.hFrancis Ricci2017-09-251-1/+2
| | | | llvm-svn: 314157
* [sanitizer_common] Don't provide sanitizer_procmaps API functions where not ↵Francis Ricci2017-09-256-19/+11
| | | | | | | | | | | | | | | | | defined Summary: Platforms that don't implement procmaps (primarily fuchsia and windows) still expose the procmaps API when including sanitizer_procmaps.h, despite not implementing the functions provided by that header. Ensure that the API is only exposed on platforms that implement it. Reviewers: vitalybuka, alekseyshl, kubamracek Subscribers: llvm-commits, krytarowski Differential Revision: https://reviews.llvm.org/D38187 llvm-svn: 314149
* [ubsan] Replace CommonSanitizerReportMutex with ScopedErrorReportLockVitaly Buka2017-09-232-0/+6
| | | | | | | | | | Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38194 llvm-svn: 314053
* [lsan] Deadly signal handler for lsanVitaly Buka2017-09-222-1/+22
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, dberris, kubamracek, krytarowski Differential Revision: https://reviews.llvm.org/D37608 llvm-svn: 314041
* [sanitizer] Replace thread id with GetThreadSelfVitaly Buka2017-09-222-11/+10
| | | | | | This allows to avoid constructor parameter llvm-svn: 314040
* [sanitizer] Move ScopedErrorReportLock into libcdep versionVitaly Buka2017-09-222-37/+37
| | | | llvm-svn: 314039
* Fix fuchsia builds broken by r313999Francis Ricci2017-09-222-0/+5
| | | | llvm-svn: 314021
* [sanitizer] Replace AddressSanitizer with correct tool nameVitaly Buka2017-09-221-2/+3
| | | | llvm-svn: 314015
* [sanitizer] Move report locking code from asan into commonVitaly Buka2017-09-222-0/+44
| | | | llvm-svn: 314008
* [sanitizer] Move CommonSanitizerReportMutex from _print.cc to _common.ccVitaly Buka2017-09-222-2/+2
| | | | llvm-svn: 314006
* Fix windows buildbot broken by r313999Francis Ricci2017-09-222-0/+2
| | | | llvm-svn: 314001
* Removed platform-specific ifdefs from sanitizer_procmaps.hFrancis Ricci2017-09-227-132/+132
| | | | | | | | | | | | | | | | Summary: Removed platform-specific ifdefs for linux, mac, freebsd and netbsd from sanitizer_procmaps.h Patch by Yicheng Wang <yichengfb@fb.com> Reviewers: kcc, kubamracek, alekseyshl, fjricci, vitalybuka Reviewed By: fjricci, vitalybuka Subscribers: vitalybuka, emaste, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D38098 llvm-svn: 313999
* [sanitizer] Don't define common ReportDeadlySignal on FuchsiaPetr Hosek2017-09-191-2/+2
| | | | | | | | | | This causes a linker error because of duplicate symbol since ReportDeadlySignal is defined both in sanitizer_common_libcdep and sanitizer_fuchsia. Differential Revision: https://reviews.llvm.org/D37952 llvm-svn: 313641
* [sanitizer] Move StartReportDeadlySignal into sanitizer_common_libcdepVitaly Buka2017-09-183-12/+8
| | | | llvm-svn: 313518
* [sanitizer] Use SI_ instead of SANITIZER_ in sanitizer_platform_interceptorsVitaly Buka2017-09-181-2/+2
| | | | llvm-svn: 313505
* [compiler-rt] Fix build break after r313277 on s390xUlrich Weigand2017-09-171-1/+1
| | | | | | | Commit r313277 moved IsStackOverflow to inside the SignalContext class, but didn't update a code block in #ifdef s390x accordingly. llvm-svn: 313480
* [sanitizer] Move signal interceptors from asan to sanitizer_commonVitaly Buka2017-09-162-0/+69
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D37889 llvm-svn: 313449
* [sanitizer][mips64] fix MIPS64 kernel_stat_to_stat()Petar Jovanovic2017-09-151-3/+32
| | | | | | | | | | | | | | | | | | | | | This patch tackles with two issues: Output stat st_[a|m|c]time fields were holding wrong values. st_[a|m|c]time fields should have contained value of seconds and instead these are filled with st_[a|m|c]time_nsec fields which hold nanoseconds. Build fails for MIPS64 if SANITIZER_ANDROID. Recently <sys/stat.h> from bionic introduced st_[a|m|c]time_nsec macros for compatibility with old NDKs and those clashed with the field names of the <asm/stat.h> kernel_stat structure. To fix both issues and make sure sanitizer builds on all platforms, we must un-define all compatibility macros and access the fields directly when copying the 'time' fields. Patch by Miodrag Dinic <miodrag.dinic@imgtec.com> Differential Revision: https://reviews.llvm.org/D35671 llvm-svn: 313360
* [sanitizer] Use __sanitizer:: in CHECK_IMPL on both sides of assignmentVitaly Buka2017-09-151-2/+2
| | | | llvm-svn: 313338
* [sanitizer] Move stack overflow and signal reporting from Asan into common.Vitaly Buka2017-09-143-8/+75
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D37844 llvm-svn: 313310
* [sanitizer] Add empty Fuchsia and Win versions of StartReportDeadlySignalVitaly Buka2017-09-142-0/+5
| | | | llvm-svn: 313240
* [sanitizer] Move IsStackOverflow into SignalContextVitaly Buka2017-09-144-8/+14
| | | | llvm-svn: 313227
* [sanitizer] Add BufferedStackTrace::Reset()Vitaly Buka2017-09-141-2/+7
| | | | llvm-svn: 313226
* [compiler-rt] Fix Windows buildVitaly Buka2017-09-141-4/+0
| | | | llvm-svn: 313224
* [compiler-rt] Cleanup SignalContext initializationVitaly Buka2017-09-146-44/+60
| | | | | | | | | | Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris Differential Revision: https://reviews.llvm.org/D37827 llvm-svn: 313223
* [compiler-rt] Use SignalContext in ErrorStackOverflow and ErrorDeadlySignalVitaly Buka2017-09-134-31/+50
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl, filcab Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37793 llvm-svn: 313168
* [compiler-rt] Add siginfo into SignalContextVitaly Buka2017-09-134-10/+31
| | | | | | | | | | | | | | | Summary: Information stored there is often been passed along with SignalContext. Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37792 llvm-svn: 313167
* [compiler-rt] Compile signal specific functions only for !SANITIZER_GOVitaly Buka2017-09-131-0/+2
| | | | llvm-svn: 313130
* Fix line breaks.Vitaly Buka2017-09-131-1/+1
| | | | llvm-svn: 313118
* [compiler-rt] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka2017-09-134-0/+51
| | | | | | | | | | | | | | sanitizer_common Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37766 llvm-svn: 313117
* [compiler-rt] Move *Sanitizer:DEADLYSIGNAL printing into common partVitaly Buka2017-09-132-1/+11
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37764 llvm-svn: 313115
* [Fuchsia] Magenta -> ZirconPetr Hosek2017-09-134-127/+125
| | | | | | | | | | Fuchsia's lowest API layer has been renamed from Magenta to Zircon. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D37770 llvm-svn: 313106
* [compiler-rt] Move IsStackOverflow into sanitizer_posix_libcdep.cc to the restVitaly Buka2017-09-132-47/+45
| | | | | | of instrumentation code. llvm-svn: 313100
* [compiler-rt] Move IsStackOverflow from asan into sanitizer_commonVitaly Buka2017-09-122-1/+51
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37536 llvm-svn: 312987
* Revert "[compiler-rt] Move IsStackOverflow from asan into sanitizer_common"Vitaly Buka2017-09-122-48/+0
| | | | | | | | Windows is broken. This reverts commit r312951 llvm-svn: 312984
* Runtime detection of android_set_abort_message.Evgeniy Stepanov2017-09-111-3/+5
| | | | | | | | | | | | | | | | | Summary: Use runtime detection (with a weak-undef symbol) of android_set_abort_message availability. Android NDK provides a single version of the ASan runtime library to be used for any target API level, which makes compile-time feature detection impossible (the library itself is built at API level 9). Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37716 llvm-svn: 312973
* [compiler-rt] Move IsStackOverflow from asan into sanitizer_commonVitaly Buka2017-09-112-0/+48
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37536 llvm-svn: 312951
* [compiler-rt] Cleanup decoratorsVitaly Buka2017-09-111-2/+2
| | | | | | | | | | | | | | Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 llvm-svn: 312950
* [sanitizer_common][Fuchsia] Update Fuchsia sanitizer markupPetr Hosek2017-09-062-6/+9
| | | | | | | | | | | Include URLs to the markup format specification in code comments. Use sanitizer markup in the sancov message about a dump just produced. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D37273 llvm-svn: 312596
OpenPOWER on IntegriCloud