diff options
author | Matthew G McGovern <matthew.mcgovern@microsoft.com> | 2019-07-09 01:55:11 +0000 |
---|---|---|
committer | Matthew G McGovern <matthew.mcgovern@microsoft.com> | 2019-07-09 01:55:11 +0000 |
commit | 2c2d33f437730449a70cfc3e007356173f6c0fee (patch) | |
tree | d75b0afc6aec70fe8f0940a7f049364a38deb99b | |
parent | 029fefe7e4e62cbb33cf1d0f0e7a84419d8d7a18 (diff) | |
download | compiler-rt-2c2d33f437730449a70cfc3e007356173f6c0fee.tar.gz |
[sanitizers][windows] FIX: Rtl-Heap Interception and tests
- 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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@365424 91177308-0d34-0410-b5e6-96231b3b80d8
15 files changed, 16 insertions, 16 deletions
diff --git a/lib/asan/asan_malloc_win.cc b/lib/asan/asan_malloc_win.cc index 4586beb09..89d700340 100644 --- a/lib/asan/asan_malloc_win.cc +++ b/lib/asan/asan_malloc_win.cc @@ -12,6 +12,8 @@ //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_allocator_interface.h" +#include "sanitizer_common/sanitizer_platform.h" +#if SANITIZER_WINDOWS // Need to include defintions for windows heap api functions, // these assume windows.h will also be included. This definition // fixes an error that's thrown if you only include heapapi.h @@ -24,8 +26,6 @@ #endif #include <heapapi.h> -#include "sanitizer_common/sanitizer_platform.h" -#if SANITIZER_WINDOWS // Intentionally not including windows.h here, to avoid the risk of // pulling in conflicting declarations of these functions. (With mingw-w64, // there's a risk of windows.h pulling in stdint.h.) diff --git a/test/asan/TestCases/Windows/heapalloc.cc b/test/asan/TestCases/Windows/heapalloc.cc index 66322a3e7..30e70c39e 100644 --- a/test/asan/TestCases/Windows/heapalloc.cc +++ b/test/asan/TestCases/Windows/heapalloc.cc @@ -1,4 +1,4 @@ -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s diff --git a/test/asan/TestCases/Windows/heapalloc_doublefree.cc b/test/asan/TestCases/Windows/heapalloc_doublefree.cc index dcdf98932..9ad5ecccc 100644 --- a/test/asan/TestCases/Windows/heapalloc_doublefree.cc +++ b/test/asan/TestCases/Windows/heapalloc_doublefree.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <cassert> #include <windows.h> diff --git a/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc b/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc index eda94ac00..d118e2df7 100644 --- a/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc +++ b/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc @@ -1,7 +1,7 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: %run %t 2>&1 | FileCheck %s // RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <assert.h> #include <stdio.h> #include <windows.h> diff --git a/test/asan/TestCases/Windows/heapalloc_huge.cc b/test/asan/TestCases/Windows/heapalloc_huge.cc index ce1fd6562..3c0feff69 100644 --- a/test/asan/TestCases/Windows/heapalloc_huge.cc +++ b/test/asan/TestCases/Windows/heapalloc_huge.cc @@ -1,7 +1,7 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: %env_asan_opts=allocator_may_return_null=true %run %t // RUN: %env_asan_opts=allocator_may_return_null=true:windows_hook_rtl_allocators=true %run %t -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <windows.h> int main() { void *nope = HeapAlloc(GetProcessHeap(), 0, ((size_t)0) - 1); diff --git a/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc b/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc index b621270d7..a36e59470 100644 --- a/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc +++ b/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc @@ -5,7 +5,7 @@ // RUN: %clang_cl_asan %s -o%t // RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits using AllocateFunctionPtr = PVOID(__stdcall *)(PVOID, ULONG, SIZE_T); using ReAllocateFunctionPtr = PVOID(__stdcall *)(PVOID, ULONG, PVOID, SIZE_T); diff --git a/test/asan/TestCases/Windows/heapalloc_transfer.cc b/test/asan/TestCases/Windows/heapalloc_transfer.cc index b3b5746d6..497d36b41 100644 --- a/test/asan/TestCases/Windows/heapalloc_transfer.cc +++ b/test/asan/TestCases/Windows/heapalloc_transfer.cc @@ -4,7 +4,7 @@ #include <windows.h> // RUN: %clang_cl_asan %s -o%t // RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits int main() { //owned by rtl diff --git a/test/asan/TestCases/Windows/heapalloc_uaf.cc b/test/asan/TestCases/Windows/heapalloc_uaf.cc index 00fb3ab6f..9aee5bbda 100644 --- a/test/asan/TestCases/Windows/heapalloc_uaf.cc +++ b/test/asan/TestCases/Windows/heapalloc_uaf.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <windows.h> int main() { diff --git a/test/asan/TestCases/Windows/heapalloc_zero_size.cc b/test/asan/TestCases/Windows/heapalloc_zero_size.cc index 23fc97b20..40396ed5f 100644 --- a/test/asan/TestCases/Windows/heapalloc_zero_size.cc +++ b/test/asan/TestCases/Windows/heapalloc_zero_size.cc @@ -3,7 +3,7 @@ // RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s // RUN: %clang_cl /Od -o %t %s // RUN: %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <cassert> #include <stdio.h> #include <windows.h> diff --git a/test/asan/TestCases/Windows/heaprealloc.cc b/test/asan/TestCases/Windows/heaprealloc.cc index e6efb87b5..21589cf83 100644 --- a/test/asan/TestCases/Windows/heaprealloc.cc +++ b/test/asan/TestCases/Windows/heaprealloc.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <stdio.h> #include <windows.h> diff --git a/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc b/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc index 76ae89690..7b1272ea5 100644 --- a/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc +++ b/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan /Od /MT -o %t %s // RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <cassert> #include <iostream> #include <windows.h> diff --git a/test/asan/TestCases/Windows/heaprealloc_zero_size.cc b/test/asan/TestCases/Windows/heaprealloc_zero_size.cc index ad2478b19..96bc9b90c 100644 --- a/test/asan/TestCases/Windows/heaprealloc_zero_size.cc +++ b/test/asan/TestCases/Windows/heaprealloc_zero_size.cc @@ -3,7 +3,7 @@ // RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s // RUN: %clang_cl /Od -o %t %s // RUN: %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits #include <cassert> #include <stdio.h> #include<windows.h> diff --git a/test/asan/TestCases/Windows/rtlallocateheap.cc b/test/asan/TestCases/Windows/rtlallocateheap.cc index 5831fe27b..27738e9d5 100644 --- a/test/asan/TestCases/Windows/rtlallocateheap.cc +++ b/test/asan/TestCases/Windows/rtlallocateheap.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t /MD // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits // REQUIRES: asan-rtl-heap-interception #include <stdio.h> diff --git a/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc b/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc index c377fe360..738bf0fa7 100644 --- a/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc +++ b/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t /MD // RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits // REQUIRES: asan-rtl-heap-interception #include <assert.h> diff --git a/test/asan/TestCases/Windows/rtlallocateheap_zero.cc b/test/asan/TestCases/Windows/rtlallocateheap_zero.cc index d4bde7857..ef372a176 100644 --- a/test/asan/TestCases/Windows/rtlallocateheap_zero.cc +++ b/test/asan/TestCases/Windows/rtlallocateheap_zero.cc @@ -1,6 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t /MD // RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s -// XFAIL: asan-64-bits +// UNSUPPORTED: asan-64-bits // REQUIRES: asan-rtl-heap-interception #include <assert.h> |