summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_mapping.h
Commit message (Collapse)AuthorAgeFilesLines
* [ASan] Use dynamic shadow on 32-bit iOS and simulatorsJulian Lettner2019-06-211-14/+2
| | | | | | | | | | | | | | | | | | | | The VM layout on iOS is not stable between releases. On 64-bit iOS and its derivatives we use a dynamic shadow offset that enables ASan to search for a valid location for the shadow heap on process launch rather than hardcode it. This commit extends that approach for 32-bit iOS plus derivatives and their simulators. rdar://50645192 rdar://51200372 rdar://51767702 Reviewed By: delcypher Differential Revision: https://reviews.llvm.org/D63586 llvm-svn: 364105
* AddressSanitizer: 64-bit SPARC/Linux portVitaly Buka2019-03-121-0/+12
| | | | | | | | | | | | | | | | | | | Summary: This patch contains the bits required to make the AddressSanitizer work on SPARC64/Linux (SPARC-T4 and later). Patch by Eric Botcazou. Reviewers: #sanitizers, vitalybuka, krytarowski Reviewed By: #sanitizers, vitalybuka Subscribers: brad, vitalybuka, ro, jyknight, kubamracek, fedor.sergeev, jdoerfert, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58434 llvm-svn: 355980
* 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] Fix typoFangrui Song2018-07-301-1/+1
| | | | llvm-svn: 338225
* [asan] Remove an unsigned compare >= 0Walter Lee2018-05-181-1/+1
| | | | | | | | | This is not needed after we've forked the Myriad version. Not to mention it produces a compiler warning. Differential Revision: https://reviews.llvm.org/D47054 llvm-svn: 332744
* [asan] Add support for Myriad RTEMS memory mapWalter Lee2018-05-181-40/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Myriad RTEMS memory system has a few unique aspects that require support in the ASan run-time. - A limited amount of memory (currently 512M). - No virtual memory, no memory protection. - DRAM starts at address 0x80000000. Other parts of memory may be used for MMIO, etc. - The second highest address bit is the "cache" bit, and 0x80000000 and 0x84000000 alias to the same memory. To support the above, we make the following changes: - Use a ShadowScale of 5, to reduce shadow memory overhead. - Adjust some existing macros to remove assumption that the lowest memory address is 0. - add a RawAddr macro that on Myriad strips the cache bit from the input address, before using the address for shadow memory (for other archs this does nothing). - We must check that an address is in DRAM range before using it to index into shadow memory. Differential Revision: https://reviews.llvm.org/D46456 llvm-svn: 332690
* [ASan] Fix range check in AddrIsInHighShadowDavid Major2018-05-111-2/+2
| | | | | | | | This appears to be a copy/paste artifact from `AddrIsInHighMem`. It was caught by Firefox's jit-tests on Win64. Differential Revision: https://reviews.llvm.org/D46291 llvm-svn: 332092
* Register NetBSD/i386 in asan_mapping.hKamil Rytarowski2018-05-101-0/+10
| | | | | | | | | | | | | | | | | | | | | Summary: Introduce kNetBSD_ShadowOffset32 and document NetBSD/i386 (hosted on amd64 kernel) process virtual address space ranges. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kcc, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D46708 llvm-svn: 332027
* [PowerPC][asan] Update asan to handle changed memory layouts in newer kernelsBill Seurer2017-12-071-1/+1
| | | | | | | | | | | | | | | In more recent Linux kernels with 47 bit VMAs the layout of virtual memory for powerpc64 changed causing the address sanitizer to not work properly. This patch adds support for 47 bit VMA kernels for powerpc64 and fixes up test cases. https://reviews.llvm.org/D40908 There is an associated patch for trunk. Tested on several 4.x and 3.x kernel releases. llvm-svn: 320110
* [asan] Use dynamic shadow on 32-bit Android, try 2.Evgeniy Stepanov2017-11-201-1/+7
| | | | | | | | | | | | | | | | Summary: This change reverts r318575 and changes FindDynamicShadowStart() to keep the memory range it found mapped PROT_NONE to make sure it is not reused. We also skip MemoryRangeIsAvailable() check, because it is (a) unnecessary, and (b) would fail anyway. Reviewers: pcc, vitalybuka, kcc Subscribers: srhines, kubamracek, mgorny, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D40203 llvm-svn: 318666
* Revert "[asan] Use dynamic shadow on 32-bit Android" and 3 more.Evgeniy Stepanov2017-11-181-7/+1
| | | | | | | | | | | | | | Revert the following commits: r318369 [asan] Fallback to non-ifunc dynamic shadow on android<22. r318235 [asan] Prevent rematerialization of &__asan_shadow. r317948 [sanitizer] Remove unnecessary attribute hidden. r317943 [asan] Use dynamic shadow on 32-bit Android. MemoryRangeIsAvailable() reads /proc/$PID/maps into an mmap-ed buffer that may overlap with the address range that we plan to use for the dynamic shadow mapping. This is causing random startup crashes. llvm-svn: 318575
* [asan] Fix small X86_64 ShadowOffset for non-default shadow scaleWalter Lee2017-11-161-1/+2
| | | | | | | | | | The requirement is that shadow memory must be aligned to page boundaries (4k in this case). Use a closed form equation that always satisfies this requirement. Differential Revision: https://reviews.llvm.org/D39471 llvm-svn: 318421
* [asan] Add CMake hook to override shadow scale in compiler_rtWalter Lee2017-11-131-0/+4
| | | | | | | | | | | | Allow user to override shadow scale in compiler_rt by passing -DCOMPILER_RT_ASAN_SHADOW_SCALE=n to CMake. Propagate the override shadow scale value via a compiler define to compiler-rt and asan tests. Tests will use the define to partially disable unsupported tests. Set "-mllvm -asan-mapping-scale=<n>" for compiler_rt tests. Differential Revision: https://reviews.llvm.org/D39469 llvm-svn: 318038
* [asan] Use dynamic shadow on 32-bit Android.Evgeniy Stepanov2017-11-101-1/+7
| | | | | | | | | | | | | | | | | | | Summary: The following kernel change has moved ET_DYN base to 0x4000000 on arm32: https://marc.info/?l=linux-kernel&m=149825162606848&w=2 Switch to dynamic shadow base to avoid such conflicts in the future. Reserve shadow memory in an ifunc resolver, but don't use it in the instrumentation until PR35221 is fixed. This will eventually let use save one load per function. Reviewers: kcc Subscribers: aemerson, srhines, kubamracek, kristof.beyls, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D39393 llvm-svn: 317943
* Add NetBSD ASAN shadow mapping for x86-64Kamil Rytarowski2017-08-281-0/+10
| | | | | | | | | | | | | | | | | | | | Summary: The maximal virtual address on NetBSD/amd64 is 0x7f7ffffff000. Define shadow offset 0x400000000000 (1ULL << 46). Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, filcab, fjricci, kcc, eugenis, pcc Reviewed By: kcc Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36587 llvm-svn: 311937
* [asan] Complete the Fuchsia portVitaly Buka2017-08-091-2/+3
| | | | | | | | | | | | | | | | Submitted on behalf of Roland McGrath. Reviewers: kcc, eugenis, alekseyshl, vitalybuka Reviewed By: vitalybuka Subscribers: filcab, vitalybuka, srhines, kubamracek, mgorny, phosek, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D35865 llvm-svn: 310431
* [Asan] Eliminate SHADOW_TO_MEM() macroIvan A. Kosarev2017-04-101-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D31592 llvm-svn: 299867
* [asan] Reapply: Switch to using dynamic shadow offset on iOSAnna Zaks2016-10-051-1/+1
| | | | | | | | The VM layout is not stable between iOS version releases, so switch to dynamic shadow offset. Differential Revision: https://reviews.llvm.org/D25218 llvm-svn: 283375
* Revert "[asan] Switch to using dynamic shadow offset on iOS"Anna Zaks2016-10-051-1/+1
| | | | | | | | This reverts commit b2af965b7924ad793b313996a96633bb72daf629. Revert as these changes broke a Chromium buildbot. llvm-svn: 283349
* [asan] When protect_shadow_gap=0, set up the shadow for the shadow gap. This ↵Kostya Serebryany2016-10-041-16/+17
| | | | | | is needed to support NVIDIA CUDA drivers. Unfortunately, I don't know how to test it properly with CUDA on a public build bot, so adding a test that emulates the CUDA behavior. llvm-svn: 283270
* [asan] Switch to using dynamic shadow offset on iOSAnna Zaks2016-10-041-1/+1
| | | | | | | | The VM layout is not stable between iOS version releases, so switch to dynamic shadow offset. Differential Revision: https://reviews.llvm.org/D25218 llvm-svn: 283240
* [compiler-rt] Add support for the dynamic shadow allocationEtienne Bergeron2016-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is adding support for dynamic shadow allocation. This is a merge and re-commit of the following patches. ``` [compiler-rt] Fix Asan build on Android https://reviews.llvm.org/D24768 [compiler-rt] Add support for the dynamic shadow allocation https://reviews.llvm.org/D23363 ``` This patch needed to re-land at the same time: ``` [asan] Support dynamic shadow address instrumentation https://reviews.llvm.org/D23354 ``` Reviewers: rnk, zaks.anna Subscribers: tberghammer, danalbert, kubabrecka, dberris, chrisha, llvm-commits Differential Revision: https://reviews.llvm.org/D25104 llvm-svn: 282882
* revert 282085, 281909, they broke 32-bit dynamic ASan and the ↵Nico Weber2016-09-211-2/+2
| | | | | | sanitizer-windows bot llvm-svn: 282096
* [compiler-rt] Fix Asan build on AndroidEtienne Bergeron2016-09-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The dynamic shadow code is not detected correctly on Android. The android shadow seems to start at address zero. The bug is introduced here: https://reviews.llvm.org/D23363 Started here: https://build.chromium.org/p/chromium.fyi/builders/ClangToTAndroidASan/builds/4029 Likely due to an asan runtime change, filed https://llvm.org/bugs/show_bug.cgi?id=30462 From asan_mapping.h: ``` #if SANITIZER_WORDSIZE == 32 # if SANITIZER_ANDROID # define SHADOW_OFFSET (0) <<---- HERE # elif defined(__mips__) ``` Shadow address on android is 0. From asan_rtl.c: ``` if (shadow_start == 0) { [...] shadow_start = FindAvailableMemoryRange(space_size, alignment, granularity); } ``` We assumed that 0 is dynamic address. On windows, the address was determined with: ``` # elif SANITIZER_WINDOWS64 # define SHADOW_OFFSET __asan_shadow_memory_dynamic_address # else ``` and __asan_shadow_memory_dynamic_address is initially zero. Reviewers: rnk, eugenis, vitalybuka Subscribers: kcc, tberghammer, danalbert, kubabrecka, dberris, llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D24768 llvm-svn: 282085
* [compiler-rt] Add support for the dynamic shadow allocationEtienne Bergeron2016-09-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch is adding the needed code to compiler-rt to support dynamic shadow. This is to support this patch: https://reviews.llvm.org/D23354 It's adding support for using a shadow placed at a dynamic address determined at runtime. The dynamic shadow is required to work on windows 64-bits. Reviewers: rnk, kcc, vitalybuka Subscribers: kubabrecka, dberris, llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D23363 llvm-svn: 281909
* Change the shadow memory address for win64.Etienne Bergeron2016-06-211-0/+3
| | | | | | | | | This is part of the effort for asan to support Windows 64 bit. Patch by Wei Wang Differential Revision: http://reviews.llvm.org/D21525 llvm-svn: 273270
* [ASan] Add shadow offset for SystemZ.Marcin Koscielnicki2016-04-301-0/+17
| | | | | | | | This is the compiler-rt counterpart to D19650. Differential Revision: http://reviews.llvm.org/D19652 llvm-svn: 268162
* [asan] Remove redundant elifAnna Zaks2016-02-021-2/+0
| | | | | | This is a fixup to r259451. llvm-svn: 259588
* [asan] Add iOS support.Anna Zaks2016-02-021-7/+13
| | | | llvm-svn: 259451
* [ASan] Fix the links to bugs and wikipages.Alexander Potapenko2015-12-041-1/+1
| | | | llvm-svn: 254735
* [compiler-rt] [asan] Use same shadow offset for aarch64Adhemerval Zanella2015-11-091-4/+0
| | | | | | | | This patch makes ASAN for aarch64 use the same shadow offset for all currently supported VMAs (39 and 42 bits). The shadow offset is the same for 39-bit (36). llvm-svn: 252497
* [asan] Enable ASan for AArch64/42-bit VMAAdhemerval Zanella2015-08-201-0/+11
| | | | | | | | | | | This patch adds support for asan on aarch64-linux with 42-bit VMA (current default config for 64K pagesize kernels). The support is enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time for both clang/llvm and compiler-rt. The default VMA is 39 bits. For 42-bit VMA aarch64 uses SANITIZIER_CAN_USER_ALLOCATOR64. llvm-svn: 245596
* [asan] Try different values of the shadow gap start.Evgeniy Stepanov2015-08-071-1/+2
| | | | | | | | The number of unaccessible pages at the beginning of the address space can differ between processes on the same machine. Try different values at runtime to protect as much memory as possible. llvm-svn: 244364
* [asan] Reduce shadow gap start on 32-bit Android.Evgeniy Stepanov2015-08-071-1/+1
| | | | | | | This fixes an internal assertion failure when running out of the address space in the large allocator. llvm-svn: 244359
* [asan] Enable asan for aarch64Adhemerval Zanella2015-08-051-0/+7
| | | | | | | | | | | | | | | | This patch enables asan for aarch64/linux. It marks it as 'unstable-release', since some tests are failing due either kernel missing support of non-executable pages in mmap or environment instability (infinite loop in juno reference boards). It sets decorate_proc_maps test to require stable-release, since the test expects the shadow memory to not be executable and the support for aarch64 is only added recently by Linux (da141706aea52c1a9 - 4.0). It also XFAIL static_tls test for aarch64 linker may omit the __tls_get_addr call as a TLS optimization. llvm-svn: 244054
* [asan] Remove special case mapping on Android/AArch64.Evgeniy Stepanov2015-07-291-7/+7
| | | | | | | | | | | | | | ASan shadow on Android starts at address 0 for both historic and performance reasons. This is possible because the platform mandates -pie, which makes lower memory region always available. This is not such a good idea on 64-bit platforms because of MAP_32BIT incompatibility. This patch changes Android/AArch64 mapping to be the same as that of Linux/AAarch64. llvm-svn: 243548
* Working on reconciling out-of-tree patches to compiler-rt for building for iOS.Chris Bieneman2015-06-231-3/+12
| | | | | | | | | | | | | | | | | | | Summary: This is one of many changes needed for compiler-rt to get it building on iOS. This change ifdefs out headers and functionality that aren't available on iOS, and adds support for iOS and the iOS simulator to as an. Note: this change does not enable building for iOS, as there are more changes to come. Reviewers: glider, kubabrecka, bogner, samsonov Reviewed By: samsonov Subscribers: samsonov, zaks.anna, llvm-commits Differential Revision: http://reviews.llvm.org/D10515 llvm-svn: 240469
* [asan][mips] Fix MIPS64 Asan mappingKumar Sukhani2015-01-311-2/+9
| | | | llvm-svn: 227683
* [ASan/Win] Move the shadow to 0x30000000Timur Iskhodzhanov2015-01-221-6/+8
| | | | llvm-svn: 226809
* [ASan] Move the shadow on Windows 32-bit from 0x20000000 to 0x40000000Timur Iskhodzhanov2015-01-121-5/+13
| | | | llvm-svn: 225641
* [asan] [mips] added support of asan for mips64/mips64el, patch by Kumar SukhaniKostya Serebryany2014-11-121-0/+3
| | | | llvm-svn: 221800
* Use GET_CURRENT_FRAME() to calculate the memory layout for power. This worksWill Schmidt2014-11-061-4/+0
| | | | | | | | | | | | | 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
* [asan] [mips] changed ShadowOffset32 for systems having 16kb PageSize; patch ↵Kostya Serebryany2014-11-041-6/+6
| | | | | | by Kumar Sukhani llvm-svn: 221288
* [compiler-rt] Enable ASAN for powerpc64le-linuxWill Schmidt2014-10-151-0/+4
| | | | | | | | | | | | | | | | | | 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
* [asan] Enable ASan on PowerPC.Evgeniy Stepanov2014-05-301-0/+3
| | | | | | Patch by Peter Bergner. llvm-svn: 209879
* Add FreeBSD support to address sanitizer process mapping facilitiesViktor Kutuzov2014-05-121-0/+20
| | | | llvm-svn: 208537
* [ASan] Move the shadow range on 32-bit iOS (and iOS Simulator)Alexander Potapenko2014-04-231-2/+7
| | | | | | | | to 0x40000000-0x60000000 to avoid address space clash with system libraries. The solution has been proposed by tahabekireren@gmail.com in https://code.google.com/p/address-sanitizer/issues/detail?id=210 This is also known to fix some Chromium iOS tests. llvm-svn: 207002
* [asan] Do not sanitize kernel area on 32-bit targets, patch by Yuri GribovKostya Serebryany2014-03-271-1/+10
| | | | llvm-svn: 204897
* [sanitizer] AArch64 sanitizer support; patch by Christophe Lyon and Yvan RouxKostya Serebryany2014-02-131-1/+4
| | | | llvm-svn: 201303
* [asan] Nuke ASAN_FLEXIBLE_MAPPING_AND_OFFSET.Evgeniy Stepanov2014-01-161-20/+13
| | | | llvm-svn: 199370
OpenPOWER on IntegriCloud