connectedhomeip icon indicating copy to clipboard operation
connectedhomeip copied to clipboard

Random segfault while all-clusters-app linux is doing nothing matter-related

Open cecille opened this issue 2 years ago • 2 comments

Problem

bt: 116 ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or directory. (gdb) bt #0 __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:116 #1 0x00005555556f7c16 in chip::DeviceLayer::PlatformManagerImpl::WiFIIPChangeListener() () at ../../third_party/connectedhomeip/src/platform/Linux/PlatformManagerImpl.cpp:120 #2 0x00005555556f9759 in std::__invoke_impl<void, void ()()>(std::__invoke_other, void (&&)()) (__f=@0x555555858d98: 0x5555556f7a7c chip::DeviceLayer::PlatformManagerImpl::WiFIIPChangeListener()) at /usr/include/c++/11/bits/invoke.h:61 #3 0x00005555556f9711 in std::__invoke<void ()()>(void (&&)()) (__fn=@0x555555858d98: 0x5555556f7a7c chip::DeviceLayer::PlatformManagerImpl::WiFIIPChangeListener()) at /usr/include/c++/11/bits/invoke.h:96 #4 0x00005555556f96be in std::thread::_Invoker<std::tuple<void ()()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0x555555858d98) at /usr/include/c++/11/bits/std_thread.h:253 #5 0x00005555556f9692 in std::thread::_Invoker<std::tuple<void ()()> >::operator()() (this=0x555555858d98) at /usr/include/c++/11/bits/std_thread.h:260 #6 0x00005555556f9676 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() (this=0x555555858d90) at /usr/include/c++/11/bits/std_thread.h:211 #7 0x00007ffff779b9d3 in () at /lib/x86_64-linux-gnu/libstdc++.so.6 #8 0x00007ffff7f86d80 in start_thread (arg=0x7ffff5579640) at pthread_create.c:481 #9 0x00007ffff74a476f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Proposed Solution

no crash is better crash

cecille avatar Jun 14 '22 19:06 cecille

So the crashing line is this:

                        if (strcmp(name, ConnectivityManagerImpl::GetWiFiIfName()) != 0)

which suggests that either name is not null-terminated or ConnectivityManagerImpl::GetWiFiIfName() has some problem. And in particular, GetWiFiIfName() can absolutely return nullptr if sWiFiIfName is empty:

src/platform/Linux/ConnectivityManagerImpl.h:    static const char * GetWiFiIfName() { return (sWiFiIfName[0] == '\0') ? nullptr : sWiFiIfName; }

This code needs to either check for null, or change GetWiFiIfName to return a non-null empty string if that's what we have.

bzbarsky-apple avatar Jun 14 '22 20:06 bzbarsky-apple

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Dec 11 '22 21:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Jun 24 '23 09:06 stale[bot]