-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Description
Reproducer courtesy of @danakj
Consider:
#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[]) {
STARTUPINFOA startup_info;
ZeroMemory(&startup_info, sizeof(startup_info));
startup_info.cb = sizeof(startup_info);
PROCESS_INFORMATION process_info;
ZeroMemory(&process_info, sizeof(process_info));
if (CreateProcessA("C:\\Windows\\System32\\cmd.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info)) {
fprintf(stderr, "OK!\n");
CloseHandle(process_info.hThread);
WaitForSingleObject(process_info.hProcess, INFINITE);
CloseHandle(process_info.hProcess);
} else {
fprintf(stderr, "FAILED! %d\n", (int)GetLastError());
return 1;
}
}
Building with ASan and running without any special flags, it works:
C:\src\llvm-project>build\bin\clang-cl -fsanitize=address \src\temp\a.cc
C:\src\llvm-project>a.exe
OK!
Microsoft Windows [Version 10.0.19045.4894]
(c) Microsoft Corporation. All rights reserved.
Setting windows_hook_rtl_allocators (introduced in c9fa99d) causes it to fail:
C:\src\llvm-project>set ASAN_OPTIONS=windows_hook_rtl_allocators=1
C:\src\llvm-project>a.exe
FAILED! 87