Skip to content

Current issue with asan #30257

@gengjiawen

Description

@gengjiawen

Current asan failed using the following config

./configure --enable-asan --debug
make -j8
make test-only

due to

node/src/node.cc

Lines 950 to 958 in 31217a8

// These leak memory, because, in the original code of this function, no
// extra allocations were visible. This should be okay because this function
// is only supposed to be called once per process, though.
*exec_argv = Malloc<const char*>(*exec_argc);
for (int i = 0; i < *exec_argc; ++i)
(*exec_argv)[i] = strdup(exec_argv_[i].c_str());
for (int i = 0; i < *argc; ++i)
argv[i] = strdup(argv_[i].c_str());
}

My question is:

  • Is there a way to fix this ?
  • If not, can I make the test go on with those failures ?

cc @addaleax @bnoordhuis @devnexen

Details
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f6f24a48f1e in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10df1e)
    #1 0x55be1f9ceed2 in char const** node::UncheckedRealloc<char const*>(char const**, unsigned long) ../src/util-inl.h:346
    #2 0x55be1f9cdb32 in char const** node::UncheckedMalloc<char const*>(unsigned long) ../src/util-inl.h:361
    #3 0x55be1f9cb8c3 in char const** node::Malloc<char const*>(unsigned long) ../src/util-inl.h:380
    #4 0x55be1f9c77c9 in node::Init(int*, char const**, int*, char const***) ../src/node.cc:953
    #5 0x55be1f81ff9f in NodeTestFixture::SetUpTestCase() ../test/cctest/node_test_fixture.h:79
    #6 0x55be1f7d0d9d in testing::TestSuite::RunSetUpTestSuite() (/root/node/out/Debug/cctest+0x1f87d9d)
    #7 0x55be1f7f27d5 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::TestSuite, void>(testing::TestSuite*, void (testing::TestSuite::*)(), char const*) (/root/node/out/Debug/cctest+0x1fa97d5)
    #8 0x55be1f7e327f in void testing::internal::HandleExceptionsInMethodIfSupported<testing::TestSuite, void>(testing::TestSuite*, void (testing::TestSuite::*)(), char const*) (/root/node/out/Debug/cctest+0x1f9a27f)
    #9 0x55be1f7973d2 in testing::TestSuite::Run() ../test/cctest/gtest/gtest-all.cc:4289
    #10 0x55be1f7aee33 in testing::internal::UnitTestImpl::RunAllTests() ../test/cctest/gtest/gtest-all.cc:6752
    #11 0x55be1f7f44e1 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/root/node/out/Debug/cctest+0x1fab4e1)
    #12 0x55be1f7e4524 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/root/node/out/Debug/cctest+0x1f9b524)
    #13 0x55be1f7abea9 in testing::UnitTest::Run() ../test/cctest/gtest/gtest-all.cc:6340
    #14 0x55be1f81ac55 in RUN_ALL_TESTS() ../test/cctest/gtest/gtest.h:14896
    #15 0x55be1f81ab3b in main ../test/cctest/gtest/gtest_main.cc:45
    #16 0x7f6f243ef1e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2)

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x7f6f249d13dd in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x963dd)
    #1 0x55be1f9c798e in node::Init(int*, char const**, int*, char const***) ../src/node.cc:957
    #2 0x55be1f81ff9f in NodeTestFixture::SetUpTestCase() ../test/cctest/node_test_fixture.h:79
    #3 0x55be1f7d0d9d in testing::TestSuite::RunSetUpTestSuite() (/root/node/out/Debug/cctest+0x1f87d9d)
    #4 0x55be1f7f27d5 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::TestSuite, void>(testing::TestSuite*, void (testing::TestSuite::*)(), char const*) (/root/node/out/Debug/cctest+0x1fa97d5)
    #5 0x55be1f7e327f in void testing::internal::HandleExceptionsInMethodIfSupported<testing::TestSuite, void>(testing::TestSuite*, void (testing::TestSuite::*)(), char const*) (/root/node/out/Debug/cctest+0x1f9a27f)
    #6 0x55be1f7973d2 in testing::TestSuite::Run() ../test/cctest/gtest/gtest-all.cc:4289
    #7 0x55be1f7aee33 in testing::internal::UnitTestImpl::RunAllTests() ../test/cctest/gtest/gtest-all.cc:6752
    #8 0x55be1f7f44e1 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/root/node/out/Debug/cctest+0x1fab4e1)
    #9 0x55be1f7e4524 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/root/node/out/Debug/cctest+0x1f9b524)
    #10 0x55be1f7abea9 in testing::UnitTest::Run() ../test/cctest/gtest/gtest-all.cc:6340
    #11 0x55be1f81ac55 in RUN_ALL_TESTS() ../test/cctest/gtest/gtest.h:14896
    #12 0x55be1f81ab3b in main ../test/cctest/gtest/gtest_main.cc:45
    #13 0x7f6f243ef1e2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x271e2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions