cryptohome: Memory leak in tpm2_test unittests |
||
Issue description
Leaks detected by ASan:
ERROR: LeakSanitizer: detected memory leaks
Direct leak of 25344 byte(s) in 66 object(s) allocated from:
#0 0x555ed6b49aa2 in operator new(unsigned long) ??:0:0
#1 0x555ed7cb212d in cryptohome::Tpm2Test::SetUp() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../..
/../mnt/host/source/src/platform2/cryptohome/tpm2_test.cc:79:12
#2 0x7feb2ceb17d3 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)()
, char const*) ??:0:0
#3 0x7feb2ce95281 in testing::Test::Run() ??:0:0
#4 0x7feb2ce9647f in testing::TestInfo::Run() ??:0:0
#5 0x7feb2ce96b76 in testing::TestCase::Run() ??:0:0
#6 0x7feb2ce9fb66 in testing::internal::UnitTestImpl::RunAllTests() ??:0:0
#7 0x7feb2ceb25a3 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::Unit
TestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ??:0:0
#8 0x7feb2ce9f71e in testing::UnitTest::Run() ??:0:0
#9 0x555ed80e75b8 in RUN_ALL_TESTS() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../usr/include/gtes
t/gtest.h:2233:46
#10 0x555ed80e75b8 in main /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/
platform2/common-mk/testrunner.cc:16:0
#11 0x7feb2b6c2735 in __libc_start_main /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.23-r18/work/glibc-2.23/csu/../csu/libc-start.c:289
:0
#12 0x555ed6a75948 in _start ??:0:0
Indirect leak of 5808 byte(s) in 66 object(s) allocated from:
#0 0x555ed6b49aa2 in operator new(unsigned long) ??:0:0
#1 0x7feb2c891e2d in base::WaitableEvent::WaitableEvent(bool, bool) ??:0:0
#2 0x7feb2c8a872b in base::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) ??:0:0
#3 0x555ed7ecf0e2 in cryptohome::Tpm2Impl::Tpm2Impl(trunks::TrunksFactory*, tpm_manager::TpmOwnershipInterface*, tpm_manager::TpmNvramInterface
*) /mnt/host/source/src/platform2/cryptohome/tpm2_impl.h:296:35
#4 0x555ed7cb2173 in cryptohome::Tpm2Test::SetUp() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../..
/../mnt/host/source/src/platform2/cryptohome/tpm2_test.cc:79:16
#5 0x7feb2ceb17d3 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)()
, char const*) ??:0:0
#6 0x7feb2ce95281 in testing::Test::Run() ??:0:0
#7 0x7feb2ce9647f in testing::TestInfo::Run() ??:0:0
#8 0x7feb2ce96b76 in testing::TestCase::Run() ??:0:0
#9 0x7feb2ce9fb66 in testing::internal::UnitTestImpl::RunAllTests() ??:0:0
#10 0x7feb2ceb25a3 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::Uni
tTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ??:0:0
#11 0x7feb2ce9f71e in testing::UnitTest::Run() ??:0:0
#12 0x555ed80e75b8 in RUN_ALL_TESTS() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../usr/include/gte
st/gtest.h:2233:46
#13 0x555ed80e75b8 in main /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/
platform2/common-mk/testrunner.cc:16:0
#14 0x7feb2b6c2735 in __libc_start_main /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.23-r18/work/glibc-2.23/csu/../csu/libc-start.c:289
:0
#15 0x555ed6a75948 in _start ??:0:0
Indirect leak of 5808 byte(s) in 66 object(s) allocated from:
#0 0x555ed6b49aa2 in operator new(unsigned long) ??:0:0
#1 0x7feb2c891e2d in base::WaitableEvent::WaitableEvent(bool, bool) ??:0:0
#2 0x555ed7ecf0e2 in cryptohome::Tpm2Impl::Tpm2Impl(trunks::TrunksFactory*, tpm_manager::TpmOwnershipInterface*, tpm_manager::TpmNvramInterface
*) /mnt/host/source/src/platform2/cryptohome/tpm2_impl.h:296:35
#3 0x555ed7cb2173 in cryptohome::Tpm2Test::SetUp() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../..
/../mnt/host/source/src/platform2/cryptohome/tpm2_test.cc:79:16
#4 0x7feb2ceb17d3 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)()
, char const*) ??:0:0
#5 0x7feb2ce95281 in testing::Test::Run() ??:0:0
#6 0x7feb2ce9647f in testing::TestInfo::Run() ??:0:0
#7 0x7feb2ce96b76 in testing::TestCase::Run() ??:0:0
#8 0x7feb2ce9fb66 in testing::internal::UnitTestImpl::RunAllTests() ??:0:0
#9 0x7feb2ceb25a3 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::Unit
TestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ??:0:0
#10 0x7feb2ce9f71e in testing::UnitTest::Run() ??:0:0
#11 0x555ed80e75b8 in RUN_ALL_TESTS() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../usr/include/gte
st/gtest.h:2233:46
#12 0x555ed80e75b8 in main /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/
platform2/common-mk/testrunner.cc:16:0
#13 0x7feb2b6c2735 in __libc_start_main /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.23-r18/work/glibc-2.23/csu/../csu/libc-start.c:289
:0
#14 0x555ed6a75948 in _start ??:0:0
Indirect leak of 1056 byte(s) in 66 object(s) allocated from:
#0 0x555ed6b49aa2 in operator new(unsigned long) ??:0:0
#1 0x555ed8546f96 in std::__1::__unique_if<trunks::TpmUtilityForwarder>::__unique_single std::__1::make_unique<trunks::TpmUtilityForwarder, tru
nks::TpmUtilityconst&>(trunks::TpmUtilityconst&&&) /usr/bin/../include/c++/v1/memory:3011:28
#2 0x555ed8546f96 in trunks::TrunksFactoryForTest::GetTpmUtility() const /build/snappy/var/cache/portage/chromeos-base/trunks/out/Default/../..
/../../../../../../../mnt/host/source/src/platform2/trunks/trunks_factory_for_test.cc:669:0
#3 0x555ed7ecf3ff in cryptohome::Tpm2Impl::Tpm2Impl(trunks::TrunksFactory*, tpm_manager::TpmOwnershipInterface*, tpm_manager::TpmNvramInterface
*) /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/platform2/cryptohome/tpm2_impl.
cc:229:51
#4 0x555ed7cb2173 in cryptohome::Tpm2Test::SetUp() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../..
/../mnt/host/source/src/platform2/cryptohome/tpm2_test.cc:79:16
#5 0x7feb2ceb17d3 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)()
, char const*) ??:0:0
#6 0x7feb2ce95281 in testing::Test::Run() ??:0:0
#7 0x7feb2ce9647f in testing::TestInfo::Run() ??:0:0
#8 0x7feb2ce96b76 in testing::TestCase::Run() ??:0:0
#9 0x7feb2ce9fb66 in testing::internal::UnitTestImpl::RunAllTests() ??:0:0
#10 0x7feb2ceb25a3 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::Uni
tTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ??:0:0
#11 0x7feb2ce9f71e in testing::UnitTest::Run() ??:0:0
#12 0x555ed80e75b8 in RUN_ALL_TESTS() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../usr/include/gte
st/gtest.h:2233:46
#13 0x555ed80e75b8 in main /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/
platform2/common-mk/testrunner.cc:16:0
#14 0x7feb2b6c2735 in __libc_start_main /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.23-r18/work/glibc-2.23/csu/../csu/libc-start.c:289
:0
#15 0x555ed6a75948 in _start ??:0:0 [15/48238]
Indirect leak of 1056 byte(s) in 66 object(s) allocated from:
#0 0x555ed6b49aa2 in operator new(unsigned long) ??:0:0
#1 0x555ed8546f56 in std::__1::__unique_if<trunks::TpmStateForwarder>::__unique_single std::__1::make_unique<trunks::TpmStateForwarder, trunks:
:TpmStateconst&>(trunks::TpmStateconst&&&) /usr/bin/../include/c++/v1/memory:3011:28
#2 0x555ed8546f56 in trunks::TrunksFactoryForTest::GetTpmState() const /build/snappy/var/cache/portage/chromeos-base/trunks/out/Default/../../.
./../../../../../../mnt/host/source/src/platform2/trunks/trunks_factory_for_test.cc:665:0
#3 0x555ed7ecf273 in cryptohome::Tpm2Impl::Tpm2Impl(trunks::TrunksFactory*, tpm_manager::TpmOwnershipInterface*, tpm_manager::TpmNvramInterface
*) /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/platform2/cryptohome/tpm2_impl.
cc:228:49
#4 0x555ed7cb2173 in cryptohome::Tpm2Test::SetUp() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../..
/../mnt/host/source/src/platform2/cryptohome/tpm2_test.cc:79:16
#5 0x7feb2ceb17d3 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)()
, char const*) ??:0:0
#6 0x7feb2ce95281 in testing::Test::Run() ??:0:0
#7 0x7feb2ce9647f in testing::TestInfo::Run() ??:0:0
#8 0x7feb2ce96b76 in testing::TestCase::Run() ??:0:0
#9 0x7feb2ce9fb66 in testing::internal::UnitTestImpl::RunAllTests() ??:0:0
#10 0x7feb2ceb25a3 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::Uni
tTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ??:0:0
#11 0x7feb2ce9f71e in testing::UnitTest::Run() ??:0:0
#12 0x555ed80e75b8 in RUN_ALL_TESTS() /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../usr/include/gte
st/gtest.h:2233:46
#13 0x555ed80e75b8 in main /build/snappy/var/cache/portage/chromeos-base/cryptohome/out/Default/../../../../../../../../../mnt/host/source/src/
platform2/common-mk/testrunner.cc:16:0
#14 0x7feb2b6c2735 in __libc_start_main /var/tmp/portage/cross-x86_64-cros-linux-gnu/glibc-2.23-r18/work/glibc-2.23/csu/../csu/libc-start.c:289
:0
#15 0x555ed6a75948 in _start ??:0:0
SUMMARY: AddressSanitizer: 39072 byte(s) leaked in 330 allocation(s).
,
May 8 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform2/+/dd19552c1ce9385eb7162d9bae6a2033cfe0e407 commit dd19552c1ce9385eb7162d9bae6a2033cfe0e407 Author: Maksim Ivanov <emaxx@google.com> Date: Tue May 08 00:24:04 2018 cryptohome: Fix memory leaks in Tpm2Test Make Tpm2Test not leak constructed Tpm2Impl. Also make some test fixture methods and fields private, for which it was possible. BUG= chromium:840144 TEST=Run: USE="asan" cros_workon_make --board=${BOARD} cryptohome --test Change-Id: Idebe884a2decf927873347bd2be5050a6f662d6d Reviewed-on: https://chromium-review.googlesource.com/1046049 Commit-Ready: Maksim Ivanov <emaxx@chromium.org> Tested-by: Maksim Ivanov <emaxx@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> [modify] https://crrev.com/dd19552c1ce9385eb7162d9bae6a2033cfe0e407/cryptohome/tpm2_test.cc
,
May 9 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by emaxx@chromium.org
, May 5 2018Owner: emaxx@chromium.org
Status: Started (was: Available)