[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
This commit is contained in:
parent
e3919c6baf
commit
4e636156ef
|
@ -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.)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue