summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix build on FreeBSD after r259741.Dimitry Andric2016-02-071-0/+4
| | | | | | | | | On FreeBSD, the uc_mcontext member of ucontext_t has a member called mc_err, which corresponds to the Linux member gregs[REG_ERR]. Reviewed by: rdivacky@FreeBSD.org llvm-svn: 260046
* [asan] fix the non-x86 buildKostya Serebryany2016-02-041-0/+4
| | | | llvm-svn: 259745
* [asan] When catching a signal caused by a memory access, print if it's a ↵Kostya Serebryany2016-02-041-0/+5
| | | | | | READ or a WRITE. This touches win/mac files which I have not tested, if a win/mac bot fails I'll try to quick-fix llvm-svn: 259741
* [asan] Add iOS support.Anna Zaks2016-02-021-1/+1
| | | | llvm-svn: 259451
* [asan] Don't use sysconf(_SC_PAGESIZE) on Android.Evgeniy Stepanov2016-01-251-1/+3
| | | | | | | | | | This is broken in the current (post-MNC) master branch. Use EXEC_PAGESIZE instead, the same as on x86 Linux. This change fixes startup crashes in the existing tests on AOSP master. llvm-svn: 258706
* [asan] Optionally print reproducer cmdline in ASan reports.Maxim Ostapenko2016-01-181-1/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D16070 llvm-svn: 258037
* [asan] add option: handle_sigillKostya Serebryany2015-12-151-0/+2
| | | | llvm-svn: 255588
* [PPC64, TSAN] LLVM basic enablement of thread sanitizer for PPC64 (BE and LE)Bill Schmidt2015-12-081-1/+84
| | | | | | | | | | | | | | | | | | This patch is by Simone Atzeni with portions by Adhemerval Zanella. This contains the LLVM patches to enable the thread sanitizer for PPC64, both big- and little-endian. Two different virtual memory sizes are supported: Old kernels use a 44-bit address space, while newer kernels require a 46-bit address space. There are two companion patches that will be added shortly. There is a Clang patch to actually turn on the use of the thread sanitizer for PPC64. There is also a patch that I wrote to provide interceptor support for setjmp/longjmp on PPC64. Patch discussion at reviews.llvm.org/D12841. llvm-svn: 255057
* [asan] Remove the use of system properties on Android.Evgeniy Stepanov2015-12-041-9/+0
| | | | | | | | | | | | | System properties are not accessible through NDK (we've been using hacks to get to them) and they are unavailable during ASan initialization in .preinit_array. Use environment variables and files instead (ex. ASAN_OPTIONS=include_if_exists=/path). No test changes. This feature was not tested because the properties are system-wide and would conflict with the parallel test runner. Yet another reason to get rid of it. llvm-svn: 254783
* [tsan] Use re-exec method to enable interceptors on older versions of OS XKuba Brecka2015-12-031-0/+8
| | | | | | | | In AddressSanitizer, we have the MaybeReexec method to detect when we're running without DYLD_INSERT_LIBRARIES (in which case interceptors don't work) and re-execute with the environment variable set. On OS X 10.11+, this is no longer necessary, but to have ThreadSanitizer supported on older versions of OS X, let's use the same method as well. This patch moves the implementation from `asan/` into `sanitizer_common/`. Differential Revision: http://reviews.llvm.org/D15123 llvm-svn: 254600
* [lsan] [aarch64] Add support for AArch64Adhemerval Zanella2015-10-211-1/+4
| | | | | | | | | | This patch add support for leak sanitizer for aarch64. Similar to MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64 currently supports 39 and 42-bit VMA). It also fixes the android build issue. llvm-svn: 250898
* Revert "[lsan] [aarch64] Add support for AArch64"Evgeniy Stepanov2015-10-081-4/+1
| | | | | | | | | This reverts commit ea02fa45225c35613bfecab383fb526e24b74497 (r249337). Reason: broken "ninja AsanUnitTests" on Android/AArch64. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/20675/steps/build%20compiler-rt%20android%2Faarch64/logs/stdio llvm-svn: 249730
* [lsan] [aarch64] Add support for AArch64Adhemerval Zanella2015-10-051-1/+4
| | | | | | | | This patch add support for leak sanitizer for aarch64. Similar to MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64 currently supports 39 and 42-bit VMA). llvm-svn: 249337
* [sanitizer_common] Apply modernize-use-nullptr, other minor fixesVedant Kumar2015-09-301-11/+12
| | | | | | | | | | | | - 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 aarch64 syscall optimization supportAdhemerval Zanella2015-08-211-0/+2
| | | | | | | This patch adds the inline syscall support for aarch64 instead of relying on the syscall runtime function. llvm-svn: 245702
* [sanitizer] 2-nd attempt. Add the flag handle_sigfpe that is default true to ↵Kostya Serebryany2015-08-061-0/+2
| | | | | | handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski. This time the test is enabled only on x86-64 (it broke on ARM) llvm-svn: 244234
* Revert "[sanitizer] Add the flag handle_sigfpe that is default true to ↵Renato Golin2015-08-061-2/+0
| | | | | | | | handle SIGFPE crashes same as SIGSEV crashes, patch by Karl Skomski" This reverts commit r244136, it was breaking the ARM bots for too long. We should investigate it offline. llvm-svn: 244210
* [sanitizer] Add the flag handle_sigfpe that is default true to handle SIGFPE ↵Kostya Serebryany2015-08-051-0/+2
| | | | | | crashes same as SIGSEV crashes, patch by Karl Skomski llvm-svn: 244136
* [tsan] Enable tsan for aarch64Adhemerval Zanella2015-08-051-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enabled TSAN for aarch64 with 39-bit VMA layout. As defined by tsan_platform.h the layout used is: 0000 4000 00 - 0200 0000 00: main binary 2000 0000 00 - 4000 0000 00: shadow memory 4000 0000 00 - 5000 0000 00: metainfo 5000 0000 00 - 6000 0000 00: - 6000 0000 00 - 6200 0000 00: traces 6200 0000 00 - 7d00 0000 00: - 7d00 0000 00 - 7e00 0000 00: heap 7e00 0000 00 - 7fff ffff ff: modules and main thread stack Which gives it about 8GB for main binary, 4GB for heap and 8GB for modules and main thread stack. Most of tests are passing, with the exception of: * ignore_lib0, ignore_lib1, ignore_lib3 due a kernel limitation for no support to make mmap page non-executable. * longjmp tests due missing specialized assembly routines. These tests are xfail for now. The only tsan issue still showing is: rtl/TsanRtlTest/Posix.ThreadLocalAccesses Which still required further investigation. The test is disable for aarch64 for now. llvm-svn: 244055
* Re-commit r243686 - [Sanitizers] [Bug 24151] Generalize type of offset in ↵Daniel Sanders2015-07-311-1/+1
| | | | | | | | | 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-1/+1
| | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | 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
* [sanitizer] Fix Mac build.Evgeniy Stepanov2015-07-281-12/+1
| | | | llvm-svn: 243480
* [asan] Read process name from /proc/self/cmdline on Linux.Evgeniy Stepanov2015-07-281-0/+26
| | | | | | | | | | Rename getBinaryBasename() to getProcessName() and, on Linux, read it from /proc/self/cmdline instead of /proc/self/exe. The former can be modified by the process. The main motivation is Android, where application processes re-write cmdline to a package name. This lets us setup per-application ASAN_OPTIONS through include=/some/path/%b. llvm-svn: 243473
* [asan] Fix android system property access on aarch64.Evgeniy Stepanov2015-07-241-4/+4
| | | | | | | __system_property_get is gone from the NDK headers and libs in 64-bit toolchains, but it is still exported by platform libc.so. llvm-svn: 243137
* [sanitizer] Implement logging to syslog.Evgeniy Stepanov2015-07-231-29/+0
| | | | | | | | | | | | | | | | | Previously, Android target had a logic of duplicating all sanitizer output to logcat. This change extends it to all posix platforms via the use of syslog, controlled by log_to_syslog flag. Enabled by default on Android, off everywhere else. A bit of cmake magic is required to allow Printf() to call a libc function. I'm adding a stub implementation to support no-libc builds like dfsan and safestack. This is a second attempt. I believe I've fixed all the issues that prompted the revert: Mac build, and all kinds of non-CMake builds (there are 3 of those). llvm-svn: 243051
* Revert r242975.Evgeniy Stepanov2015-07-231-0/+29
| | | | | | Breaks Mac build. llvm-svn: 242978
* [sanitizer] Implement logging to syslog.Evgeniy Stepanov2015-07-221-29/+0
| | | | | | | | | | | | | Previously, Android target had a logic of duplicating all sanitizer output to logcat. This change extends it to all posix platforms via the use of syslog, controlled by log_to_syslog flag. Enabled by default on Android, off everywhere else. A bit of cmake magic is required to allow Printf() to call a libc function. I'm adding a stub implementation to support no-libc builds like dfsan and safestack. llvm-svn: 242975
* [Sanitizer] Teach ReadFileToBuffer to distinguish empty file from ↵Alexey Samsonov2015-07-171-5/+9
| | | | | | | | | | | | | | | | inaccessible file. Summary: This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=399 (sanitizers crash with empty suppression files). Reviewers: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11284 llvm-svn: 242594
* [asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L.Evgeniy Stepanov2015-06-291-7/+8
| | | | | | | On Android L, TSD destructors run 8 times instead of 4. Back to 4 times on the current master branch (as well as on K). llvm-svn: 240992
* [asan] Disable glibc-specific code chunk on Android.Evgeniy Stepanov2015-06-261-1/+1
| | | | | | Fixes quarantine_size_mb.cc test on the Android bot. llvm-svn: 240854
* [asan] Fix Android build for API >= 21.Evgeniy Stepanov2015-06-081-1/+1
| | | | | | | | | | | | /code/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:971:8: error: address of function 'dl_iterate_phdr' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if (!dl_iterate_phdr) ~^~~~~~~~~~~~~~~ /code/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:971:8: note: prefix with the address-of operator to silence this warning if (!dl_iterate_phdr) ^ & llvm-svn: 239321
* [ASan] Make binary name reader cross-platform.Yury Gribov2015-06-041-24/+9
| | | | | | Differential Revision: http://reviews.llvm.org/D10213 llvm-svn: 239020
* [asan] Fall back to /proc/$PID/maps on Android L.Evgeniy Stepanov2015-05-061-2/+40
| | | | | | | | dl_iterate_phdr is somewhat broken in L (see the code for details). We add runtime OS version detection and fallback to /proc/maps on L or earlier. This fixes a number of ASan tests on L. llvm-svn: 236628
* [ASan][MIPS] Fix null_deref.cc test on MIPS64Sagar Thakur2015-05-061-1/+1
| | | | | | | | | | Symbol for pc used in ucontext->uc_mcontext was wrong. Reviewers: dsanders, kcc, samsonov Subscribers: llvm-commits, mohit.bhakkad, jaydeep Differential Revision: http://reviews.llvm.org/D9246 llvm-svn: 236572
* [sanitizer][MIPS] Implement clone for MIPSSagar Thakur2015-05-061-3/+63
| | | | | | | | Reviewers: kcc, samsonov, earthdok Subscribers: dsanders, jaydeep, Anand.Takale, mohit.bhakkad, llvm-commits Differential Revision: http://reviews.llvm.org/D8318 llvm-svn: 236570
* [asan] fix IsDeadlySignalKostya Serebryany2015-05-051-2/+2
| | | | llvm-svn: 236545
* [asan] under handle_abort=1 option intercept SIGABRT in addition to ↵Kostya Serebryany2015-05-051-0/+2
| | | | | | SIGSEGV/SIGBUS. Among other things this will allow to set up a death callback for SIGABRT and thus properly handle assert() in lib/Fuzzer llvm-svn: 236474
* [Sanitizers] Do not call internal_sigdelset() on non-LinuxViktor Kutuzov2015-04-241-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D9220 llvm-svn: 235701
* tsan: support setuid callDmitry Vyukov2015-04-231-0/+3
| | | | | | | Currently the call hangs because the background thread does not handle SIGSETXID signal. llvm-svn: 235581
* Cast an argument to mprotect syscall to uptr to fix X32Timur Iskhodzhanov2015-04-131-1/+1
| | | | llvm-svn: 234748
* Split Mprotect into MmapNoAccess and MprotectNoAccess to be more portableTimur Iskhodzhanov2015-04-101-0/+4
| | | | | | | 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
* [Sanitizers] Fix internal_ftruncate() to work on FreeBSDViktor Kutuzov2015-03-231-1/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D8551 llvm-svn: 233003
* [ASan] Distinguish between read, write and read-write file access modes in ↵Alexander Potapenko2015-03-231-5/+0
| | | | | | | | OpenFile. This is to fix mapping coverage files into memory on OSX. llvm-svn: 232936
* [Sanitizers] Fix sanitizers to build on FreeBSD.Viktor Kutuzov2015-03-121-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D8175 llvm-svn: 232072
* asan: fix signal handling during stoptheworldDmitry Vyukov2015-03-021-1/+75
| | | | | | | | | | | 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
* [LSan] [MIPS] adding support of LSan for mips64/mips64el archMohit K. Bhakkad2015-02-191-0/+7
| | | | | | | | | | | | Patch by Sagar Thakur Reviewers: petarj, earthdok, kcc. Subscribers: samsonov, dsanders, mohit.bhakkad, Anand.Takale, llvm-commits. Differential Revision: http://reviews.llvm.org/D7013 llvm-svn: 229830
* [TSan] Fix Go build.Alexey Samsonov2015-01-301-11/+0
| | | | llvm-svn: 227634
* [Sanitizers] Introduce GET_LINK_MAP_BY_DLOPEN_HANDLE() macroViktor Kutuzov2015-01-301-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D7233 llvm-svn: 227570
* [Sanitizer] Make BlockingMutex really linker initialized.Yury Gribov2015-01-301-4/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D7171 llvm-svn: 227560
OpenPOWER on IntegriCloud