summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
Commit message (Collapse)AuthorAgeFilesLines
* Update compiler-rt cpplint.pyVitaly Buka2019-09-111-1/+1
| | | | | | https://github.com/cpplint/cpplint/commit/adb3500107f409ac5491188ae652ac3f4d03d9d3 llvm-svn: 371675
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [asan] Support running without /procEvgeniy Stepanov2019-01-081-0/+1
| | | | | | | | | | | | | | | | | | Summary: This patch lets ASan run when /proc is not accessible (ex. not mounted yet). It includes a special test-only flag that emulates this condition in an unpriviledged process. This only matters on Linux, where /proc is necessary to enumerate virtual memory mappings. Reviewers: vitalybuka, pcc, krytarowski Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D56141 llvm-svn: 350590
* Revert "[asan] Support running without /proc.", +1Evgeniy Stepanov2018-12-281-1/+0
| | | | | | | | | Revert r350104 "[asan] Fix build on windows." Revert r350101 "[asan] Support running without /proc." These changes break Mac build, too. llvm-svn: 350112
* [asan] Support running without /proc.Evgeniy Stepanov2018-12-271-0/+1
| | | | | | | | | | | | | | | | | | Summary: This patch lets ASan run when /proc is not accessible (ex. not mounted yet). It includes a special test-only flag that emulates this condition in an unpriviledged process. This only matters on Linux, where /proc is necessary to enumerate virtual memory mappings. Reviewers: pcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55874 llvm-svn: 350101
* OpenBSD UBsan support procmapsVitaly Buka2018-03-151-4/+3
| | | | | | | | | | | | | | | | Summary: procmaps OpenBSD specifics Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: mgorny, emaste, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44050 llvm-svn: 327677
* [Sanitizers] Basic sanitizer Solaris support (PR 33274)Kamil Rytarowski2017-12-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 320740
* Move LoadedModule list to a NoCtor vector and initialize on demand.Francis Ricci2017-09-291-1/+1
| | | | | | | Unreverting this patch because llvm-clang-lld-x86_64-debian-fast started passing again before the revert hit. Must've been just a flake. llvm-svn: 314556
* Revert "Move LoadedModule list to a NoCtor vector and initialize on demand."Francis Ricci2017-09-291-1/+1
| | | | | | | | | I think this may have introduced a failure on llvm-clang-lld-x86_64-debian-fast This reverts commit r314533 llvm-svn: 314552
* Move LoadedModule list to a NoCtor vector and initialize on demand.Francis Ricci2017-09-291-1/+1
| | | | llvm-svn: 314533
* Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci2017-09-281-1/+1
| | | | | | | | 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-281-1/+1
| | | | | | | | | | | | | | | | | 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-271-1/+1
| | | | | | | | This broke the windows buildbots, revert for now. This reverts commit 24050b5ddef42f6f3306aa94d4a1f42a7893a9a7. llvm-svn: 314347
* Add support for custom loaders to symbolizerFrancis Ricci2017-09-271-1/+1
| | | | | Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60 llvm-svn: 314342
* 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-251-12/+3
| | | | | | | | | | | | | | | | | 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
* Fix fuchsia builds broken by r313999Francis Ricci2017-09-221-0/+1
| | | | llvm-svn: 314021
* Fix windows buildbot broken by r313999Francis Ricci2017-09-221-0/+1
| | | | llvm-svn: 314001
* Removed platform-specific ifdefs from sanitizer_procmaps.hFrancis Ricci2017-09-221-29/+3
| | | | | | | | | | | | | | | | 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
* Add address ranges for individual macho sections on darwinFrancis Ricci2017-07-251-2/+13
| | | | | | | | | | | | | | | Summary: This is a re-upload of the reverted commit r308644. It has changed quite a bit to reflect post-commit comments by kcc, so I'm re-uploading as a new review. Reviewers: kubamracek, alekseyshl, kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35799 llvm-svn: 308977
* [compiler-rt] Add missing const specifier to MemoryMappedSegment functionsFrancis Ricci2017-07-241-4/+4
| | | | llvm-svn: 308881
* Revert "Add MemoryMappedSection struct for two-level memory map iteration"Francis Ricci2017-07-201-18/+1
| | | | | | | | This probably broke lib0 tsan unit test on 10.11 buildbots This reverts commit 35ad307c385e384f47a7fb348c14b3602d3a33c4. llvm-svn: 308676
* Add MemoryMappedSection struct for two-level memory map iterationFrancis Ricci2017-07-201-1/+18
| | | | | | | | | | | | Summary: This will allow sanitizer_procmaps on mac to expose section information. Reviewers: kubamracek, alekseyshl, kcc Subscribers: llvm-commits, emaste Differential Revision: https://reviews.llvm.org/D35422 llvm-svn: 308644
* Add NetBSD support in sanitizer_procmaps.hKamil Rytarowski2017-07-201-3/+3
| | | | | | | | | | | | | | | | | | | | | Summary: Reuse Linux and FreeBSD - no NetBSD specific changes. Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas. Sponsored by <The NetBSD Foundation> Reviewers: joerg, filcab, kcc, vitalybuka Reviewed By: filcab Subscribers: llvm-commits, emaste, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D35629 llvm-svn: 308615
* Revert "Add MemoryMappedSection struct for two-level memory map iteration"Francis Ricci2017-07-181-17/+1
| | | | | | | | This reverts commit c8095ce74118dee8544b0f1ffaba8f46aa10215c. Reverted due to some buildbot timeouts, perhaps due to 10.11 issues. llvm-svn: 308395
* Revert "Only scan global sections containing data in LSan on darwin"Francis Ricci2017-07-181-1/+0
| | | | | | This reverts commit 7e46d78d47832f03ce42adcf56417fbfd47cbaad. llvm-svn: 308394
* Only scan global sections containing data in LSan on darwinFrancis Ricci2017-07-171-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: __DATA segments on Darwin contain a large number of separate sections, most of which cannot actually contain pointers, and contain const values or objc metadata. Only scanning sections which can contain pointers greatly improves performance. On a medium-sized (~4000 files) internal project, I saw a speedup of about 50% in standalone LSan's execution time (50% improvement in the time spent running LSan, not the total program time). Reviewers: kcc, kubamracek, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35432 llvm-svn: 308231
* Add MemoryMappedSection struct for two-level memory map iterationFrancis Ricci2017-07-171-1/+17
| | | | | | | | | | | | Summary: This will allow sanitizer_procmaps on mac to expose section information. Reviewers: kubamracek, alekseyshl, kcc Subscribers: llvm-commits, emaste Differential Revision: https://reviews.llvm.org/D35422 llvm-svn: 308210
* Inline function to get mac segment address rangeFrancis Ricci2017-07-111-2/+0
| | | | | | | | | | | | | | Summary: This function is only called once and is fairly simple. Inline to keep API simple. Reviewers: alekseyshl, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35270 llvm-svn: 307695
* Refactor MemoryMappingLayout::Next to use a single struct instead of output ↵Francis Ricci2017-07-111-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. NFC. Summary: This is the first in a series of patches to refactor sanitizer_procmaps to allow MachO section information to be exposed on darwin. In addition, grouping all segment information in a single struct is cleaner than passing it through a large set of output parameters, and avoids the need for annotations of NULL parameters for unneeded information. The filename string is optional and must be managed and supplied by the calling function. This is to allow the MemoryMappedSegment struct to be stored on the stack without causing overly large stack sizes. Reviewers: alekseyshl, kubamracek, glider Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D35135 llvm-svn: 307688
* Add dyld to sanitizer procmaps on darwinFrancis Ricci2017-05-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Sanitizer procmaps uses dyld apis to iterate over the list of images in the process. This is much more performan than manually recursing over all of the memory regions in the process, however, dyld does not report itself in the list of images. In order to prevent reporting leaks from dyld globals and to symbolize dyld functions in stack traces, this patch special-cases dyld and ensures that it is added to the list of modules. This is accomplished by recursing through the memory map of the process until a dyld Mach header is found. While this recursion is expensive, it is run before the full set of images has been loaded in the process, so only a few calls are required. The result is cached so that it never needs to be searched for when the full process memory map exists, as this would be incredibly slow, on the order of minutes for leak sanitizer with only 25 or so libraries loaded. Reviewers: alekseyshl, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32968 llvm-svn: 302899
* Revert "Add dyld to sanitizer procmaps on darwin"Francis Ricci2017-05-101-1/+0
| | | | | | | | | This breaks several tests because we don't always have access to __cxa_guard functions This reverts commit 45eb470c3e9e8f6993a204e247c33d4092237efe. llvm-svn: 302693
* Add dyld to sanitizer procmaps on darwinFrancis Ricci2017-05-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Sanitizer procmaps uses dyld apis to iterate over the list of images in the process. This is much more performan than manually recursing over all of the memory regions in the process, however, dyld does not report itself in the list of images. In order to prevent reporting leaks from dyld globals and to symbolize dyld functions in stack traces, this patch special-cases dyld and ensures that it is added to the list of modules. This is accomplished by recursing through the memory map of the process until a dyld Mach header is found. While this recursion is expensive, it is run before the full set of images has been loaded in the process, so only a few calls are required. The result is cached so that it never needs to be searched for when the full process memory map exists, as this would be incredibly slow, on the order of minutes for leak sanitizer with only 25 or so libraries loaded. Reviewers: alekseyshl, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32968 llvm-svn: 302673
* [sanitizer] Track which modules are instrumented in LoadedModule objectsKuba Mracek2017-01-061-0/+1
| | | | | | | | This patch adds tracking which modules are instrumented and which are not. On macOS, instrumented modules link against the ASan/TSan/... dylib, so we can just check if such a load command exists or not. Differential Revision: https://reviews.llvm.org/D28263 llvm-svn: 291268
* [sanitizer] Track architecture and UUID of modules in LoadedModuleKuba Mracek2016-12-021-5/+8
| | | | | | | | | | When we enumerate loaded modules, we only track the module name and base address, which then has several problems on macOS. Dylibs and executables often have several architecture slices and not storing which architecture/UUID is actually loaded creates problems with symbolication: A file path + offset isn't enough to correctly symbolicate, since the offset can be valid in multiple slices. This is especially common for Haswell+ X86_64 machines, where x86_64h slices are preferred, but if one is not available, a regular x86_64 is loaded instead. But the same issue exists for i386 vs. x86_64 as well. This patch adds tracking of arch and UUID for each LoadedModule. At this point, this information isn't used in reports, but this is the first step. The goal is to correctly identify which slice is loaded in symbolication, and also to output this information in reports so that we can tell which exact slices were loaded in post-mortem analysis. Differential Revision: https://reviews.llvm.org/D26632 llvm-svn: 288537
* [Sanitizer] Introduce ListOfModules object and use it to replace ↵Alexey Samsonov2016-02-221-3/+2
| | | | | | | | | | | | | | | | | | | | GetListOfModules(). Summary: This removes the hard limit on the number of loaded modules (used to be 16K), and makes it easier to use LoadedModules w/o causing a memory leak: ListOfModules owns the modules, and makes sure to properly clean them in destructor. Remove filtering functionality that is only needed in one place (LSan). Reviewers: aizatsky Subscribers: llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D17470 llvm-svn: 261554
* Segregate FreeBSD-specific parts from sanitizer_procmaps_linux.ccViktor Kutuzov2014-08-061-1/+9
| | | | | | Differential Revision: http://reviews.llvm.org/D4555 llvm-svn: 214955
* [FreeBSD] Enable procmaps on FreeBSD.Alexey Samsonov2014-03-061-3/+3
| | | | | | | | | This is not the final patch for procmaps, but it's enough for building sanitizers and tests on FreeBSD. Patch by Viktor Kutuzov! llvm-svn: 203099
* [Sanitizer] Remove now unused symbolization functionality from ↵Alexey Samsonov2013-12-251-27/+0
| | | | | | MemoryMappingLayout llvm-svn: 198014
* [Sanitizer] Teach MemoryMappingLayout to dump all loaded modules.Alexey Samsonov2013-12-251-1/+6
| | | | | | | Use this to implement GetListOfModules() on Mac and on Android (on Linux we use dl_iterate_phdr). llvm-svn: 198004
* [Sanitizer] Move OS-specific code for MemoryMappingLayout into separate ↵Alexey Samsonov2013-12-251-26/+3
| | | | | | source files. llvm-svn: 198003
* tsan: allow to obtain code range for a particular moduleDmitry Vyukov2013-09-211-0/+3
| | | | | | this is required to ignore interceptors when called from the module llvm-svn: 191149
* [TSan] Move the /proc/self/maps parsing logic to sanitizer_common Alexander Potapenko2013-09-031-2/+10
| | | | | | Provide a generic way for the tools to generate memory profiles from contents of /proc/self/maps llvm-svn: 189789
* [Sanitizer] Kill the remainders of platform defines in favor of SANITIZER_ ↵Alexey Samsonov2013-04-031-2/+2
| | | | | | defines llvm-svn: 178627
* tsan: fix lint warningDmitry Vyukov2013-03-271-1/+1
| | | | llvm-svn: 178157
* [libsanitizer] Fix the Win build.Alexander Potapenko2013-03-261-1/+3
| | | | llvm-svn: 178012
* [libsanitizer] Unmapping the old cache partially invalidates the memory ↵Alexander Potapenko2013-03-261-1/+1
| | | | | | | | | | layout, so add a flag to skip cache update for cases when that's unacceptable (e.g. lsan). Patch by Sergey Matveev (earthdok@google.com) llvm-svn: 178000
* [sanitizer] More renamed macros.Evgeniy Stepanov2013-03-191-1/+1
| | | | llvm-svn: 177401
* [sanitizer] Replace more platform checks with SANITIZER_ constants.Evgeniy Stepanov2013-03-191-2/+2
| | | | llvm-svn: 177400
OpenPOWER on IntegriCloud