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

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

Closed
akoepsel opened this issue Jun 4, 2021 · 2 comments
Closed

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

akoepsel opened this issue Jun 4, 2021 · 2 comments
Labels

Comments

@akoepsel
Copy link
Contributor

akoepsel commented Jun 4, 2021

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

  • Start baseboxd with GLOG_v=3.
  • Connect a switch
  • Wait some time for netlink events to occur ...

Anlaysis

  • The logging call in cnetlink.cc on line 1080 includes function calls rtnl_link_get_slave_type(old_link) and rtnl_link_get_slave_type(new_link).
  • These yield NULL pointers for the triggering netlink message effectively calling std::string_view(NULL) with causes the encountered exception.

Specifications

  • Version: baseboxd 1.9.5
  • Platform:
  • Subsystem:
@akoepsel
Copy link
Contributor Author

akoepsel commented Jun 4, 2021

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

@KanjiMonster
Copy link
Contributor

Fixed with c2060bf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants