Extended Description
Hi,
ASAN on Clang 5.0.0 on Windows seems not to handle exception rethrow properly; it dies with a NULL pointer exception. A simple example (that uses a separate helper function to do the rethrow, but it dies even without it, although in a different and less helpful way):
#include
#include
void func()
{
throw std::runtime_error("hello, world");
}
void handle_rethrow()
{
try {
throw;
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
}
}
int main(void)
{
try {
func();
} catch (...) {
handle_rethrow();
}
}
C:\Users\sgunders\source>cl /c /EHsc -fsanitize=address test.cpp
C:\Users\sgunders\source>"c:\Program Files\LLVM\bin\lld-link.exe" /out:test.exe test.obj "c:\Program Files\LLVM\lib\clang\5.0.0\lib\windows\clang_rt.asan_cxx-x86_64.lib" "c:\Program Files\LLVM\lib\clang\5.0.0\lib\windows\clang_rt.asan-x86_64.lib"
C:\Users\sgunders\source>.\test.exe
==33004==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000000 (pc 0x7ff7413fb2d4 bp 0x002c886fd390 sp 0x002c886fad00 T0)
==33004==The signal is caused by a READ memory access.
==33004==Hint: address points to the zero page.
#0 0x7ff7413fb2d3 in _asan_test_only_reported_buggy_pointer+0xc982a3 (C:\Users\sgunders\source\test.exe+0x140cbb2d3)
#1 0x7ff74145258f in _asan_after_dynamic_init+0x243bf (C:\Users\sgunders\source\test.exe+0x140d1258f)
#2 0x7ff741448327 in _asan_after_dynamic_init+0x1a157 (C:\Users\sgunders\source\test.exe+0x140d08327)
#3 0x7ffe6600a162 in RtlCaptureContext+0x3c2 (C:\Windows\SYSTEM32\ntdll.dll+0x1800aa162)
#4 0x7ff7413fb20a in _asan_test_only_reported_buggy_pointer+0xc981da (C:\Users\sgunders\source\test.exe+0x140cbb20a)
#5 0x7ff7413fb3a2 in _asan_test_only_reported_buggy_pointer+0xc98372 (C:\Users\sgunders\source\test.exe+0x140cbb3a2)
#6 0x7ff74145258f in _asan_after_dynamic_init+0x243bf (C:\Users\sgunders\source\test.exe+0x140d1258f)
#7 0x7ff741448327 in _asan_after_dynamic_init+0x1a157 (C:\Users\sgunders\source\test.exe+0x140d08327)
#8 0x7ffe6600a162 in RtlCaptureContext+0x3c2 (C:\Windows\SYSTEM32\ntdll.dll+0x1800aa162)
#9 0x7ff7413fb36d in _asan_test_only_reported_buggy_pointer+0xc9833d (C:\Users\sgunders\source\test.exe+0x140cbb36d)
#10 0x7ff74143c6c4 in _asan_after_dynamic_init+0xe4f4 (C:\Users\sgunders\source\test.exe+0x140cfc6c4)
#11 0x7ffe636f8363 in BaseThreadInitThunk+0x13 (C:\Windows\System32\KERNEL32.DLL+0x180008363)
#12 0x7ffe65fc7090 in RtlUserThreadStart+0x20 (C:\Windows\SYSTEM32\ntdll.dll+0x180067090)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: access-violation (C:\Users\sgunders\source\test.exe+0x140cbb2d3) in _asan_test_only_reported_buggy_pointer+0xc982a3
==33004==ABORTING
The same code works without fault with ASAN on Linux, and without ASAN on Windows.
Extended Description
Hi,
ASAN on Clang 5.0.0 on Windows seems not to handle exception rethrow properly; it dies with a NULL pointer exception. A simple example (that uses a separate helper function to do the rethrow, but it dies even without it, although in a different and less helpful way):
#include
#include
void func()
{
throw std::runtime_error("hello, world");
}
void handle_rethrow()
{
try {
throw;
} catch (std::exception &e) {
std::cout << e.what() << std::endl;
}
}
int main(void)
{
try {
func();
} catch (...) {
handle_rethrow();
}
}
C:\Users\sgunders\source>cl /c /EHsc -fsanitize=address test.cpp
C:\Users\sgunders\source>"c:\Program Files\LLVM\bin\lld-link.exe" /out:test.exe test.obj "c:\Program Files\LLVM\lib\clang\5.0.0\lib\windows\clang_rt.asan_cxx-x86_64.lib" "c:\Program Files\LLVM\lib\clang\5.0.0\lib\windows\clang_rt.asan-x86_64.lib"
C:\Users\sgunders\source>.\test.exe
==33004==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000000 (pc 0x7ff7413fb2d4 bp 0x002c886fd390 sp 0x002c886fad00 T0)
==33004==The signal is caused by a READ memory access.
==33004==Hint: address points to the zero page.
#0 0x7ff7413fb2d3 in _asan_test_only_reported_buggy_pointer+0xc982a3 (C:\Users\sgunders\source\test.exe+0x140cbb2d3)
#1 0x7ff74145258f in _asan_after_dynamic_init+0x243bf (C:\Users\sgunders\source\test.exe+0x140d1258f)
#2 0x7ff741448327 in _asan_after_dynamic_init+0x1a157 (C:\Users\sgunders\source\test.exe+0x140d08327)
#3 0x7ffe6600a162 in RtlCaptureContext+0x3c2 (C:\Windows\SYSTEM32\ntdll.dll+0x1800aa162)
#4 0x7ff7413fb20a in _asan_test_only_reported_buggy_pointer+0xc981da (C:\Users\sgunders\source\test.exe+0x140cbb20a)
#5 0x7ff7413fb3a2 in _asan_test_only_reported_buggy_pointer+0xc98372 (C:\Users\sgunders\source\test.exe+0x140cbb3a2)
#6 0x7ff74145258f in _asan_after_dynamic_init+0x243bf (C:\Users\sgunders\source\test.exe+0x140d1258f)
#7 0x7ff741448327 in _asan_after_dynamic_init+0x1a157 (C:\Users\sgunders\source\test.exe+0x140d08327)
#8 0x7ffe6600a162 in RtlCaptureContext+0x3c2 (C:\Windows\SYSTEM32\ntdll.dll+0x1800aa162)
#9 0x7ff7413fb36d in _asan_test_only_reported_buggy_pointer+0xc9833d (C:\Users\sgunders\source\test.exe+0x140cbb36d)
#10 0x7ff74143c6c4 in _asan_after_dynamic_init+0xe4f4 (C:\Users\sgunders\source\test.exe+0x140cfc6c4)
#11 0x7ffe636f8363 in BaseThreadInitThunk+0x13 (C:\Windows\System32\KERNEL32.DLL+0x180008363)
#12 0x7ffe65fc7090 in RtlUserThreadStart+0x20 (C:\Windows\SYSTEM32\ntdll.dll+0x180067090)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: access-violation (C:\Users\sgunders\source\test.exe+0x140cbb2d3) in _asan_test_only_reported_buggy_pointer+0xc982a3
==33004==ABORTING
The same code works without fault with ASAN on Linux, and without ASAN on Windows.