maliput / maliput/maliput_multilane

Address Sanitizer using GCC compiler.

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

The Address Sanitizer could be used with either clang or gcc compiler.
It was decided to allow this sanitizer to be available only when compiling with clang. (PR -> #14 )

Several tests were run using gcc + asan and it led to errors similar to the following:

2: [ RUN      ] Test2x2Intersection.CheckRoadGeometryProperties
2: =================================================================
2: ==9456==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x603000079310 in thread T0
2:     #0 0x7f92643c17a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
2:     #1 0x7f92615de1e2 in drake::systems::InitialValueProblem<double>::InitialValueProblem(std::function<Eigen::Matrix<double, -1, 1, 0, -1, 1> (double const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&)> const&, drake::systems::InitialValueProblem<double>::SpecifiedValues const&) (/opt/drake/lib/libdrake.so+0xe601e2)
2:     #2 0x7f92615dae2a in drake::systems::ScalarInitialValueProblem<double>::ScalarInitialValueProblem(std::function<double (double const&, double const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&)> const&, drake::systems::ScalarInitialValueProblem<double>::SpecifiedValues const&) (/opt/drake/lib/libdrake.so+0xe5ce2a)
2:     #3 0x7f926159df56 in drake::systems::AntiderivativeFunction<double>::AntiderivativeFunction(std::function<double (double const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&)> const&, drake::systems::AntiderivativeFunction<double>::SpecifiedValues const&) (/opt/drake/lib/libdrake.so+0xe1ff56)
2:     #4 0x7f9264040dbe in make_unique<drake::systems::AntiderivativeFunction<double>, maliput::multilane::(anonymous namespace)::ArcLengthDerivativeFunction, const drake::systems::AntiderivativeFunction<double>::SpecifiedValues&> /usr/include/c++/7/bits/unique_ptr.h:821
2:     #5 0x7f9264040dbe in maliput::multilane::RoadCurve::RoadCurve(double, double, maliput::multilane::CubicPolynomial const&, maliput::multilane::CubicPolynomial const&, maliput::multilane::ComputationPolicy) /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/road_curve.cc:106
2:     #6 0x7f9263f807db in maliput::multilane::LineRoadCurve::LineRoadCurve(Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, maliput::multilane::CubicPolynomial const&, maliput::multilane::CubicPolynomial const&, double, double, maliput::multilane::ComputationPolicy) /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/include/maliput_multilane/line_road_curve.h:49
2:     #7 0x7f9263f807db in std::_MakeUniq<maliput::multilane::LineRoadCurve>::__single_object std::make_unique<maliput::multilane::LineRoadCurve, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, maliput::multilane::CubicPolynomial const&, maliput::multilane::CubicPolynomial const&, double const&, double const&, maliput::multilane::ComputationPolicy const&>(Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, maliput::multilane::CubicPolynomial const&, maliput::multilane::CubicPolynomial const&, double const&, double const&, maliput::multilane::ComputationPolicy const&) /usr/include/c++/7/bits/unique_ptr.h:821
2:     #8 0x7f9263f807db in maliput::multilane::Connection::CreateRoadCurve() const /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/connection.cc:208
2:     #9 0x7f9263f822dd in maliput::multilane::Connection::Connection(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, maliput::multilane::Endpoint const&, maliput::multilane::EndpointZ const&, int, double, double, double, double, maliput::multilane::LineOffset const&, double, double, maliput::multilane::ComputationPolicy) /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/connection.cc:66
2:     #10 0x7f9263f518af in std::_MakeUniq<maliput::multilane::Connection>::__single_object std::make_unique<maliput::multilane::Connection, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, maliput::multilane::Endpoint&, maliput::multilane::EndpointZ&, int, double, double&, double, double, maliput::multilane::LineOffset const&, double&, double&, maliput::multilane::ComputationPolicy&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, maliput::multilane::Endpoint&, maliput::multilane::EndpointZ&, int&&, double&&, double&, double&&, double&&, maliput::multilane::LineOffset const&, double&, double&, maliput::multilane::ComputationPolicy&) /usr/include/c++/7/bits/unique_ptr.h:821
2:     #11 0x7f9263f518af in maliput::multilane::Builder::Connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, maliput::multilane::LaneLayout const&, maliput::multilane::StartReference::Spec const&, maliput::multilane::LineOffset const&, maliput::multilane::EndReference::Spec const&) /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/builder.cc:97
2:     #12 0x7f92640143ed in MaybeMakeConnection /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/loader.cc:472
2:     #13 0x7f9264020cd0 in BuildFrom /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/loader.cc:556
2:     #14 0x7f92640273a1 in maliput::multilane::LoadFile(maliput::multilane::BuilderFactoryBase const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/src/maliput_multilane/loader.cc:600
2:     #15 0x55c0cd586913 in SetUp /home/franco/Worskpace/RoadNetwork/tri_ws/src/maliput_multilane/test/maliput_multilane/2x2_intersection_test.cc:47
2:     #16 0x55c0cd639d11 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2447
2:     #17 0x55c0cd639d11 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2483
2:     #18 0x55c0cd63a1b9 in testing::Test::Run() /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2517
2:     #19 0x55c0cd63aac5 in testing::TestInfo::Run() /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2703
2:     #20 0x55c0cd63b21e in testing::TestCase::Run() /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2825
2:     #21 0x55c0cd63c2b5 in testing::internal::UnitTestImpl::RunAllTests() /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:5216
2:     #22 0x55c0cd63c8b1 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2447
2:     #23 0x55c0cd63c8b1 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:2483
2:     #24 0x55c0cd63cec8 in testing::UnitTest::Run() /opt/ros/dashing/src/gtest_vendor/./src/gtest.cc:4824
2:     #25 0x55c0cd582ed1 in RUN_ALL_TESTS() /opt/ros/dashing/src/gtest_vendor/include/gtest/gtest.h:2370
2:     #26 0x55c0cd582ed1 in main /opt/ros/dashing/src/gtest_vendor/src/gtest_main.cc:36
2:     #27 0x7f9262c50b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
2:     #28 0x55c0cd583969 in _start 

Apparently it complains about freeing memory in a bad way.
The traces lead us inside drake.

In #14, the complete analysis of the error and the proper activation of the Address Sanitizer using GCC was postponed to later, leaving at the moment, the sanitizer available only for clang compiler.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PR #14 and the GCC AddressSanitizer failure in test/maliput_multilane/2x2_intersection_test.cc. Trace the reported paths through road_curve.cc, connection.cc, and loader.cc, then investigate the Drake calls shown in the stack trace. Done means the sanitizer can be enabled with GCC without the invalid-free failure while retaining the existing clang behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.