Skip to content

Commit 4e63615

Browse files
committed
[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 llvm-svn: 365424
1 parent e3919c6 commit 4e63615

15 files changed

+16
-16
lines changed

compiler-rt/lib/asan/asan_malloc_win.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "sanitizer_common/sanitizer_allocator_interface.h"
15+
#include "sanitizer_common/sanitizer_platform.h"
16+
#if SANITIZER_WINDOWS
1517
// Need to include defintions for windows heap api functions,
1618
// these assume windows.h will also be included. This definition
1719
// fixes an error that's thrown if you only include heapapi.h
@@ -24,8 +26,6 @@
2426
#endif
2527
#include <heapapi.h>
2628

27-
#include "sanitizer_common/sanitizer_platform.h"
28-
#if SANITIZER_WINDOWS
2929
// Intentionally not including windows.h here, to avoid the risk of
3030
// pulling in conflicting declarations of these functions. (With mingw-w64,
3131
// there's a risk of windows.h pulling in stdint.h.)

compiler-rt/test/asan/TestCases/Windows/heapalloc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// XFAIL: asan-64-bits
1+
// UNSUPPORTED: asan-64-bits
22
// RUN: %clang_cl_asan -O0 %s -Fe%t
33
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
44

compiler-rt/test/asan/TestCases/Windows/heapalloc_doublefree.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
#include <cassert>
55
#include <windows.h>
66

compiler-rt/test/asan/TestCases/Windows/heapalloc_flags_fallback.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t
22
// RUN: %run %t 2>&1 | FileCheck %s
33
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
4-
// XFAIL: asan-64-bits
4+
// UNSUPPORTED: asan-64-bits
55
#include <assert.h>
66
#include <stdio.h>
77
#include <windows.h>

compiler-rt/test/asan/TestCases/Windows/heapalloc_huge.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t
22
// RUN: %env_asan_opts=allocator_may_return_null=true %run %t
33
// RUN: %env_asan_opts=allocator_may_return_null=true:windows_hook_rtl_allocators=true %run %t
4-
// XFAIL: asan-64-bits
4+
// UNSUPPORTED: asan-64-bits
55
#include <windows.h>
66
int main() {
77
void *nope = HeapAlloc(GetProcessHeap(), 0, ((size_t)0) - 1);

compiler-rt/test/asan/TestCases/Windows/heapalloc_rtl_transfer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// RUN: %clang_cl_asan %s -o%t
77
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
8-
// XFAIL: asan-64-bits
8+
// UNSUPPORTED: asan-64-bits
99

1010
using AllocateFunctionPtr = PVOID(__stdcall *)(PVOID, ULONG, SIZE_T);
1111
using ReAllocateFunctionPtr = PVOID(__stdcall *)(PVOID, ULONG, PVOID, SIZE_T);

compiler-rt/test/asan/TestCases/Windows/heapalloc_transfer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <windows.h>
55
// RUN: %clang_cl_asan %s -o%t
66
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
7-
// XFAIL: asan-64-bits
7+
// UNSUPPORTED: asan-64-bits
88

99
int main() {
1010
//owned by rtl

compiler-rt/test/asan/TestCases/Windows/heapalloc_uaf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
#include <windows.h>
55

66
int main() {

compiler-rt/test/asan/TestCases/Windows/heapalloc_zero_size.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s
44
// RUN: %clang_cl /Od -o %t %s
55
// RUN: %run %t 2>&1 | FileCheck %s
6-
// XFAIL: asan-64-bits
6+
// UNSUPPORTED: asan-64-bits
77
#include <cassert>
88
#include <stdio.h>
99
#include <windows.h>

compiler-rt/test/asan/TestCases/Windows/heaprealloc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
#include <stdio.h>
55
#include <windows.h>
66

compiler-rt/test/asan/TestCases/Windows/heaprealloc_alloc_zero.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan /Od /MT -o %t %s
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
#include <cassert>
55
#include <iostream>
66
#include <windows.h>

compiler-rt/test/asan/TestCases/Windows/heaprealloc_zero_size.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s
44
// RUN: %clang_cl /Od -o %t %s
55
// RUN: %run %t 2>&1 | FileCheck %s
6-
// XFAIL: asan-64-bits
6+
// UNSUPPORTED: asan-64-bits
77
#include <cassert>
88
#include <stdio.h>
99
#include<windows.h>

compiler-rt/test/asan/TestCases/Windows/rtlallocateheap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t /MD
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
// REQUIRES: asan-rtl-heap-interception
55

66
#include <stdio.h>

compiler-rt/test/asan/TestCases/Windows/rtlallocateheap_flags_fallback.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t /MD
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
// REQUIRES: asan-rtl-heap-interception
55

66
#include <assert.h>

compiler-rt/test/asan/TestCases/Windows/rtlallocateheap_zero.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cl_asan -O0 %s -Fe%t /MD
22
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
3-
// XFAIL: asan-64-bits
3+
// UNSUPPORTED: asan-64-bits
44
// REQUIRES: asan-rtl-heap-interception
55

66
#include <assert.h>

0 commit comments

Comments
 (0)