Created
March 1, 2022 20:02
-
-
Save themarwhal/8a3d5618265a66909ecc8dd765be38f9 to your computer and use it in GitHub Desktop.
spgw test with asan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Generating done | |
-- Build files have been written to: /workspaces/magma/build/c/core/oai | |
[6/8] Performing build step for 'MagmaCore' | |
[1/5] Linking CXX executable test/spgw_task/spgw_state_converter_test | |
[2/5] Linking CXX executable test/spgw_task/spgw_service_impl_test | |
[3/5] Linking CXX executable test/spgw_task/pgw_pco_test | |
[4/5] Linking CXX executable test/spgw_task/spgw_procedures_test | |
[5/5] Linking CXX executable test/spgw_task/spgw_procedures_with_injected_state_test | |
[8/8] Completed 'MagmaCore' | |
cd /workspaces/magma/build/c/core/oai && ctest --output-on-failure -R ".*" | |
Test project /workspaces/magma/build/c/core/oai | |
Start 1: test_spgw_service_impl | |
1/5 Test #1: test_spgw_service_impl ..................... Passed 0.19 sec | |
Start 2: test_spgw_state_converter | |
2/5 Test #2: test_spgw_state_converter ..................***Failed 0.19 sec | |
Initializing OAI Logging | |
Initializing OAI Logging to syslog | |
Could not create logging file: Permission denied | |
COULD NOT CREATE A LOGGINGFILE 20220301-200014.31255![==========] Running 2 tests from 1 test suite. | |
[----------] Global test environment set-up. | |
[----------] 2 tests from SPGWStateConverterTest | |
[ RUN ] SPGWStateConverterTest.TestSPGWStateConversion | |
[ OK ] SPGWStateConverterTest.TestSPGWStateConversion (0 ms) | |
[ RUN ] SPGWStateConverterTest.TestUEContextConversion | |
================================================================= | |
==31255==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe86134d46 at pc 0x7fc13d9cba6d bp 0x7ffe86134b50 sp 0x7ffe861342f8 | |
READ of size 7 at 0x7ffe86134d46 thread T0 | |
#0 0x7fc13d9cba6c (/lib/x86_64-linux-gnu/libasan.so.5+0x67a6c) | |
#1 0x7fc13cdc1e9b in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x145e9b) | |
#2 0x55a245c582cd in magma::lte::oai::Ecgi::set_plmn(char const*) common/lte/protos/oai/common_types.pb.h:1393 | |
#3 0x55a245c4d92d in magma::lte::StateConverter::ecgi_to_proto(ecgi_s const&, magma::lte::oai::Ecgi*) /workspaces/magma/lte/gateway/c/core/oai/common/state_converter.cpp:79 | |
#4 0x55a2456cdf6c in magma::lte::SpgwStateConverter::spgw_bearer_context_to_proto(s_plus_p_gw_eps_bearer_context_information_s const*, magma::lte::oai::S11BearerContext*) /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/spgw_state_converter.cpp:75 | |
#5 0x55a245701b25 in magma::lte::SpgwStateConverter::ue_to_proto(spgw_ue_context_s const*, magma::lte::oai::SpgwUeContext*) /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/spgw_state_converter.cpp:972 | |
#6 0x55a2454069fe in magma::lte::SPGWStateConverterTest_TestUEContextConversion_Test::TestBody() /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/test_spgw_state_converter.cpp:87 | |
#7 0x55a245e40cc0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2433 | |
#8 0x55a245e40cc0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2469 | |
#9 0x55a245e34f45 in testing::Test::Run() googletest/src/gtest.cc:2508 | |
#10 0x55a245e34f45 in testing::Test::Run() googletest/src/gtest.cc:2498 | |
#11 0x55a245e350a4 in testing::TestInfo::Run() googletest/src/gtest.cc:2684 | |
#12 0x55a245e350a4 in testing::TestInfo::Run() googletest/src/gtest.cc:2657 | |
#13 0x55a245e3518c in testing::TestSuite::Run() googletest/src/gtest.cc:2816 | |
#14 0x55a245e3518c in testing::TestSuite::Run() googletest/src/gtest.cc:2795 | |
#15 0x55a245e356ab in testing::internal::UnitTestImpl::RunAllTests() googletest/src/gtest.cc:5338 | |
#16 0x55a245e41230 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) googletest/src/gtest.cc:2433 | |
#17 0x55a245e41230 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) googletest/src/gtest.cc:2469 | |
#18 0x55a245e358db in testing::UnitTest::Run() googletest/src/gtest.cc:4925 | |
#19 0x55a24540e9b2 in RUN_ALL_TESTS() /usr/local/include/gtest/gtest.h:2473 | |
#20 0x55a245426e74 in main /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/spgw_test.cpp:23 | |
#21 0x7fc13c1290b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) | |
#22 0x55a245402c4d in _start (/workspaces/magma/build/c/core/oai/test/spgw_task/spgw_state_converter_test+0xfb4c4d) | |
Address 0x7ffe86134d46 is located in stack of thread T0 at offset 38 in frame | |
#0 0x55a245c4d52f in magma::lte::StateConverter::ecgi_to_proto(ecgi_s const&, magma::lte::oai::Ecgi*) /workspaces/magma/lte/gateway/c/core/oai/common/state_converter.cpp:74 | |
This frame has 1 object(s): | |
[32, 38) 'plmn_array' (line 77) <== Memory access at offset 38 overflows this variable | |
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork | |
(longjmp and C++ exceptions *are* supported) | |
SUMMARY: AddressSanitizer: stack-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0x67a6c) | |
Shadow bytes around the buggy address: | |
0x100050c1e950: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
0x100050c1e960: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
0x100050c1e970: 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1 01 f2 01 f2 | |
0x100050c1e980: 01 f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 | |
0x100050c1e990: 00 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 | |
=>0x100050c1e9a0: 00 00 00 00 f1 f1 f1 f1[06]f3 f3 f3 00 00 00 00 | |
0x100050c1e9b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
0x100050c1e9c0: f1 f1 f1 f1 01 f2 01 f2 00 f2 f2 f2 00 00 00 00 | |
0x100050c1e9d0: f2 f2 f2 f2 00 00 00 00 f3 f3 f3 f3 00 00 00 00 | |
0x100050c1e9e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
0x100050c1e9f0: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1 | |
Shadow byte legend (one shadow byte represents 8 application bytes): | |
Addressable: 00 | |
Partially addressable: 01 02 03 04 05 06 07 | |
Heap left redzone: fa | |
Freed heap region: fd | |
Stack left redzone: f1 | |
Stack mid redzone: f2 | |
Stack right redzone: f3 | |
Stack after return: f5 | |
Stack use after scope: f8 | |
Global redzone: f9 | |
Global init order: f6 | |
Poisoned by user: f7 | |
Container overflow: fc | |
Array cookie: ac | |
Intra object redzone: bb | |
ASan internal: fe | |
Left alloca redzone: ca | |
Right alloca redzone: cb | |
Shadow gap: cc | |
==31255==ABORTING | |
Start 3: test_spgw_procedures | |
3/5 Test #3: test_spgw_procedures .......................***Failed 4.39 sec | |
Initializing OAI Logging | |
Initializing OAI Logging to syslog | |
Could not create logging file: Permission denied | |
COULD NOT CREATE A LOGGINGFILE 20220301-200014.31258![==========] Running 15 tests from 1 test suite. | |
[----------] Global test environment set-up. | |
[----------] 15 tests from SPGWAppProcedureTest | |
[ RUN ] SPGWAppProcedureTest.TestCreateSessionSuccess | |
Running setup | |
/workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/pgw_pcef_emulation.c:321:26: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int' | |
Setup done | |
/workspaces/magma/lte/gateway/c/core/oai/lib/pcef/pcef_handlers.cpp:344:39: runtime error: index -1 out of bounds for type 'unsigned char [15]' | |
Could not create logging file: Permission denied | |
COULD NOT CREATE A LOGGINGFILE 20220301-200015.31258!Cleaning up SPGW configsTASK_SPGW_APP terminated | |
[ OK ] SPGWAppProcedureTest.TestCreateSessionSuccess (3024 ms) | |
[ RUN ] SPGWAppProcedureTest.TestCreateSessionIPAllocFailure | |
Running setup | |
Setup done | |
Could not create logging file: Permission denied | |
COULD NOT CREATE A LOGGINGFILE 20220301-200018.31258!================================================================= | |
GMOCK WARNING: | |
Uninteresting mock function call - returning directly. | |
Function call: mme_app_handle_create_sess_resp() | |
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md#knowing-when-to-expect for details. | |
==31258==ERROR: AddressSanitizer: heap-use-after-free on address 0x619000050084 at pc 0x55a20a2a2d4a bp 0x7fff5bba2a40 sp 0x7fff5bba2a30 | |
READ of size 4 at 0x619000050084 thread T0 | |
#0 0x55a20a2a2d49 in magma::lte::SPGWAppProcedureTest_TestCreateSessionIPAllocFailure_Test::TestBody() /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/test_spgw_procedures.cpp:428 | |
#1 0x55a20cea45f0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2433 | |
#2 0x55a20cea45f0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2469 | |
#3 0x55a20ce98475 in testing::Test::Run() googletest/src/gtest.cc:2508 | |
#4 0x55a20ce98475 in testing::Test::Run() googletest/src/gtest.cc:2498 | |
#5 0x55a20ce985d4 in testing::TestInfo::Run() googletest/src/gtest.cc:2684 | |
#6 0x55a20ce985d4 in testing::TestInfo::Run() googletest/src/gtest.cc:2657 | |
#7 0x55a20ce986bc in testing::TestSuite::Run() googletest/src/gtest.cc:2816 | |
#8 0x55a20ce986bc in testing::TestSuite::Run() googletest/src/gtest.cc:2795 | |
#9 0x55a20ce98bdb in testing::internal::UnitTestImpl::RunAllTests() googletest/src/gtest.cc:5338 | |
#10 0x55a20cea4b60 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) googletest/src/gtest.cc:2433 | |
#11 0x55a20cea4b60 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) googletest/src/gtest.cc:2469 | |
#12 0x55a20ce98e0b in testing::UnitTest::Run() googletest/src/gtest.cc:4925 | |
#13 0x55a20a3c92a1 in RUN_ALL_TESTS() /usr/local/include/gtest/gtest.h:2473 | |
#14 0x55a20a3c8f75 in main /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/spgw_test.cpp:23 | |
#15 0x7f8314f540b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) | |
#16 0x55a20a2931cd in _start (/workspaces/magma/build/c/core/oai/test/spgw_task/spgw_procedures_test+0x495a1cd) | |
0x619000050084 is located 4 bytes inside of 912-byte region [0x619000050080,0x619000050410) | |
freed by thread T0 here: | |
#0 0x7f8316eaa7cf in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf) | |
#1 0x55a20c96770f in free_wrapper /workspaces/magma/lte/gateway/c/core/oai/common/dynamic_memory_check.c:47 | |
#2 0x55a20a430792 in sgw_free_eps_bearer_context /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/spgw_state.cpp:118 | |
#3 0x55a20a4304d9 in sgw_free_pdn_connection /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/spgw_state.cpp:107 | |
#4 0x55a20a42fea4 in spgw_free_s11_bearer_context_information /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/spgw_state.cpp:85 | |
#5 0x55a20c9b0c28 in hashtable_ts_free /workspaces/magma/lte/gateway/c/core/oai/lib/hashtable/hashtable.c:671 | |
#6 0x55a20a415d80 in sgw_cm_remove_bearer_context_information /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/sgw_context_manager.c:195 | |
#7 0x55a20a3fa92c in handle_s5_create_session_response /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/sgw_handlers.c:1416 | |
#8 0x55a20a4020be in sgw_handle_ip_allocation_rsp /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/sgw_handlers.c:1905 | |
#9 0x55a20a2a2c12 in magma::lte::SPGWAppProcedureTest_TestCreateSessionIPAllocFailure_Test::TestBody() /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/test_spgw_procedures.cpp:424 | |
#10 0x55a20cea45f0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2433 | |
#11 0x55a20cea45f0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2469 | |
previously allocated by thread T0 here: | |
#0 0x7f8316eaadc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6) | |
#1 0x55a20a416c1e in sgw_cm_create_eps_bearer_ctxt_in_collection /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/sgw_context_manager.c:242 | |
#2 0x55a20a3e751d in sgw_handle_s11_create_session_request /workspaces/magma/lte/gateway/c/core/oai/tasks/sgw/sgw_handlers.c:225 | |
#3 0x55a20a2a1107 in magma::lte::SPGWAppProcedureTest_TestCreateSessionIPAllocFailure_Test::TestBody() /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/test_spgw_procedures.cpp:394 | |
#4 0x55a20cea45f0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2433 | |
#5 0x55a20cea45f0 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) googletest/src/gtest.cc:2469 | |
SUMMARY: AddressSanitizer: heap-use-after-free /workspaces/magma/lte/gateway/c/core/oai/test/spgw_task/test_spgw_procedures.cpp:428 in magma::lte::SPGWAppProcedureTest_TestCreateSessionIPAllocFailure_Test::TestBody() | |
Shadow bytes around the buggy address: | |
0x0c3280001fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa | |
0x0c3280001fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa | |
0x0c3280001fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa | |
0x0c3280001ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa | |
0x0c3280002000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa | |
=>0x0c3280002010:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd | |
0x0c3280002020: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd | |
0x0c3280002030: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd | |
0x0c3280002040: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd | |
0x0c3280002050: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd | |
0x0c3280002060: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd | |
Shadow byte legend (one shadow byte represents 8 application bytes): | |
Addressable: 00 | |
Partially addressable: 01 02 03 04 05 06 07 | |
Heap left redzone: fa | |
Freed heap region: fd | |
Stack left redzone: f1 | |
Stack mid redzone: f2 | |
Stack right redzone: f3 | |
Stack after return: f5 | |
Stack use after scope: f8 | |
Global redzone: f9 | |
Global init order: f6 | |
Poisoned by user: f7 | |
Container overflow: fc | |
Array cookie: ac | |
Intra object redzone: bb | |
ASan internal: fe | |
Left alloca redzone: ca | |
Right alloca redzone: cb | |
Shadow gap: cc | |
==31258==ABORTING | |
Start 4: test_pgw_pco | |
4/5 Test #4: test_pgw_pco ............................... Passed 0.20 sec | |
Start 5: test_spgw_procedures_with_injected_state | |
5/5 Test #5: test_spgw_procedures_with_injected_state ... Passed 21.33 sec | |
60% tests passed, 2 tests failed out of 5 | |
Total Test time (real) = 26.30 sec | |
The following tests FAILED: | |
2 - test_spgw_state_converter (Failed) | |
3 - test_spgw_procedures (Failed) | |
Errors while running CTest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment