Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddressSanitizer issues #1417

Closed
ibc opened this issue Jul 1, 2024 · 6 comments
Closed

AddressSanitizer issues #1417

ibc opened this issue Jul 1, 2024 · 6 comments
Assignees
Labels
Milestone

Comments

@ibc
Copy link
Member

ibc commented Jul 1, 2024

This PR #1416 added AddressSanitizer tasks to worker CI. However some of them have been disabled since they fail. This ticket is to resolve them and re-enable those tasks in mediasoup-worker.yaml CI file.

Note that we just run AddressSanitizer in Linux (it works in Docker). So we can run them locally (in macOS) this way:

cd worker
make docker
make docker-run

Once in Docker:

cd worker
make clean-all
make test-asan-address
make clean-all
make test-asan-undefined
make clean-all
make test-asan-thread

Below in comments, the ASAN issues that show up until all them are fixed.

@ibc ibc added the bug label Jul 1, 2024
@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

TODO 1

UPDATE: Fixed in #1419

make test-asan-address:

cd "/mediasoup/worker" && ASAN_OPTIONS=detect_leaks=1 "/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address" --invisibles
Randomness seeded to: 3012346320
=================================================================
==24626==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xfffff93fa0ec at pc 0xaaaabf80d778 bp 0xfffff93f9980 sp 0xfffff93f9170
READ of size 1488 at 0xfffff93fa0ec thread T0
    #0 0xaaaabf80d774 in __asan_memcpy (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x3ad774) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #1 0xaaaabf98b3d0 in RTC::RtpPacket::Clone() const (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x52b3d0) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #2 0xaaaabf98f720 in RTC::RtpRetransmissionBuffer::FillItem(RTC::RtpRetransmissionBuffer::Item*, RTC::RtpPacket*, std::shared_ptr<RTC::RtpPacket>&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x52f720) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #3 0xaaaabf990aa8 in RTC::RtpRetransmissionBuffer::Insert(RTC::RtpPacket*, std::shared_ptr<RTC::RtpPacket>&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x530aa8) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #4 0xaaaabf9a6bac in RTC::RtpStreamSend::ReceivePacket(RTC::RtpPacket*, std::shared_ptr<RTC::RtpPacket>&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x546bac) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #5 0xaaaabfb99a64 in CATCH2_INTERNAL_TEST_0() TestRtpStreamSend.cpp
    #6 0xaaaac02d50e8 in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0xe750e8) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #7 0xaaaac02d40fc in Catch::RunContext::runTest(Catch::TestCaseHandle const&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0xe740fc) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #8 0xaaaac02f8ca4 in Catch::(anonymous namespace)::TestGroup::execute() catch_session.cpp
    #9 0xaaaac02f7410 in Catch::Session::runInternal() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0xe97410) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #10 0xaaaac02f64a8 in Catch::Session::run() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0xe964a8) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #11 0xaaaabfb11368 in main (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x6b1368) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)
    #12 0xffffbbe073f8  (/lib/aarch64-linux-gnu/libc.so.6+0x273f8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #13 0xffffbbe074c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #14 0xaaaabf7971ec in _start (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x3371ec) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7)

Address 0xfffff93fa0ec is located in stack of thread T0 at offset 1068 in frame
    #0 0xaaaabfb98b94 in CATCH2_INTERNAL_TEST_0() TestRtpStreamSend.cpp

  This frame has 148 object(s):
    [32, 48) 'sharedPacket.i6813'
    [64, 80) 'sharedPacket.i6732'
    [96, 112) 'sharedPacket.i6651'
    [128, 144) 'sharedPacket.i6570'
    [160, 176) 'sharedPacket.i6257'
    [192, 208) 'sharedPacket.i6176'
    [224, 240) 'sharedPacket.i6095'
    [256, 272) 'sharedPacket.i5782'
    [288, 304) 'sharedPacket.i5701'
    [320, 336) 'sharedPacket.i5326'
    [352, 368) 'sharedPacket.i5243'
    [384, 400) 'sharedPacket.i4908'
    [416, 432) 'sharedPacket.i4827'
    [448, 464) 'sharedPacket.i4746'
    [480, 496) 'sharedPacket.i4665'
    [512, 528) 'sharedPacket.i4584'
    [544, 560) 'sharedPacket.i4503'
    [576, 592) 'sharedPacket.i4422'
    [608, 624) 'sharedPacket.i4091'
    [640, 656) 'sharedPacket.i4010'
    [672, 688) 'sharedPacket.i3929'
    [704, 720) 'sharedPacket.i3848'
    [736, 752) 'sharedPacket.i3767'
    [768, 784) 'sharedPacket.i3686'
    [800, 816) 'sharedPacket.i3605'
    [832, 848) 'sharedPacket.i3330'
    [864, 880) 'sharedPacket.i3249'
    [896, 912) 'sharedPacket.i3168'
    [928, 944) 'sharedPacket.i3087'
    [960, 976) 'sharedPacket.i3006'
    [992, 1008) 'sharedPacket.i2925'
    [1024, 1040) 'sharedPacket.i'
    [1056, 1068) 'rtpBuffer1'
    [1088, 2588) 'rtpBuffer2' <== Memory access at offset 1068 partially underflows this variable
    [2720, 4220) 'rtpBuffer3'
    [4352, 5852) 'rtpBuffer4'
    [5984, 7484) 'rtpBuffer5'
    [7616, 7712) 'ref.tmp'
    [7744, 7760) 'ref.tmp8'
    [7776, 7792) 'agg.tmp'
    [7808, 7840) 'testRtpStreamListener'
    [7872, 8016) 'params'
    [8080, 8112) 'mid'
    [8144, 8224) 'nackPacket'
    [8256, 8328) 'catchAssertionHandler'
    [8368, 8384) 'ref.tmp173'
    [8400, 8440) 'ref.tmp179'
    [8480, 8552) 'catchAssertionHandler202'
    [8592, 8608) 'ref.tmp205'
    [8624, 8664) 'ref.tmp211'
    [8704, 8776) 'catchAssertionHandler241'
    [8816, 8832) 'ref.tmp244'
    [8848, 8896) 'ref.tmp250'
    [8928, 9024) 'ref.tmp337'
    [9056, 9072) 'ref.tmp338'
    [9088, 9104) 'agg.tmp339'
    [9120, 9152) 'testRtpStreamListener369'
    [9184, 9328) 'params370'
    [9392, 9424) 'mid376'
    [9456, 9536) 'nackPacket517'
    [9568, 9640) 'catchAssertionHandler530'
    [9680, 9696) 'ref.tmp533'
    [9712, 9752) 'ref.tmp539'
    [9792, 9864) 'catchAssertionHandler568'
    [9904, 9920) 'ref.tmp571'
    [9936, 9976) 'ref.tmp577'
    [10016, 10088) 'catchAssertionHandler607'
    [10128, 10144) 'ref.tmp610'
    [10160, 10208) 'ref.tmp616'
    [10240, 10336) 'ref.tmp669'
    [10368, 10384) 'ref.tmp670'
    [10400, 10416) 'agg.tmp671'
    [10432, 10464) 'testRtpStreamListener701'
    [10496, 10640) 'params702'
    [10704, 10736) 'mid708'
    [10768, 10848) 'nackPacket849'
    [10880, 10952) 'catchAssertionHandler862'
    [10992, 11008) 'ref.tmp865'
    [11024, 11064) 'ref.tmp871'
    [11104, 11176) 'catchAssertionHandler900'
    [11216, 11232) 'ref.tmp903'
    [11248, 11288) 'ref.tmp909'
    [11328, 11400) 'catchAssertionHandler939'
    [11440, 11456) 'ref.tmp942'
    [11472, 11520) 'ref.tmp948'
    [11552, 11648) 'ref.tmp1001'
    [11680, 11696) 'ref.tmp1002'
    [11712, 11728) 'agg.tmp1003'
    [11744, 11776) 'testRtpStreamListener1'
    [11808, 11840) 'testRtpStreamListener2'
    [11872, 12016) 'params1'
    [12080, 12112) 'mid1023'
    [12144, 12288) 'params2'
    [12352, 12432) 'nackPacket1084'
    [12464, 12536) 'catchAssertionHandler1097'
    [12576, 12592) 'ref.tmp1100'
    [12608, 12648) 'ref.tmp1106'
    [12688, 12760) 'catchAssertionHandler1135'
    [12800, 12816) 'ref.tmp1138'
    [12832, 12872) 'ref.tmp1144'
    [12912, 12984) 'catchAssertionHandler1174'
    [13024, 13040) 'ref.tmp1177'
    [13056, 13104) 'ref.tmp1183'
    [13136, 13208) 'catchAssertionHandler1231'
    [13248, 13264) 'ref.tmp1234'
    [13280, 13328) 'ref.tmp1240'
    [13360, 13456) 'ref.tmp1316'
    [13488, 13504) 'ref.tmp1317'
    [13520, 13536) 'agg.tmp1318'
    [13552, 13584) 'testRtpStreamListener1334'
    [13616, 13760) 'params11335'
    [13824, 13856) 'mid1341'
    [13888, 13968) 'nackPacket1387'
    [14000, 14072) 'catchAssertionHandler1400'
    [14112, 14128) 'ref.tmp1403'
    [14144, 14184) 'ref.tmp1409'
    [14224, 14296) 'catchAssertionHandler1438'
    [14336, 14352) 'ref.tmp1441'
    [14368, 14408) 'ref.tmp1447'
    [14448, 14520) 'catchAssertionHandler1477'
    [14560, 14576) 'ref.tmp1480'
    [14592, 14640) 'ref.tmp1486'
    [14672, 14768) 'ref.tmp1559'
    [14800, 14816) 'ref.tmp1560'
    [14832, 14848) 'agg.tmp1561'
    [14864, 14896) 'testRtpStreamListener1591'
    [14928, 15072) 'params11592'
    [15136, 15168) 'mid1598'
    [15200, 15280) 'nackPacket1663'
    [15312, 15384) 'catchAssertionHandler1676'
    [15424, 15440) 'ref.tmp1679'
    [15456, 15496) 'ref.tmp1685'
    [15536, 15608) 'catchAssertionHandler1714'
    [15648, 15664) 'ref.tmp1717'
    [15680, 15720) 'ref.tmp1723'
    [15760, 15832) 'catchAssertionHandler1753'
    [15872, 15888) 'ref.tmp1756'
    [15904, 15952) 'ref.tmp1762'
    [15984, 16080) 'ref.tmp1828'
    [16112, 16128) 'ref.tmp1829'
    [16144, 16160) 'agg.tmp1830'
    [16176, 16208) 'testRtpStreamListener1855'
    [16240, 16384) 'params11856'
    [16448, 16480) 'mid1862'
    [16512, 16592) 'nackPacket2'
    [16624, 16696) 'catchAssertionHandler1958'
    [16736, 16752) 'ref.tmp1961'
    [16768, 16816) 'ref.tmp1967'
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 (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x3ad774) (BuildId: 29eb3dcfbb7682388ab3ac9b90247c7e46dec4d7) in __asan_memcpy
Shadow bytes around the buggy address:
  0x200fff27f3c0: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2
  0x200fff27f3d0: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2
  0x200fff27f3e0: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2
  0x200fff27f3f0: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2
  0x200fff27f400: f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2 f8 f8 f2 f2
=>0x200fff27f410: f8 f8 f2 f2 f8 f8 f2 f2 00 00 f2 f2 00[04]f2 f2
  0x200fff27f420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff27f430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff27f440: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff27f450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff27f460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
==24626==ABORTING

@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

TODO 2

make test-asan-undefined:

cd "/mediasoup/worker" && ASAN_OPTIONS=detect_leaks=1 "/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-undefined" --invisibles
Randomness seeded to: 3112908262
../../../include/RTC/RtpPacket.hpp:131:14: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:131:14 in
../../../src/RTC/RtpPacket.cpp:35:15: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:35:15 in
../../../src/RTC/RtpPacket.cpp:53:15: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:53:15 in
../../../src/RTC/RtpPacket.cpp:88:15: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:88:15 in
../../../src/RTC/RtpPacket.cpp:142:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:142:21 in
../../../include/RTC/RtpPacket.hpp:175:25: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:175:25 in
../../../include/RTC/RtpPacket.hpp:165:25: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:165:25 in
../../../include/RTC/RtpPacket.hpp:190:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:190:21 in
../../../include/RTC/RtpPacket.hpp:200:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:200:21 in
../../../include/RTC/RtpPacket.hpp:200:21: runtime error: load of misaligned address 0xaaaab13273aa for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0xaaaab13273aa: note: pointer points here
 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:200:21 in
../../../include/RTC/RtpPacket.hpp:210:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:210:21 in
../../../include/RTC/RtpPacket.hpp:210:21: runtime error: load of misaligned address 0xaaaab13273ae for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0xaaaab13273ae: note: pointer points here
 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00 00 00 00 00 00 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:210:21 in
../../../src/RTC/RTCP/Packet.cpp:220:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:220:18 in
../../../src/RTC/RTCP/Packet.cpp:221:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 80 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:221:18 in
../../../src/RTC/RTCP/Packet.cpp:222:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 80 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:222:18 in
../../../src/RTC/RTCP/Packet.cpp:223:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 81 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:223:18 in
../../../src/RTC/RTCP/Packet.cpp:224:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 81 cd 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:224:18 in
../../../src/RTC/RTCP/Packet.cpp:224:18: runtime error: store to misaligned address 0xaaaab1307203 for type 'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
0xaaaab1307203: note: pointer points here
 00  00 81 cd 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:224:18 in
===============================================================================
All tests passed (592743 assertions in 47 test cases)

@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

TODO 3

This doesn't happen in Docker locally in macOS, but happens in CI in Ubuntu 20.04 with gcc: https://github.com/versatica/mediasoup/actions/runs/9743694850/job/26887713985?pr=1416

make test-asan-thread:

FAILED: subprojects/flatbuffers-24.3.6/flatc 
g++  -o subprojects/flatbuffers-24.3.6/flatc subprojects/flatbuffers-24.3.6/flatc.p/src_annotated_binary_text_gen.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_bfbs_gen_lua.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_bfbs_gen_nim.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_binary_annotator.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_file_binary_writer.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_file_name_saving_file_manager.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_file_writer.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_flatc_main.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_cpp.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_csharp.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_dart.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_fbs.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_go.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_grpc.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_java.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_json_schema.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_kotlin.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_kotlin_kmp.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_lobster.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_php.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_python.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_rust.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_swift.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_text.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_idl_gen_ts.cpp.o subprojects/flatbuffers-24.3.6/flatc.p/src_util.cpp.o -fsanitize=thread -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group subprojects/flatbuffers-24.3.6/libflatc_library.a subprojects/flatbuffers-24.3.6/libflatbuffers.a subprojects/flatbuffers-24.3.6/libcpp_generator.a subprojects/flatbuffers-24.3.6/libgo_generator.a subprojects/flatbuffers-24.3.6/libjava_generator.a subprojects/flatbuffers-24.3.6/libpython_generator.a subprojects/flatbuffers-24.3.6/libswift_generator.a subprojects/flatbuffers-24.3.6/libts_generator.a -Wl,--end-group
/usr/bin/ld: cannot find libtsan_preinit.o: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /home/runner/work/mediasoup/mediasoup/worker/out/pip_meson_ninja/bin/ninja -C /home/runner/work/mediasoup/mediasoup/worker/out/Debug/build fbs/FBS
Error: Process completed with exit code 1.

@ibc
Copy link
Member Author

ibc commented Jul 6, 2024

test-asan-address is done in #1421 1421

@ibc
Copy link
Member Author

ibc commented Jul 18, 2024

TODO 2 has been magically fixed and test-asan-undefined passes everywhere now:

@ibc
Copy link
Member Author

ibc commented Jul 18, 2024

All ASAN tests passing after PR #1427 is merged. Closing.

@ibc ibc closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants