Unittest contains allocations returning NULL and fail with ASAN |
|
Issue description
Some unittests are allocating huge amount of memory and expect the allocator to fail and return NULL.
int* ptr = (int*)calloc(sizeof(int), kOverflowIntAlloc);
EXPECT_FALSE(ptr) << ptr;
ASAN runtime is detecting the NULL value and returns and error.
[ RUN ] fxcrt.FX_TryAllocOverflow
==23028==AddressSanitizer's allocator is terminating the process instead of returning 0
==23028==If you don't like this behavior set allocator_may_return_null=1
==23028==AddressSanitizer CHECK failed: D:\src\llvm\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_allocator.c
c:221 "((0)) != (0)" (0x0, 0x0)
#0 0x2d496d9 in __asan::AsanCheckFailed d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_rtl.cc:69
#1 0x2d558e3 in __sanitizer::CheckFailed d:\src\llvm\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_termin
ation.cc:79
#2 0x2d58f58 in __sanitizer::ReportAllocatorCannotReturnNull d:\src\llvm\llvm\projects\compiler-rt\lib\sanitizer_com
mon\sanitizer_allocator.cc:221
#3 0x2d604e3 in __asan::Allocator::Calloc d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_allocator.cc:607
#4 0x2d62e85 in __asan::asan_calloc d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_allocator.cc:789
#5 0x2d54f6b in calloc d:\src\llvm\llvm\projects\compiler-rt\lib\asan\asan_malloc_win.cc:82
#6 0x23d83a in fxcrt_FX_TryAllocOverflow_Test::TestBody+0xd0 (D:\src\chromium\src\out\ninja\pdfium_unittests.exe+0x5
3d83a)
#7 0x2436df4 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test,void>+0x53 (D:\src\chromium\
src\out\ninja\pdfium_unittests.exe+0x2736df4)
#8 0x2415ee4 in testing::internal::HandleExceptionsInMethodIfSupported<testing::Test,void> D:\src\chromium\src\testi
ng\gtest\src\gtest.cc:2455
#9 0x2415ad5 in testing::Test::Run D:\src\chromium\src\testing\gtest\src\gtest.cc:2474
#10 0x24174e3 in testing::TestInfo::Run D:\src\chromium\src\testing\gtest\src\gtest.cc:2656
#11 0x2418884 in testing::TestCase::Run D:\src\chromium\src\testing\gtest\src\gtest.cc:2774
#12 0x2428ea6 in testing::internal::UnitTestImpl::RunAllTests+0x80a (D:\src\chromium\src\out\ninja\pdfium_unittests.
exe+0x2728ea6)
#13 0x2436b4f in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase,testin
g::Test *>+0x53 (D:\src\chromium\src\out\ninja\pdfium_unittests.exe+0x2736b4f)
#14 0x24285ff in testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl,bool>+0xe1 (
D:\src\chromium\src\out\ninja\pdfium_unittests.exe+0x27285ff)
#15 0x2428310 in testing::UnitTest::Run+0x1c8 (D:\src\chromium\src\out\ninja\pdfium_unittests.exe+0x2728310)
#16 0x2a295f in main D:\src\chromium\src\testing\gtest\src\gtest_main.cc:36
#17 0x2d6db28 in __scrt_common_main_seh f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
#18 0x77403369 in BaseThreadInitThunk+0x11 (C:\Windows\syswow64\kernel32.dll+0x7dd73369)
#19 0x77939901 in RtlInitializeExceptionChain+0x62 (C:\Windows\SysWOW64\ntdll.dll+0x7dea9901)
#20 0x779398d4 in RtlInitializeExceptionChain+0x35 (C:\Windows\SysWOW64\ntdll.dll+0x7dea98d4)
For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.
,
Jan 13 2017
chromium ToT on linux, with arg.gn: is_asan = true is failing on linux too, with the same error.
,
Jan 19 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c9e8aae171ee0999ed1ad766089d76cf40159fee commit c9e8aae171ee0999ed1ad766089d76cf40159fee Author: etienneb <etienneb@chromium.org> Date: Thu Jan 19 16:34:51 2017 Fix ASAN default suppression symbol mangling on windows I'm working on a patch to fix asan_options on windows and I faced this two incompatibles symbols: 00D 00000000 SECT2 notype External | ?kASanDefaultSuppressions@@3PADA (char * kASanDefaultSuppressions) 01F 00000000 UNDEF notype External | _kASanDefaultSuppressions This is caused by the way the symbols are defined (i.e. extern "C"). src/build/sanitizers/asan_suppressions.cc char kASanDefaultSuppressions[] = src/build/sanitizers/sanitizer_options.cc extern "C" char kASanDefaultSuppressions[]; BUG=681027 R=eugenis@chromium.org, chrisha@chromium.com, rnk@chromium.org Review-Url: https://codereview.chromium.org/2631753002 Cr-Commit-Position: refs/heads/master@{#444764} [modify] https://crrev.com/c9e8aae171ee0999ed1ad766089d76cf40159fee/build/sanitizers/sanitizer_options.cc |
|
►
Sign in to add a comment |
|
Comment 1 by thakis@chromium.org
, Jan 13 2017