summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/asan/TestCases/Windows
Commit message (Collapse)AuthorAgeFilesLines
* [asan] Update Windows test expectations for LLVM's MS demanglerReid Kleckner2019-10-171-1/+1
| | | | | | | | After r375041 llvm-symbolizer uses it for demangling instead of UnDecorateSymbolName. LLVM puts spaces after commas while Microsoft does not. llvm-svn: 375147
* compiler-rt: Rename cc files below test/asan to cppNico Weber2019-08-05119-146/+146
| | | | | | See r367803 and similar other changes. llvm-svn: 367887
* compiler-rt: Rename .cc file in lib/asan to .cppNico Weber2019-08-011-3/+3
| | | | | | Like r367463, but for asan. llvm-svn: 367558
* Change another test I missed in r365724Nico Weber2019-07-111-1/+1
| | | | llvm-svn: 365725
* clang-cl: Remove -O0 optionNico Weber2019-07-1189-121/+121
| | | | | | | | | | | | cl.exe doesn't understand it; there's /Od instead. See also the review thread for r229575. Update lots of compiler-rt tests to use -Od instead of -O0. Ran `rg -l 'clang_cl.*O0' compiler-rt/test/ | xargs sed -i -c 's/-O0/-Od/'` Differential Revision: https://reviews.llvm.org/D64506 llvm-svn: 365724
* [sanitizers][windows] FIX: Rtl-Heap Interception and testsMatthew G McGovern2019-07-0914-14/+14
| | | | | | | | | | | | - 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-0922-4/+746
| | | | | | | | | - 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-0822-746/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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-0822-4/+746
| | | | | | | | | - 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
* [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*Reid Kleckner2019-06-271-0/+0
| | | | | | | | | | | | | These lit configuration files are really Python source code. Using the .py file extension helps editors and tools use the correct language mode. LLVM and Clang already use this convention for lit configuration, this change simply applies it to all of compiler-rt. Reviewers: vitalybuka, dberris Differential Revision: https://reviews.llvm.org/D63658 llvm-svn: 364591
* [AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in ↵Matthew G McGovern2019-04-292-0/+58
| | | | | | | | | | | 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
* [asan] Disable -Wfortify-source in intentional OOB testsReid Kleckner2019-03-182-4/+4
| | | | | | Needed after r356397 llvm-svn: 356426
* Revert r346560 "[winasan] Unpoison the stack in NtTerminateThread"Reid Kleckner2018-11-291-1/+0
| | | | | | | | | | | This reverts r343606 again. The NtTerminateThread interceptor is causing problems in NaCl: https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/CrWinAsan/1839 I reproduced the problem locally and tried my best to debug them, but it's beyond me. llvm-svn: 347933
* Re-land r343606 "[winasan] Unpoison the stack in NtTerminateThread"Reid Kleckner2018-11-091-0/+1
| | | | | | | | | This change was reverted because it caused some nacl tests in chromium to fail. I attempted to reproduce those problems locally, but I was unable to. Let's reland this and let Chromium's test infrastructure discover any problems. llvm-svn: 346560
* Revert r343606/r342652 "[winasan] Unpoison the stack in NtTerminateThread""Reid Kleckner2018-10-051-1/+0
| | | | | | This still seems to be causing pnacl + asan to crash. llvm-svn: 343876
* Reland r342652 "[winasan] Unpoison the stack in NtTerminateThread"David Major2018-10-021-0/+1
| | | | | | | | In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall. Differential Revision: https://reviews.llvm.org/D52091 llvm-svn: 343606
* Revert r342652 "[winasan] Unpoison the stack in NtTerminateThread"Hans Wennborg2018-09-281-1/+0
| | | | | | | | | | | | | This seems to cause the thread's exit code to be clobbered, breaking Chromium tests. Also revert follow-up r342654. > In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall. > > Differential Revision: https://reviews.llvm.org/D52091 llvm-svn: 343322
* Fix test after r342652David Major2018-09-201-0/+1
| | | | llvm-svn: 342654
* [compiler-rt] Get rid of "%T" expansionsFilipe Cabecinhas2018-07-101-2/+2
| | | | | | | | | | | | | | | | | | | Summary: Original patch by Kuba Mracek The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in compiler-rt. Differential Revision: https://reviews.llvm.org/D48618 llvm-svn: 336661
* [asan] Add flushes to try to fix testReid Kleckner2018-06-201-1/+2
| | | | llvm-svn: 335089
* [asan] Add Windows test for handle_segv and SetUnhandledExceptionFilterReid Kleckner2018-06-201-0/+35
| | | | llvm-svn: 335087
* [asan] Align __asan_global_start so that it works with LLDReid Kleckner2018-04-261-0/+18
| | | | | | | | | | | Otherwise LLD will not align the .ASAN$GA section start, and &__asan_globals + 1 will not be the start of the next real ASan global metadata in .ASAN$GL. We discovered this issue when attempting to use LLD on Windows in Chromium: https://crbug.com/837090 llvm-svn: 330990
* [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-03-281-1/+1
| | | | | | | | | | | | | | | | | | Summary: Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, not stack, no details, not too helpful nor informative. To improve the situation, ASan detailed errors were defined and reported under the appropriate conditions. Issue: https://github.com/google/sanitizers/issues/887 Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328722
* Enable PDB generation with lld in asan and cfi tests on Windows.Peter Collingbourne2017-11-171-5/+1
| | | | | | | | | PDB emission now works well enough that we can rely on it for these tests to pass. Differential Revision: https://reviews.llvm.org/D40188 llvm-svn: 318546
* [ubsan] Fix interface_symbols_windows testVitaly Buka2017-09-181-0/+1
| | | | | | | | | | | | | | | Summary: 1. Update ubsan_interface.inc to make the test happy. 2. Switch interface_symbols_linux and interface_symbols_darwin to C++ to import __ubsan_handle_dynamic_type_cache_miss 3. Switch interface_symbols_windows to C++ for consistency. Reviewers: rnk, zturner Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37986 llvm-svn: 313551
* [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzerMatt Morehouse2017-08-301-0/+1
| | | | | | | | | | | | | | | | | | Summary: - Don't sanitize __sancov_lowest_stack. - Don't instrument leaf functions. - Add CoverageStackDepth to Fuzzer and FuzzerNoLink. - Only enable on Linux. Reviewers: vitalybuka, kcc, george.karpenkov Reviewed By: kcc Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37156 llvm-svn: 312185
* [asan] Update unittest for changes in logging r308637Vitaly Buka2017-07-201-3/+3
| | | | llvm-svn: 308647
* [Sanitizers] Fix allocator OOM test on Windows.Alex Shlyapnikov2017-06-161-1/+1
| | | | | | | | | | | | | | Summary: Point of failure is different after D34243, hence the change of the message. Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34292 llvm-svn: 305580
* Revert my bad winasan coverage test fix and apply one that actually worksReid Kleckner2017-05-032-3/+3
| | | | | | trace-pc doesn't work, but trace-pc-guard does. *shrug* llvm-svn: 302045
* Speculative fix for WinASan after r301994Reid Kleckner2017-05-031-1/+1
| | | | llvm-svn: 302043
* [asan] Fix Windows global dead stripping testsReid Kleckner2017-04-242-4/+4
| | | | | | | Pass /Gw to clang-cl which is equivalent to -fdata-sections. This is now necessary. llvm-svn: 301272
* [cfi] Run tests with and without lld and thinlto.Evgeniy Stepanov2017-04-211-1/+1
| | | | | | | Run tests in all configurations: (standalone, with devirtualization) * (gold, lld) * (lto, thinlto) llvm-svn: 301016
* [asan] Support line numbers in StackVarDescrKuba Mracek2017-03-3014-14/+14
| | | | | | | | When -fsanitize-address-use-after-scope is used, the instrumentation produces line numbers in stack frame descriptions. This patch make sure the ASan runtime supports this format (ParseFrameDescription needs to be able to parse "varname:line") and prepares lit tests to allow line numbers in ASan report output. Differential Revision: https://reviews.llvm.org/D31484 llvm-svn: 299043
* Use lld-link /nopdb to suppress PDB generation when DWARF is requiredReid Kleckner2017-03-221-2/+2
| | | | | | Fixes cfi/stats.cpp and asan/fuse-lld.cc on Windows. llvm-svn: 298545
* [compiler-rt][asan] Add support for desallocation of unhandled pointersEtienne Bergeron2017-02-211-0/+30
| | | | | | | | | | | | | | Summary: On windows 10, the ucrt DLL is performing allocations before the function hooking and there are multiple allocations not handled by Asan. When a free occur at the end of the process, asan is reporting desallocations not malloc-ed. Reviewers: rnk, kcc Reviewed By: rnk, kcc Subscribers: kcc, llvm-commits, kubamracek, chrisha, dberris Differential Revision: https://reviews.llvm.org/D25946 llvm-svn: 295730
* [compiler-rt][asan|win] Force tls_init test to use dynamic runtimeEtienne Bergeron2017-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: There is no guarantee that the tls_init is executed on the static runtime (/MT). On windows 7, this unittest is failing. On windows 10, I believe it's working because of the new CRT. On ASAN side, it doesn't matter that the hook point is run or not. It must be run only if there is other tls_initializer that are registered. Reviewers: rnk, chrisha Reviewed By: rnk Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D29838 llvm-svn: 295057
* [asan] Intercept SetUnhandledExceptionFilter.Marcos Pividori2017-02-021-0/+1
| | | | | | | | | | | | | | | | In this diff I update the code for asan on Windows, so we can intercept SetUnhandledExceptionFilter and catch some exceptions depending on the result of IsHandledDeadlyException() (which depends on asan flags). This way we have the same behavior on Windows and Posix systems. On Posix, we intercept signal and sigaction, so user's code can only register signal handlers for signals that are not handled by asan. After this diff, the same happens on Windows, user's code can only register exception handlers for exceptions that are not handled by asan. Differential Revision: https://reviews.llvm.org/D29463 llvm-svn: 293957
* [sanitizer] Add list of symbols exported in sanitizers' interface.Marcos Pividori2017-01-312-16/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new auxiliary file to each sanitizer: sanitizer_interface.inc, listing all the functions exported, with the macros: INTERFACE_FUNCTION() and INTERFACE_WEAK_FUNCTION(). So, when we need to define or repeat a procedure for each function in the sanitizer's interface, we can define the macros and include that header. In particular, these files are needed for Windows, in the nexts commits. Also, this files could replace the existing files: weak_symbols.txt for Apple. Instead of reading weak_symbols.txt to get the list of weak symbols, we could read the file sanitizer_interface.inc and consider all the symbols included with the macro INTERFACE_WEAK_FUNCTION(Name). In this commit, I only include these files to the sanitizers that work on Windows. We could do the same for the rest of the sanitizers when needed. I updated tests for: Linux, Darwin and Windows. If a new function is exported but is not present in the interface list, the tests "interface_symbols_[darwin|windows|linux].c" fail. Also, I remove the comments: "/* OPTIONAL */" which are not required any more, because we use the macro: INTERFACE_WEAK_FUNCTION() for weak functions. Differential Revision: https://reviews.llvm.org/D29148 llvm-svn: 293682
* General definition for weak functionsMarcos Pividori2017-01-291-0/+1
| | | | | | | | | | | | | | | | | | In this diff, I define a general macro for defining weak functions with a default implementation: "SANITIZER_INTERFACE_WEAK_DEF()". This way, we simplify the implementation for different platforms. For example, we cannot define weak functions on Windows, but we can use linker pragmas to create an alias to a default implementation. All of these implementation details are hidden in the new macro. Also, as I modify the name for exported weak symbols on Windows, I needed to temporarily disable "dll_host" test for asan, which checks the list of functions included in asan_win_dll_thunk. Differential Revision: https://reviews.llvm.org/D28596 llvm-svn: 293419
* [asan] Un-XFAIL Windows global dead stripping test casesReid Kleckner2016-11-212-6/+0
| | | | | | Test update for r287576 llvm-svn: 287577
* [asan] Create a .ASAN$G(A-Z) section for global registrationReid Kleckner2016-11-172-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The expectation is that new instrumented code will add global variable metadata to the .ASAN$GL section, and we will use this new code to iterate over it. This technique seems to break when using incremental linking, which seems to align every global to a 256 byte boundary. Presumably this is so that it can incrementally cope with global changing size. Clang already passes -incremental:no as a linker flag when you invoke it to do the link step. The two tests added for this feature will fail until the LLVM instrumentation change in D26770 lands, so they are marked XFAIL for now. Reviewers: pcc, kcc, mehdi_amini, kubabrecka Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26771 llvm-svn: 287246
* Remove pwd to fix WinASan botReid Kleckner2016-11-141-1/+0
| | | | | | It only slipped in while I was debugging the test case. llvm-svn: 286854
* [asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initializationReid Kleckner2016-11-141-0/+18
| | | | | | | | | | | | | | | | | | | | | | | Summary: ASan needs to initialize before ucrtbase.dll so that it can intercept all of its heap allocations. New versions of dbghelp.dll depend on ucrtbase.dll, which means both of those DLLs will initialize before the dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we avoid the issue. Eventually, I would like to remove our dbghelp.dll dependency in favor of always using llvm-symbolizer.exe, but this seems like an acceptable interim solution. Fixes PR30903 Reviewers: etienneb Subscribers: kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26473 llvm-svn: 286848
* Add a test that uses coverage and printf from a DLLReid Kleckner2016-11-111-0/+17
| | | | | | This test fails without LLVM r286615 llvm-svn: 286618
* [asan/win] Add init hooks to .CRT$XLABReid Kleckner2016-11-081-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: User applications may register hooks in the .CRT$XL* callback list, which is called very early by the loader. This is very common in Chromium: https://cs.chromium.org/search/?q=CRT.XL&sq=package:chromium&type=cs This has flown under the radar for a long time because the loader appears to catch exceptions originating from these callbacks. It's a real problem when you're debugging an asan application, though, since it makes the program crash early. The solution is to add our own callback to this list, and sort it very early in the list like we do elsewhere. Also add a test with such an instrumented callback, and test that it gets called with asan. Reviewers: etienneb Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D26404 llvm-svn: 286290
* [asan] Add more dynamic CRT mode testsReid Kleckner2016-11-024-38/+5
| | | | | | | | | | | | Only tests using %clang_cl_asan were using the dynamic CRT before this. The unit tests and lit tests using %clangxx_asan were using the static CRT. Many cross-platform tests fail with the dynamic CRT, so I had to add win32-(static|dynamic)-asan lit features. Also deletes some redundant tests in TestCases/Windows that started failing with this switch. llvm-svn: 285821
* [compiler-rt][asan] Disable a broken test on windows 64-bitsEtienne Bergeron2016-09-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This test is broken on wndows 64-bit. The interception library is not able to hook on the memchr functions. Snippet of the function that is not hookable: ``` --- No source file ------------------------------------------------------------- 000007FEFA1A18CD CC int 3 000007FEFA1A18CE CC int 3 000007FEFA1A18CF CC int 3 --- f:\dd\vctools\crt\vcruntime\src\string\amd64_arm_arm64\memchr.c ------------ while ( cnt && (*(unsigned char *)buf != (unsigned char)chr) ) { 000007FEFA1A18D0 4D 85 C0 test r8,r8 000007FEFA1A18D3 74 0D je memchr+12h (07FEFA1A18E2h) 000007FEFA1A18D5 38 11 cmp byte ptr [rcx],dl 000007FEFA1A18D7 74 09 je memchr+12h (07FEFA1A18E2h) buf = (unsigned char *)buf + 1; 000007FEFA1A18D9 48 FF C1 inc rcx cnt--; 000007FEFA1A18DC 49 83 E8 01 sub r8,1 000007FEFA1A18E0 75 F3 jne memchr+5h (07FEFA1A18D5h) } ``` Reviewers: rnk Subscribers: kubabrecka, dberris, llvm-commits, chrisha Differential Revision: https://reviews.llvm.org/D25037 llvm-svn: 282860
* [compiler-rt][asan] Fix incorrect regexp breaking an asan unittest on win64Etienne Bergeron2016-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: On windows, the memcpy and memmove function can be the same. This is correcly detected when hooking, but it's not possible to report the right function name when doing symbolisation. The same fix was applied for the static asan unittest. We forgot to apply the fix for the dynamic asan tests. ``` lvm\projects\compiler-rt\test\asan/TestCases/Windows/.svn/text-base/intercept_memcpy.cc.svn-base:// CHECK-NEXT: __asan_{{.*}}mem{{.*}} ``` This patch is fixing this test (win64): ``` ddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc ``` Reviewers: rnk, vitalybuka Subscribers: llvm-commits, kubabrecka, chrisha, dberris Differential Revision: https://reviews.llvm.org/D25038 llvm-svn: 282859
* Fix two tests in Win64 ASanReid Kleckner2016-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | Go back to intercepting kernel32!RaiseException, and only go for ntdll!RtlRaiseException if that fails. Fixes throw_and_catch.cc test. Work around an issue in LLVM's win64 epilogues. We end up with an epilogue that looks like this, and it drives the Win64 unwinder crazy until stack overflow: call ill_cc!__asan_handle_no_return xor eax,eax add rsp,40h // epilogue starts pop rbp // CSR ud2 // Trap here ret // Ret? nop word ptr [rax+rax] sub rsp,28h // Next function Will file a PR soon. llvm-svn: 277874
* Fix dumping of process module list and test itReid Kleckner2016-08-051-0/+29
| | | | | | I probably broke this a year ago in r243895. llvm-svn: 277842
OpenPOWER on IntegriCloud