bisdn / basebox

A tiny OpenFlow controller for OF-DPA switches.
Mozilla Public License 2.0
45 stars 9 forks source link

baseboxd exception with GLOG_v=3 in cnetlink.cc on line 1080 #307

Closed akoepsel closed 3 years ago

akoepsel commented 3 years ago

Expected Behavior

baseboxd should not crash ...

Actual Behavior

An exception occurs when starting baseboxd with an increased logging verbosity level (GLOG_v = 3 or above), once a netlink message calling method cnetlink::route_link_apply() is received causing the following exception:

--Type <RET> for more, q to quit, c to continue without paging--

Thread 2 "netlink" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6b28700 (LWP 13)]
0x00005555555ec367 in std::char_traits<char>::length (__s=0x0)
    at /usr/include/c++/9/bits/char_traits.h:335
335             return __builtin_strlen(__s);
(gdb) bt
#0  0x00005555555ec367 in std::char_traits<char>::length (__s=0x0)
    at /usr/include/c++/9/bits/char_traits.h:335
#1  0x000055555575ae84 in std::basic_string_view<char, std::char_traits<char> >::basic_string_view (this=0x7ffff6b27500, __str=0x0)
    at /usr/include/c++/9/string_view:124
#2  0x0000555555754da0 in basebox::cnetlink::link_updated (
    this=0x555555943970, old_link=0x7ffff00144c0, new_link=0x7ffff001b9f0)
    at ../src/netlink/cnetlink.cc:1083
#3  0x0000555555752ab0 in basebox::cnetlink::route_link_apply (
    this=0x555555943970, obj=...) at ../src/netlink/cnetlink.cc:831
#4  0x00005555557500f2 in basebox::cnetlink::handle_wakeup (
    this=0x555555943970, thread=...) at ../src/netlink/cnetlink.cc:531
#5  0x00007ffff7d13374 in rofl::cthread::handle_wakeup (this=0x555555943980)
    at /git/rofl-common/src/rofl/common/locking.hpp:47
#6  0x00007ffff7d14095 in rofl::cthread::run_loop (this=0x555555943980)
    at cthread.cpp:732
#7  0x00007ffff753c609 in start_thread (arg=<optimized out>)
    at pthread_create.c:477
#8  0x00007ffff7461293 in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Steps to Reproduce the Problem

Anlaysis

Specifications

akoepsel commented 3 years ago

Potential solution proposed in commit d8beaeebfb532e4b065b05c95e4c61a1d6f5842a "do not call std::string_view() with NULL pointer as argument"

KanjiMonster commented 3 years ago

Fixed with https://github.com/bisdn/basebox/commit/c2060bfa2918bde71d30356235cee16267d611a8