summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* [compiler-rt] Remove SANITIZER_AARCH64_VMA usageAdhemerval Zanella2015-11-301-16/+0
| | | | | | | | | | | | This patch complete removed SANITIZER_AARCH64_VMA definition and usage. AArch64 ports now supports runtime VMA detection and instrumentation for 39 and 42-bit VMA. It also Rewrite print_address to take a variadic argument list (the addresses to print) and adjust the tests which uses it to the new signature. llvm-svn: 254319
* [asan] Fix the deadlocks introduced by "On OS X, log reports to syslog and ↵Anna Zaks2015-11-201-2/+2
| | | | | | | | | | | | os_trace" commit [asan] On OS X, log reports to syslog and os_trace, has been reverted in r252076 due to deadlocks on earlier versions of OS X. Alexey has also noticed deadlocks in some corner cases on Linux. This patch, if applied on top of the logging patch (http://reviews.llvm.org/D13452), addresses the known deadlock issues. (This also proactively removes the color escape sequences from the error report buffer since we have to copy the buffer anyway.) Differential Revision: http://reviews.llvm.org/D14470 llvm-svn: 253689
* [Sanitizer] Use ReportMmapFailureAndDie() in all applicable mmap variants on ↵Alexey Samsonov2015-11-051-11/+7
| | | | | | Posix. llvm-svn: 252121
* [sanitizer_common] Apply modernize-use-nullptr, other minor fixesVedant Kumar2015-09-301-19/+20
| | | | | | | | | | | | - Trim spaces. - Use nullptr in place of 0 for pointer variables. - Use '!p' in place of 'p == 0' for null pointer checks. Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13310 llvm-svn: 248964
* [compiler-rt] [sanitizers] Add VMA size check at runtimeAdhemerval Zanella2015-09-111-0/+16
| | | | | | | | | This patch adds a runtime check for asan, dfsan, msan, and tsan for architectures that support multiple VMA size (like aarch64). Currently the check only prints a warning indicating which is the VMA built and expected against the one detected at runtime. llvm-svn: 247413
* [windows] Fix deadlock on mmap failure due to CHECK recursionReid Kleckner2015-08-121-15/+2
| | | | | | | | | | | | | | | | | | | Summary: Printing a stacktrace acquires a spinlock, and the sanitizer spinlocks aren't re-entrant. Avoid the problem by reusing the logic we already have on Posix. This failure mode is already exercised by the existing mmap_limit_mb.cc test case. It will be enabled in a forthcoming change, so I didn't add standalone tests for this change. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11999 llvm-svn: 244840
* [Windows] Implement FileExists, ReadFromFile, and FindPathToBinaryReid Kleckner2015-08-101-24/+0
| | | | | | | | | | | | Summary: These are needed to talk to llvm-symbolizer on Windows. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11920 llvm-svn: 244533
* Re-commit r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in ↵Daniel Sanders2015-07-311-3/+3
| | | | | | | | | internal_mmap The builder remains broken in the same way without this patch so this patch is innocent. llvm-svn: 243744
* Revert r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in ↵Daniel Sanders2015-07-311-3/+3
| | | | | | | | | internal_mmap It's implicated in a buildbot failure and while the failure looks unrelated, this commit is the only probably candidate in the blamelist. llvm-svn: 243740
* [Sanitizers] [Bug 24151] Generalize type of offset in internal_mmapDaniel Sanders2015-07-301-3/+3
| | | | | | | | | | | | | | | | Summary: Using u64 as type for offset changes its value, changing starting address for map in file. This patch solves Bug 24151, which raises issue while mapping file in mips32. Patch by Mohit Bhakkad Reviewers: dsanders, kcc Subscribers: hans, llvm-commits, samsonov, nitesh.jain, sagar, bhushan, jaydeep Differential Revision: http://reviews.llvm.org/D11588 llvm-svn: 243686
* [asan] Fix an OS X startup crash when an empty section is presentKuba Brecka2015-07-061-0/+1
| | | | | | | | On OS X, when the main instrumented binary contains a custom section with zero length, ASan will crash (assert failure) early in the initialization. Reviewed at http://reviews.llvm.org/D10944 llvm-svn: 241474
* Add descriptive names to sanitizer entries in /proc/self/maps. Helps debugging.Evgeniy Stepanov2015-05-291-23/+0
| | | | | | | | | | | | | | | | | | This is done by creating a named shared memory region, unlinking it and setting up a private (i.e. copy-on-write) mapping of that instead of a regular anonymous mapping. I've experimented with regular (sparse) files, but they can not be scaled to the size of MSan shadow mapping, at least on Linux/X86_64 and ext3 fs. Controlled by a common flag, decorate_proc_maps, disabled by default. This patch has a few shortcomings: * not all mappings are annotated, especially in TSan. * our handling of memset() of shadow via mmap() puts small anonymous mappings inside larger named mappings, which looks ugly and can, in theory, hit the mapping number limit. llvm-svn: 238621
* Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portableTimur Iskhodzhanov2015-04-101-1/+5
| | | | | | | On Windows, we have to know if a memory to be protected is mapped or not. On POSIX, Mprotect was semantically different from mprotect most people know. llvm-svn: 234602
* Use RenameFile instead of internal_rename in non-POSIX codeTimur Iskhodzhanov2015-04-091-0/+5
| | | | llvm-svn: 234490
* Use WriteToFile instead of internal_write in non-POSIX codeTimur Iskhodzhanov2015-04-091-0/+10
| | | | llvm-svn: 234487
* Use ReadFromFile instead of internal_read in non-POSIX codeTimur Iskhodzhanov2015-04-091-0/+10
| | | | llvm-svn: 234485
* Introduce CloseFile to be used instead of internal_close on non-POSIXTimur Iskhodzhanov2015-04-091-0/+4
| | | | llvm-svn: 234481
* Move some POSIX-specific functions from sanitizer_libc.h to a new ↵Timur Iskhodzhanov2015-04-081-1/+2
| | | | | | sanitizer_posix.h llvm-svn: 234418
* [Sanitizers] Make OpenFile more portableTimur Iskhodzhanov2015-04-081-7/+9
| | | | llvm-svn: 234410
* [ASan] Distinguish between read, write and read-write file access modes in ↵Alexander Potapenko2015-03-231-4/+16
| | | | | | | | OpenFile. This is to fix mapping coverage files into memory on OSX. llvm-svn: 232936
* [sanitizer] Since x32 runs under 64-bit kernel, GetKernelAreaSize should ↵Kostya Serebryany2015-03-041-2/+2
| | | | | | return 0 llvm-svn: 231283
* asan: fix signal handling during stoptheworldDmitry Vyukov2015-03-021-0/+8
| | | | | | | | | | | The problem is that without SA_RESTORER flag, kernel ignores the handler. So tracer actually did not setup any handler. Add SA_RESTORER flag when setting up handlers. Add a test that causes SIGSEGV in stoptheworld callback. Move SignalContext from asan to sanitizer_common to print better diagnostics about signal in the tracer thread. http://reviews.llvm.org/D8005 llvm-svn: 230978
* [compiler-rt] Allow suppression file to be relative to the location of the ↵Anna Zaks2015-02-271-0/+8
| | | | | | | | | | executable The ASanified executable could be launched from different locations. When we cannot find the suppression file relative to the current directory, try to see if the specified path is relative to the location of the executable. llvm-svn: 230723
* [Sanitizers] The MAP_NORESERVE define has been removed in FreeBSD 11.x,Dimitry Andric2015-02-111-0/+7
| | | | | | | | | and even before that, it was never implemented. Just define it to zero instead, so compiler-rt can compile on FreeBSD 11 and later. Differential Revision: http://reviews.llvm.org/D7485 llvm-svn: 228871
* [sanitizer] Fix an edge case in MemoryRangeIsAvailable.Evgeniy Stepanov2015-01-231-1/+2
| | | | llvm-svn: 226913
* [sanitizer] First step toward supporting 42-bit AS on aarch64Kostya Serebryany2015-01-211-3/+2
| | | | | | | | | | | | | | | aarch64-linux kernel has configurable 39, 42 or 47 bit virtual address space. Most distros AFAIK use 42-bit VA right now, but there are also 39-bit VA users too. The ppc64 handling can be used for this just fine and support all the 3 sizes. There are other issues, like allocator32 not really being able to support the larger addres spaces, and hardcoded 39-bit address space size in other macros. Patch by Jakub Jelinek. llvm-svn: 226639
* [Sanitizer] Fix report_path functionality:Alexey Samsonov2014-12-111-31/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: - Make sure mmap() is never called inside RawWrite function. - Wrap a bunch of standalone globals in a ReportFile object. - Make sure accesses to these globals are thread-safe. - Fix report_path functionality on Windows, where __sanitizer_set_report_path() would break program. I've started this yak shaving in order to make "CommonFlags::mmap_limit_mb" immutable. Currently we drop this flag to zero before printing an error message. Test Plan: regression test suite Reviewers: kcc, glider Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6595 llvm-svn: 224031
* Replace InternalScopedBuffer<char> with InternalScopedString where applicable.Alexey Samsonov2014-12-021-3/+2
| | | | | | | | | | | | | | | | Summary: No functionality change. Test Plan: make check-all Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6472 llvm-svn: 223164
* [Sanitizer] Bump kMaxPathLength to 4096 and use it more extensively instead ↵Alexey Samsonov2014-11-261-2/+2
| | | | | | of hardcoded constants llvm-svn: 222803
* [MSan] [MIPS] Adding support for MIPS64 (patch by Mohit Bhakkad).Alexey Samsonov2014-11-191-1/+1
| | | | | | Reviewed at http://reviews.llvm.org/D5906 llvm-svn: 222388
* Removed r221896, it seems to break build in various ways.Yury Gribov2014-11-131-2/+1
| | | | llvm-svn: 221912
* [ASan] Add process basename to log name and error message to simplify ↵Yury Gribov2014-11-131-1/+2
| | | | | | | | analysis of sanitized systems logs. Reviewed at http://reviews.llvm.org/D5724 llvm-svn: 221896
* [asan] [mips] added support of asan for mips64/mips64el, patch by Kumar SukhaniKostya Serebryany2014-11-121-0/+2
| | | | llvm-svn: 221800
* Use GET_CURRENT_FRAME() to calculate the memory layout for power. This worksWill Schmidt2014-11-061-4/+3
| | | | | | | | | | | | | for both PPC64 Big and Little endian modes, so also eliminates the need for the BIG_ENDIAN/LITTLE_ENDIAN #ifdeffery. By trial and error, it also looks like the kPPC64_ShadowOffset64 value is valid using (1ULL << 41) for both BE and LE, so that #if/#elif/#endif block has also been simplified. Differential Revision: http://reviews.llvm.org/D6044 llvm-svn: 221457
* [compiler-rt] Enable ASAN for powerpc64le-linuxWill Schmidt2014-10-151-1/+3
| | | | | | | | | | | | | | | | | | Whitespace update for lint check by myself (Will). Otherwise code and comments by Peter Bergner, as previously seen on llvm-commits. The following patch gets ASAN somewhat working on powerpc64le-linux. It currently assumes the LE kernel uses 46-bit addressing, which is true, but it doesn't solve the case for BE where it may be 44 or 46 bits. That can be fixed with a follow on patch. There are some test suite fails even with this patch that I haven't had time to solve yet, but this is better than the state it is in now. The limited debugging of those test suite fails seems to show that the address map for 46-bit addressing has changed and so we'll need to modify the shadow memory location slightly. Again, that can be fixed with a follow on patch. llvm-svn: 219827
* [asancov] Write coverage directly to a memory-mapped file.Evgeniy Stepanov2014-05-271-0/+11
| | | | | | | | | | | This way does not require a __sanitizer_cov_dump() call. That's important on Android, where apps can be killed at arbitrary time. We write raw PCs to disk instead of module offsets; we also write memory layout to a separate file. This increases dump size by the factor of 2 on 64-bit systems. llvm-svn: 209653
* [asan] tyring to fix the Android buildKostya Serebryany2014-05-141-0/+5
| | | | llvm-svn: 208763
* [asan] Respect personality in kernel area detector, patch by Yuri GribovKostya Serebryany2014-05-141-10/+32
| | | | llvm-svn: 208760
* [sanitizer] Print addresses in hexadecimal.Evgeniy Stepanov2014-05-061-2/+2
| | | | llvm-svn: 208089
* [asan] disable GetKernelStartAddress as it misbehaves in schrootKostya Serebryany2014-05-011-1/+3
| | | | llvm-svn: 207768
* [asan] added internal flag mmap_limit_mbKostya Serebryany2014-04-141-0/+5
| | | | llvm-svn: 206178
* [asan] provide better reports for cases where memcpy/etc get negative size ↵Kostya Serebryany2014-04-141-1/+1
| | | | | | parameter. Also fix a typo found by Tetsuo Kiso llvm-svn: 206158
* [asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri GribovKostya Serebryany2014-03-271-2/+23
| | | | llvm-svn: 204897
* [ASan] Print mmap errno/GetLastError in a readable and consistent wayTimur Iskhodzhanov2014-03-191-7/+8
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D3107 llvm-svn: 204218
* A set of trivial changes to support sanitizers on FreeBSD.Alexey Samsonov2014-03-041-2/+2
| | | | | | Patch by Viktor Kutuzov! llvm-svn: 202801
* Reapply r201910. MSVC gets __func__ defined explicitly, even though itJoerg Sonnenberger2014-02-261-1/+1
| | | | | | can't build anything here. llvm-svn: 202297
* Revert "Replace __FUNCTION__ with __func__, the latter being standard ↵Reid Kleckner2014-02-221-1/+1
| | | | | | | | | | | | C99/C++11." This reverts commit r201910. While __func__ may be standard in C++11, it was only recently added to MSVC in 2013 CTP, and LLVM supports MSVC 2012. __FUNCTION__ may not be standard, but it's *very* portable. llvm-svn: 201916
* Replace __FUNCTION__ with __func__, the latter being standard C99/C++11.Joerg Sonnenberger2014-02-211-1/+1
| | | | llvm-svn: 201910
* [sanitizer] AArch64 sanitizer support; patch by Christophe Lyon and Yvan RouxKostya Serebryany2014-02-131-0/+2
| | | | llvm-svn: 201303
* [ASan] Remove an accidentally added include of signal.hAlexander Potapenko2014-01-281-1/+0
| | | | llvm-svn: 200318
OpenPOWER on IntegriCloud