summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_malloc_win.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/asan to .cppNico Weber2019-08-011-553/+0
| | | | | | Like r367463, but for asan. llvm-svn: 367558
* [ASan] Fix >80 character line.Matt Morehouse2019-07-151-1/+2
| | | | llvm-svn: 366136
* [sanitizers][windows][mingw32] Mingw32 RTL fixesMatthew G McGovern2019-07-151-44/+44
| | | | | | | | | RTL interception broke mingw32, this should fix those builds by removing dependency on windows.h reviewed in https://reviews.llvm.org/D64694 llvm-svn: 366105
* [sanitizers][windows] FIX: Rtl-Heap Interception and testsMatthew G McGovern2019-07-091-2/+2
| | | | | | | | | | | | - Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap - Adds unit tests for the new interceptors and expands HeapAlloc tests to demonstrate new functionality. Reviewed as D62927 - adds fixes for ~win and x64 tests > llvm-svn: 365381 llvm-svn: 365424
* [sanitizers][windows] Rtl-Heap Interception and testsMatthew G McGovern2019-07-091-26/+283
| | | | | | | | | - Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap - Adds unit tests for the new interceptors and expands HeapAlloc tests to demonstrate new functionality. Reviewed as D62927 llvm-svn: 365422
* Revert "[sanitizers][windows] Rtl-Heap Interception and tests"JF Bastien2019-07-081-283/+26
| | | | | | | | | | | | | | | | | | | | | | | | Causes build failure on clang-ppc64be-linux-lnt: compiler-rt/lib/asan/asan_malloc_win.cc:23:2: error: #error "Missing arch or unsupported platform for Windows." #error "Missing arch or unsupported platform for Windows." ^~~~~ compiler-rt/lib/asan/asan_malloc_win.cc:25:10: fatal error: heapapi.h: No such file or directory #include <heapapi.h> ^~~~~~~~~~~ compilation terminated. [39/1151] Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_debugging.cc.o [40/1151] Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o FAILED: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o /usr/bin/c++ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/asan -Icompiler-rt/lib/asan -Iinclude -I/home/buildbots/ppc64be-clang-lnt-test/clang-ppc64be-lnt/llvm/include -Icompiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O2 -UNDEBUG -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -MD -MT projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o -MF projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o.d -o projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o -c compiler-rt/lib/asan/asan_malloc_win.cc compiler-rt/lib/asan/asan_malloc_win.cc:23:2: error: #error "Missing arch or unsupported platform for Windows." #error "Missing arch or unsupported platform for Windows." ^~~~~ compiler-rt/lib/asan/asan_malloc_win.cc:25:10: fatal error: heapapi.h: No such file or directory #include <heapapi.h> ^~~~~~~~~~~ llvm-svn: 365384
* [sanitizers][windows] Rtl-Heap Interception and testsMatthew G McGovern2019-07-081-26/+283
| | | | | | | | | - Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap - Adds unit tests for the new interceptors and expands HeapAlloc tests to demonstrate new functionality. Reviewed as D62927 llvm-svn: 365381
* Fix FIXME added in r359339Reid Kleckner2019-04-291-0/+1
| | | | | | | | | We have windows.h in asan_win.cc, so we can just use the correct prototypes for these EH-related interceptors without worrying. Also fix an unused variable warning while I'm here. llvm-svn: 359500
* Pacify sanitizer lint script after r359498Reid Kleckner2019-04-291-1/+0
| | | | llvm-svn: 359499
* [AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in ↵Matthew G McGovern2019-04-291-14/+43
| | | | | | | | | | | asan_malloc_win.cc HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user. _recalloc previously did not zero new memory after reallocation. https://reviews.llvm.org/D61268 llvm-svn: 359498
* 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
* Windows ASan: Instrument _msize_base()Vlad Tsyrklevich2018-12-141-0/+6
| | | | | | | | | | | | | | | | | | | | Summary: A recent update to the VS toolchain in chromium [1] broke the windows ASan bot because the new toolchain calls _msize_base() instead of _msize() in a number of _aligned_* UCRT routines. Instrument _msize_base() as well. [1] https://crbug.com/914947 Reviewers: rnk, #sanitizers, vitalybuka Reviewed By: rnk, #sanitizers, vitalybuka Subscribers: vitalybuka, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55684 llvm-svn: 349115
* [ASan] [Windows] Avoid including windows.h in asan_malloc_win.ccMartin Storsjo2018-09-251-2/+11
| | | | | | | | | | Instead provide manual declarations of the used types, to avoid pulling in conflicting declarations of some of the functions that are to be overridden. Differential Revision: https://reviews.llvm.org/D51914 llvm-svn: 343014
* [ASan] [Windows] Remove const from _msize function declaration parameterMartin Storsjo2018-09-111-1/+1
| | | | | | | | | This function isn't declared with a const parameter anywhere; neither in MSVC (neither in ucrt or in older msvcrt versions) nor in mingw-w64. Differential Revision: https://reviews.llvm.org/D51876 llvm-svn: 341903
* Fix -Wstring-conversion instanceReid Kleckner2017-03-151-1/+1
| | | | llvm-svn: 297879
* Recommit: Stop intercepting some malloc-related functions on FreeBSD andDimitry Andric2017-01-301-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | macOS Summary: In https://bugs.freebsd.org/215125 I was notified that some configure scripts attempt to test for the Linux-specific `mallinfo` and `mallopt` functions by compiling and linking small programs which references the functions, and observing whether that results in errors. FreeBSD and macOS do not have the `mallinfo` and `mallopt` functions, so normally these tests would fail, but when sanitizers are enabled, they incorrectly succeed, because the sanitizers define interceptors for these functions. This also applies to some other malloc-related functions, such as `memalign`, `pvalloc` and `cfree`. Fix this by not intercepting `mallinfo`, `mallopt`, `memalign`, `pvalloc` and `cfree` for FreeBSD and macOS, in all sanitizers. Also delete the non-functional `cfree` wrapper for Windows, to fix the test cases on that platform. Reviewers: emaste, kcc, rnk Subscribers: timurrrr, eugenis, hans, joerg, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D27654 llvm-svn: 293536
* Fix _recalloc redefinition link error in ASan RTLReid Kleckner2016-10-111-0/+6
| | | | | | | | Fixes PR30329 Patch by Hans-Bernhard Broeker! llvm-svn: 283955
* [asan] Intercept all Heap* related imports from ucrtbase.dllReid Kleckner2016-03-241-13/+83
| | | | | | | | | | | | | | | | | | | | | | ucrtbase.dll appears to be built with some kind of cross-module inlining, because there are calls to imported Heap* routines sprinkled throughout the code. This inlining defeats our attempts to hotpatch malloc, _malloc_base, and related functions. Failing to intercept an allocation or deallocation results in a crash when the program attempts to deallocate or reallocate memory with the wrong allocator. This change patches the IAT of ucrtbase.dll to replace the addresses of the imported Heap* functions with implementations provided by ASan. We don't globally intercept the win32 Heap* functions because they are typically used by system DLLs that run before ASan initializes. Eventually, we may want to intercept them, but for now I think this is the minimal change that will keep ASan stable. Reviewers: samsonov Differential Revision: http://reviews.llvm.org/D18413 llvm-svn: 264327
* [asan] Export new and delete operators on WindowsReid Kleckner2016-03-231-17/+0
| | | | | | | | | | | | | | | | | | | | | | This is necessary to support the dynamic CRT (/MD) with VS2015. In VS2015, these symbols are no longer imported from a DLL, they provided statically by msvcrt.lib. This means our approach of hotpatching the DLL no longer works. By exporting the symbols, we end up relying on the same mechanism that we use to intercept symbols in the static CRT (/MT) case. The ASan runtime always needs to appear first on the link line, and the linker searches for symbol definitions from left to right. This means we can stop hotpatching operator new and delete in the CRT, which is nice. I think that the only reason we weren't exporting the symbols already is because MSVC doesn't allow you to do it directly with __declspec(dllexport). Instead, we can use `#pragma comment(linker, "/export:foo")`, which is most of what the attribute does under the hood. It does mean we have to write down the mangled names of the operators, but that's not too bad. llvm-svn: 264190
* [asan] Add new _*_base interceptors for VS 2015Reid Kleckner2016-03-211-0/+20
| | | | | | | | | There are some places in the CRT (such as mbctype) that directly call _malloc_base. If you are incrementally linking a binary with ASan from before this change, this change appears to result in a linker error. Retrying the link succeeds for some reason. llvm-svn: 264005
* [msan] Remove MSanDR and supporting code.Evgeniy Stepanov2014-11-181-1/+1
| | | | | | | | | | MSanDR is a dynamic instrumentation tool that can instrument the code (prebuilt libraries and such) that could not be instrumented at compile time. This code is unused (to the best of our knowledge) and unmaintained, and starting to bit-rot. llvm-svn: 222232
* [ASan/Win] Intercept memory allocation functions in the MD CRTTimur Iskhodzhanov2014-08-251-11/+39
| | | | llvm-svn: 216382
* Follow-up to r215724: fix a lint warningTimur Iskhodzhanov2014-08-151-1/+1
| | | | llvm-svn: 215725
* [ASan/Win] Introduce a new macro for malloc-like function attributes; also, ↵Timur Iskhodzhanov2014-08-151-21/+27
| | | | | | clang-format the definitions of these functions llvm-svn: 215724
* [ASan/Win] Remove old, unused and non-functional code that will be ↵Timur Iskhodzhanov2014-08-151-28/+1
| | | | | | re-written soon llvm-svn: 215707
* Add support for _expand[_dbg] so we don't crash when _aligned_* allocation ↵Timur Iskhodzhanov2014-03-271-0/+15
| | | | | | functions are used llvm-svn: 204925
* [sanitizer] Use the new sanitizer_interception.h header in all interceptors.Evgeniy Stepanov2013-12-201-1/+1
| | | | llvm-svn: 197808
* [ASan] Do not rely on malloc context in allocator reports.Alexey Samsonov2013-11-131-2/+3
| | | | | | | | | | | Invoke a fatal stack trace unwinder when ASan prints allocator-relevant error reports (double-free, alloc-dealloc-mismatch, invalid-free). Thus we'll be able to print complete stack trace even if allocation/free stacks are not stored (malloc_context_size=0). Based on the patch by Yuri Gribov! llvm-svn: 194579
* [ASan/Win] Oops, forgot to add the attributes to the memory allocations ↵Timur Iskhodzhanov2013-08-131-0/+11
| | | | | | functions llvm-svn: 188290
* [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-0/+2
| | | | llvm-svn: 177400
* [asan] add a flag alloc_dealloc_mismatch (off by default for now) which ↵Kostya Serebryany2012-12-211-1/+1
| | | | | | finds malloc/delete, new/free, new/delete[], etc mismatches llvm-svn: 170869
* [asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to ↵Kostya Serebryany2012-12-131-5/+5
| | | | | | allow using the slow CFI-based unwinder llvm-svn: 170117
* [ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the ↵Alexey Samsonov2012-09-241-1/+2
| | | | | | same time, remove ASan from CMake build on Windows after conversation with Timur. We don't want to support building ASan on Windows until it is in a working state. llvm-svn: 164486
* Remove file-type tags for .cc files in ASan run-time libraryAlexey Samsonov2012-06-041-1/+1
| | | | llvm-svn: 157927
* [asan] more renamingKostya Serebryany2012-05-311-2/+2
| | | | llvm-svn: 157746
* [ASan] Add a few more malloc-related interceptors for WindowsTimur Iskhodzhanov2012-03-231-2/+45
| | | | llvm-svn: 153327
* [ASan] Add back the support for /MT; intercept statically-linked functionsTimur Iskhodzhanov2012-03-121-4/+11
| | | | llvm-svn: 152557
* [ASan] Fix lint warningTimur Iskhodzhanov2012-03-071-1/+0
| | | | llvm-svn: 152226
* [ASan/Win] Intercept _msize, required for running SQLiteTimur Iskhodzhanov2012-03-071-0/+6
| | | | llvm-svn: 152224
* [ASan] Replace CRT .dll malloc with our implementation at asan_init() timeTimur Iskhodzhanov2012-02-291-6/+34
| | | | llvm-svn: 151715
* [ASan] Intercept functions on Windows - first versionTimur Iskhodzhanov2012-02-221-0/+1
| | | | llvm-svn: 151161
* [asan] The first version of Windows malloc interceptors, patch by ↵Kostya Serebryany2012-02-061-0/+57
timurrrr@google.com llvm-svn: 149875
OpenPOWER on IntegriCloud