Page MenuHome

guardedalloc.txt ASan test failure

Authored By
Ankit Meel (ankitm)
Jan 12 2021, 1:34 PM
Size
8 KB
Subscribers
None

guardedalloc.txt ASan test failure

2021-01-12 14:24:20.981387+0530 guardedalloc_test[14049:12278639] [DYMTLInitPlatform] platform initialization successful
[==========] Running 4 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from LockFreeAllocatorTest
[ RUN ] LockFreeAllocatorTest.MEM_mallocN_aligned
[ OK ] LockFreeAllocatorTest.MEM_mallocN_aligned (1 ms)
[ RUN ] LockFreeAllocatorTest.LockfreeIntegerOverflow
=================================================================
==14049==ERROR: AddressSanitizer: requested allocation size 0xfffffffffff724e0 (0xfffffffffff734e0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
#0 0x100c30802 in wrap_calloc (/Users/ankitkumar/Applications/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x46802)
#1 0x10003bf24 in MEM_lockfree_callocN /Users/ankitkumar/blender-build/blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:235:21
#2 0x10003c44e in MEM_lockfree_calloc_arrayN /Users/ankitkumar/blender-build/blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:267:10
#3 0x10001f9e2 in (anonymous namespace)::CallocArray(unsigned long, unsigned long) /Users/ankitkumar/blender-build/blender/intern/guardedalloc/tests/guardedalloc_overflow_test.cc:28:15
#4 0x10001add2 in LockFreeAllocatorTest_LockfreeIntegerOverflow_Test::TestBody() /Users/ankitkumar/blender-build/blender/intern/guardedalloc/tests/guardedalloc_overflow_test.cc:41:3
#5 0x10013f666 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2433:10
#6 0x1000a7117 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2469:14
#7 0x1000a697b in testing::Test::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2508:5
#8 0x1000aac89 in testing::TestInfo::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2684:11
#9 0x1000af136 in testing::TestSuite::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2816:28
#10 0x1000deb1d in testing::internal::UnitTestImpl::RunAllTests() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:5338:44
#11 0x100155856 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2433:10
#12 0x1000dc5ed in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2469:14
#13 0x1000dbe8c in testing::UnitTest::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:4925:10
#14 0x10003d810 in RUN_ALL_TESTS() /Users/ankitkumar/blender-build/blender/extern/gtest/include/gtest/gtest.h:2473:46
#15 0x10003d6ac in main /Users/ankitkumar/blender-build/blender/tests/gtests/testing/testing_main.cc:58:10
#16 0x7fff59b293d4 in start (/usr/lib/system/libdyld.dylib:x86_64+0x163d4)
==14049==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: allocation-size-too-big (/Users/ankitkumar/Applications/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x46802) in wrap_calloc
2021-01-12 14:24:21.261809+0530 guardedalloc_test[14049:12278565] =================================================================
2021-01-12 14:24:21.261853+0530 guardedalloc_test[14049:12278565] ==14049==ERROR: AddressSanitizer: requested allocation size 0xfffffffffff724e0 (0xfffffffffff734e0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
2021-01-12 14:24:21.261903+0530 guardedalloc_test[14049:12278565] #0 0x100c30802 in wrap_calloc (/Users/ankitkumar/Applications/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x46802)
2021-01-12 14:24:21.261922+0530 guardedalloc_test[14049:12278565] #1 0x10003bf24 in MEM_lockfree_callocN /Users/ankitkumar/blender-build/blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:235:21
2021-01-12 14:24:21.261942+0530 guardedalloc_test[14049:12278565] #2 0x10003c44e in MEM_lockfree_calloc_arrayN /Users/ankitkumar/blender-build/blender/intern/guardedalloc/intern/mallocn_lockfree_impl.c:267:10
2021-01-12 14:24:21.261960+0530 guardedalloc_test[14049:12278565] #3 0x10001f9e2 in (anonymous namespace)::CallocArray(unsigned long, unsigned long) /Users/ankitkumar/blender-build/blender/intern/guardedalloc/tests/guardedalloc_overflow_test.cc:28:15
2021-01-12 14:24:21.262204+0530 guardedalloc_test[14049:12278565] #4 0x10001add2 in LockFreeAllocatorTest_LockfreeIntegerOverflow_Test::TestBody() /Users/ankitkumar/blender-build/blender/intern/guardedalloc/tests/guardedalloc_overflow_test.cc:41:3
2021-01-12 14:24:21.262235+0530 guardedalloc_test[14049:12278565] #5 0x10013f666 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2433:10
2021-01-12 14:24:21.262269+0530 guardedalloc_test[14049:12278565] #6 0x1000a7117 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2469:14
2021-01-12 14:24:21.262290+0530 guardedalloc_test[14049:12278565] #7 0x1000a697b in testing::Test::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2508:5
2021-01-12 14:24:21.262405+0530 guardedalloc_test[14049:12278565] #8 0x1000aac89 in testing::TestInfo::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2684:11
2021-01-12 14:24:21.262448+0530 guardedalloc_test[14049:12278565] #9 0x1000af136 in testing::TestSuite::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2816:28
2021-01-12 14:24:21.262469+0530 guardedalloc_test[14049:12278565] #10 0x1000deb1d in testing::internal::UnitTestImpl::RunAllTests() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:5338:44
2021-01-12 14:24:21.262490+0530 guardedalloc_test[14049:12278565] #11 0x100155856 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2433:10
2021-01-12 14:24:21.262638+0530 guardedalloc_test[14049:12278565] #12 0x1000dc5ed in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:2469:14
2021-01-12 14:24:21.262682+0530 guardedalloc_test[14049:12278565] #13 0x1000dbe8c in testing::UnitTest::Run() /Users/ankitkumar/blender-build/blender/extern/gtest/src/gtest.cc:4925:10
2021-01-12 14:24:21.262704+0530 guardedalloc_test[14049:12278565] #14 0x10003d810 in RUN_ALL_TESTS() /Users/ankitkumar/blender-build/blender/extern/gtest/include/gtest/gtest.h:2473:46
2021-01-12 14:24:21.262735+0530 guardedalloc_test[14049:12278565] #15 0x10003d6ac in main /Users/ankitkumar/blender-build/blender/tests/gtests/testing/testing_main.cc:58:10
2021-01-12 14:24:21.262760+0530 guardedalloc_test[14049:12278565] #16 0x7fff59b293d4 in start (/usr/lib/system/libdyld.dylib:x86_64+0x163d4)
2021-01-12 14:24:21.262877+0530 guardedalloc_test[14049:12278565]
2021-01-12 14:24:21.262914+0530 guardedalloc_test[14049:12278565] ==14049==HINT: if you don't care about these errors you may set allocator_may_return_null=1
2021-01-12 14:24:21.262935+0530 guardedalloc_test[14049:12278565] SUMMARY: AddressSanitizer: allocation-size-too-big (/Users/ankitkumar/Applications/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x46802) in wrap_calloc
==14049==ABORTING
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
Program ended with exit code: 9

File Metadata

Mime Type
text/plain
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9e/fb/bc286cfbc5402e1556ca5f2c5b73

Event Timeline

Ankit Meel (ankitm) updated the name for this file from "guardedalloc.txt" to "guardedalloc.txt ASan test failure".Jan 12 2021, 1:34 PM

diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index 6a0d104d47d..e3525e43316 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -449,7 +449,9 @@ void *MEM_guarded_mallocN(size_t len, const char *str)
 {
   MemHead *memh;
 
+  printf("malloc guarded old len = %zu\n", len);
   len = SIZET_ALIGN_4(len);
+  printf("malloc guarded req len = %zu\n", len);
 
   memh = (MemHead *)malloc(len + sizeof(MemHead) + sizeof(MemTail));
 
@@ -550,7 +552,9 @@ void *MEM_guarded_callocN(size_t len, const char *str)
 {
   MemHead *memh;
 
+  printf("calloc guarded old len = %zu\n", len);
   len = SIZET_ALIGN_4(len);
+  printf("calloc guarded req len = %zu\n", len);
 
   memh = (MemHead *)calloc(len + sizeof(MemHead) + sizeof(MemTail), 1);
 
diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
index 8f5c9cf85a9..df531a5c7a0 100644
--- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c
+++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -230,8 +230,10 @@ void *MEM_lockfree_callocN(size_t len, const char *str)
 {
   MemHead *memh;
 
+  printf("calloc lockfree old len = %zu\n", len);
   len = SIZET_ALIGN_4(len);
 
+  printf("calloc lockfree req len = %zu\n", len);
   memh = (MemHead *)calloc(1, len + sizeof(MemHead));
 
   if (LIKELY(memh)) {
@@ -271,7 +273,9 @@ void *MEM_lockfree_mallocN(size_t len, const char *str)
 {
   MemHead *memh;
 
+  printf("malloc lockfree old len = %zu\n", len);
   len = SIZET_ALIGN_4(len);
+  printf("malloc lockfree req len = %zu\n", len);
 
   memh = (MemHead *)malloc(len + sizeof(MemHead));
 
diff --git a/tests/gtests/testing/testing.h b/tests/gtests/testing/testing.h
index 81ff4470221..5896317258d 100644
--- a/tests/gtests/testing/testing.h
+++ b/tests/gtests/testing/testing.h
@@ -147,7 +147,7 @@ inline void EXPECT_EQ_ARRAY_ND(const T *expected, const T *actual, const size_t
 #ifdef _WIN32
 #  define ABORT_PREDICATE ::testing::ExitedWithCode(3)
 #else
-#  define ABORT_PREDICATE ::testing::KilledBySignal(SIGABRT)
+// Temporary to clean test output.
+#  define ABORT_PREDICATE ::testing::KilledBySignal(SIGILL)
 #endif
 
 /* Test macro for when BLI_assert() is expected to fail.
(myenv) 15:13:20 build_darwin_lite$ctest -C debug -R guardedalloc -VV
UpdateCTestConfiguration  from :/Users/ankitkumar/blender-build/build_darwin_lite/DartConfiguration.tcl
UpdateCTestConfiguration  from :/Users/ankitkumar/blender-build/build_darwin_lite/DartConfiguration.tcl
Test project /Users/ankitkumar/blender-build/build_darwin_lite
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 2
    Start 2: guardedalloc

2: Test command: /Users/ankitkumar/blender-build/build_darwin_lite/bin/tests/Debug/guardedalloc_test "--gtest_filter=LockFreeAllocatorTest.*:GuardedAllocatorTest.*" "--test-assets-dir" "/Users/ankitkumar/blender-build/blender/../lib/tests" "--test-release-dir" "/Users/ankitkumar/blender-build/build_darwin_lite/bin/Debug/Blender.app/Contents/Resources/2.93"
2: Test timeout computed to be: 10000000
2: Note: Google Test filter = LockFreeAllocatorTest.*:GuardedAllocatorTest.*
2: [==========] Running 4 tests from 2 test suites.
2: [----------] Global test environment set-up.
2: [----------] 2 tests from LockFreeAllocatorTest
2: [ RUN      ] LockFreeAllocatorTest.MEM_mallocN_aligned
2: [       OK ] LockFreeAllocatorTest.MEM_mallocN_aligned (0 ms)
2: [ RUN      ] LockFreeAllocatorTest.LockfreeIntegerOverflow
2: ==34017==WARNING: AddressSanitizer failed to allocate 0xfffffffffff724e0 bytes
2: malloc lockfree old len = 18446744073709551615
2: malloc lockfree req len = 0
2: calloc lockfree old len = 18446744073709551615
2: calloc lockfree req len = 0
2: malloc lockfree old len = 18446744073709551614
2: malloc lockfree req len = 0
2: calloc lockfree old len = 18446744073708971224
2: calloc lockfree req len = 18446744073708971224
2: [       OK ] LockFreeAllocatorTest.LockfreeIntegerOverflow (252 ms)
2: [----------] 2 tests from LockFreeAllocatorTest (252 ms total)
2: 
2: [----------] 2 tests from GuardedAllocatorTest
2: [ RUN      ] GuardedAllocatorTest.MEM_mallocN_aligned
2: [       OK ] GuardedAllocatorTest.MEM_mallocN_aligned (1 ms)
2: [ RUN      ] GuardedAllocatorTest.GuardedIntegerOverflow
2: ==34017==WARNING: AddressSanitizer failed to allocate 0xfffffffffff72518 bytes
2: Calloc returns null: len=18446744073708971224 in CallocArray, total 0
2: malloc guarded old len = 18446744073709551615
2: malloc guarded req len = 0
2: calloc guarded old len = 18446744073709551615
2: calloc guarded req len = 0
2: malloc guarded old len = 18446744073709551614
2: malloc guarded req len = 0
2: calloc guarded old len = 18446744073708971224
2: calloc guarded req len = 18446744073708971224
2: [       OK ] GuardedAllocatorTest.GuardedIntegerOverflow (308 ms)
2: [----------] 2 tests from GuardedAllocatorTest (309 ms total)
2: 
2: [----------] Global test environment tear-down
2: [==========] 4 tests from 2 test suites ran. (561 ms total)
2: [  PASSED  ] 4 tests.
1/1 Test #2: guardedalloc .....................   Passed    0.83 sec

The following tests passed:
	guardedalloc

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.89 sec