[compiler-rt] r365424 - [sanitizers][windows] FIX: Rtl-Heap Interception and tests

Matthew G McGovern via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 18:55:11 PDT 2019


Author: mcgov
Date: Mon Jul  8 18:55:11 2019
New Revision: 365424

URL: http://llvm.org/viewvc/llvm-project?rev=365424&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/lib/asan/asan_malloc_win.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_doublefree.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_huge.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_transfer.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_uaf.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_zero_size.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_zero_size.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc
    compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_zero.cc

Modified: compiler-rt/trunk/lib/asan/asan_malloc_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_win.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_malloc_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_malloc_win.cc Mon Jul  8 18:55:11 2019
@@ -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.)

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc.cc Mon Jul  8 18:55:11 2019
@@ -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
 

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_doublefree.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_doublefree.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_doublefree.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_doublefree.cc Mon Jul  8 18:55:11 2019
@@ -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>
 

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc Mon Jul  8 18:55:11 2019
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_huge.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_huge.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_huge.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_huge.cc Mon Jul  8 18:55:11 2019
@@ -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);

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc Mon Jul  8 18:55:11 2019
@@ -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);

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_transfer.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_transfer.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_transfer.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_transfer.cc Mon Jul  8 18:55:11 2019
@@ -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

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_uaf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_uaf.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_uaf.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_uaf.cc Mon Jul  8 18:55:11 2019
@@ -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() {

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_zero_size.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_zero_size.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_zero_size.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heapalloc_zero_size.cc Mon Jul  8 18:55:11 2019
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc.cc Mon Jul  8 18:55:11 2019
@@ -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>
 

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc Mon Jul  8 18:55:11 2019
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_zero_size.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_zero_size.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_zero_size.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/heaprealloc_zero_size.cc Mon Jul  8 18:55:11 2019
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap.cc Mon Jul  8 18:55:11 2019
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc Mon Jul  8 18:55:11 2019
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_zero.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_zero.cc?rev=365424&r1=365423&r2=365424&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_zero.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/rtlallocateheap_zero.cc Mon Jul  8 18:55:11 2019
@@ -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>




More information about the llvm-commits mailing list