Open Bug 1689549 Opened 3 years ago Updated 3 years ago

Make BaseHashtableTest/ShallowSizeOfIncludingThis test work with ASAN builds

Categories

(Core :: XPCOM, task, P3)

task

Tracking

()

People

(Reporter: janv, Unassigned)

Details

The BaseHashtableTest/ShallowSizeOfIncludingThis test currently doesn't work with ASAN builds.
https://treeherder.mozilla.org/logviewer?job_id=328174029&repo=try&lineNumber=2974

[task 2021-01-29T06:05:14.946Z] 06:05:14 INFO - TEST-START | Hashtables/BaseHashtableTest/DefaultConstructible_DefaultConstructible.ShallowSizeOfIncludingThis
[task 2021-01-29T06:05:14.946Z] 06:05:14 INFO - =================================================================
[task 2021-01-29T06:05:14.947Z] 06:05:14 ERROR - ==1475==ERROR: AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x7ffe6b445620
[task 2021-01-29T06:05:14.947Z] 06:05:14 INFO - #0 0x555adbe5e5ed in malloc_usable_size /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:198:3
[task 2021-01-29T06:05:14.947Z] 06:05:14 INFO - #1 0x555adbde60c2 in Unwind /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_stacktrace.h:115:5
[task 2021-01-29T06:05:14.947Z] 06:05:14 INFO - #2 0x555adbde60c2 in _asan::asan_malloc_usable_size(void const*, unsigned long, unsigned long) /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_allocator.cpp:986:5
[task 2021-01-29T06:05:15.535Z] 06:05:15 INFO - #3 0x7f4f3635cc1f in MallocSizeOf /builds/worker/checkouts/gecko/xpcom/tests/gtest/TestHashtables.cpp:607:1
[task 2021-01-29T06:05:15.536Z] 06:05:15 INFO - #4 0x7f4f3635cc1f in ShallowSizeOfIncludingThis /builds/worker/workspace/obj-build/dist/include/nsBaseHashtable.h:644:12
[task 2021-01-29T06:05:15.536Z] 06:05:15 INFO - #5 0x7f4f3635cc1f in gtest_case_BaseHashtableTest
::ShallowSizeOfIncludingThis<TestHashtables::DefaultConstructible_DefaultConstructible>::TestBody() /builds/worker/checkouts/gecko/xpcom/tests/gtest/TestHashtables.cpp:899:20
[task 2021-01-29T06:05:15.551Z] 06:05:15 INFO - #6 0x7f4f36f38d97 in testing::Test::Run() /builds/worker/checkouts/gecko/testing/gtest/gtest/src/gtest.cc:2519:5
[task 2021-01-29T06:05:15.553Z] 06:05:15 INFO - #7 0x7f4f36f3acb3 in testing::TestInfo::Run() /builds/worker/checkouts/gecko/testing/gtest/gtest/src/gtest.cc:2695:11
[task 2021-01-29T06:05:15.553Z] 06:05:15 INFO - #8 0x7f4f36f3c015 in testing::TestCase::Run() /builds/worker/checkouts/gecko/testing/gtest/gtest/src/gtest.cc:2813:28
[task 2021-01-29T06:05:15.554Z] 06:05:15 INFO - #9 0x7f4f36f54506 in testing::internal::UnitTestImpl::RunAllTests() /builds/worker/checkouts/gecko/testing/gtest/gtest/src/gtest.cc:5179:43
[task 2021-01-29T06:05:15.554Z] 06:05:15 INFO - #10 0x7f4f36f538cd in testing::UnitTest::Run() /builds/worker/checkouts/gecko/testing/gtest/gtest/src/gtest.cc:4788:10
[task 2021-01-29T06:05:15.555Z] 06:05:15 INFO - #11 0x7f4f36f7e815 in RUN_ALL_TESTS /builds/worker/workspace/obj-build/dist/include/gtest/gtest.h:2342:46
[task 2021-01-29T06:05:15.555Z] 06:05:15 INFO - #12 0x7f4f36f7e815 in mozilla::RunGTestFunc(int*, char**) /builds/worker/checkouts/gecko/testing/gtest/mozilla/GTestRunner.cpp:156:10
[task 2021-01-29T06:05:15.560Z] 06:05:15 INFO - #13 0x7f4f434261f6 in XREMain::XRE_mainStartup(bool*) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:4295:16
[task 2021-01-29T06:05:15.561Z] 06:05:15 INFO - #14 0x7f4f4343a8b9 in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:5427:12
[task 2021-01-29T06:05:15.561Z] 06:05:15 INFO - #15 0x7f4f4343b833 in XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:5503:21
[task 2021-01-29T06:05:15.562Z] 06:05:15 INFO - #16 0x555adbe90f3b in do_main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:220:22
[task 2021-01-29T06:05:15.562Z] 06:05:15 INFO - #17 0x555adbe90f3b in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:344:16
[task 2021-01-29T06:05:15.583Z] 06:05:15 INFO - #18 0x7f4f5d239b96 in __libc_start_main /build/glibc-2ORdQG/glibc-2.27/csu/../csu/libc-start.c:310
[task 2021-01-29T06:05:15.585Z] 06:05:15 INFO - #19 0x555adbde3d90 in start (/builds/worker/workspace/build/application/firefox/firefox+0x55d90)
[task 2021-01-29T06:05:15.586Z] 06:05:15 INFO - Address 0x7ffe6b445620 is located in stack of thread T0 at offset 32 in frame
[task 2021-01-29T06:05:15.586Z] 06:05:15 INFO - #0 0x7f4f3635cb3f in gtest_case_BaseHashtableTest
::ShallowSizeOfIncludingThis<TestHashtables::DefaultConstructible_DefaultConstructible>::TestBody() /builds/worker/checkouts/gecko/xpcom/tests/gtest/TestHashtables.cpp:895
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - This frame has 6 object(s):
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - [32, 64) 'table' (line 896) <== Memory access at offset 32 is inside this variable
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - [96, 104) 'res' (line 899)
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - [128, 144) 'gtest_ar' (line 900)
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - [160, 164) 'ref.tmp' (line 900)
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - [176, 184) 'ref.tmp9' (line 900)
[task 2021-01-29T06:05:15.587Z] 06:05:15 INFO - [208, 216) 'ref.tmp14' (line 900)
[task 2021-01-29T06:05:15.588Z] 06:05:15 INFO - HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
[task 2021-01-29T06:05:15.588Z] 06:05:15 INFO - (longjmp and C++ exceptions are supported)
[task 2021-01-29T06:05:15.589Z] 06:05:15 INFO - SUMMARY: AddressSanitizer: bad-malloc_usable_size /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:198:3 in malloc_usable_size
[task 2021-01-29T06:05:15.589Z] 06:05:15 INFO - ==1475==ABORTING
[task 2021-01-29T06:05:15.626Z] 06:05:15 INFO - gtest INFO | gtest | process wait complete, returncode=1
[task 2021-01-29T06:05:15.627Z] 06:05:15 INFO - mozcrash checking /builds/worker/workspace/build/tests/gtest for minidumps...
[task 2021-01-29T06:05:15.628Z] 06:05:15 WARNING - gtest TEST-UNEXPECTED-FAIL | gtest | test failed with return code 1
[task 2021-01-29T06:05:15.628Z] 06:05:15 INFO - gtest INFO | rungtests.py exits with code 1
[task 2021-01-29T06:05:15.649Z] 06:05:15 ERROR - Return code: 1
[task 2021-01-29T06:05:15.649Z] 06:05:15 ERROR - No tests run or test summary not found

This seems to be a bigger issue than I thought:
https://phabricator.services.mozilla.com/D99428#inline-579286

You need to log in before you can comment on or make changes to this bug.