Skip to content

When using IPv6 address, segmentation fault can occur due to incorrectly using IPv4 ping #149

Closed
@nuno-silva

Description

@nuno-silva

Describe the bug
Spine runs and is able to populate (some?) graphs, but ends up crashing with SIGSEGV after (apparently) failing to resolve an IPv6 address.

To Reproduce
Steps to reproduce the behaviour:

  1. Install cacti-spine 1.2.10
  2. Configure spine
  3. Run spine (as root), using gdb
  4. See SIGSEGV

Expected behaviour
Spine should not segfault. This was running fine using spine 1.2.8.

Server

  • OS: Gentoo Linux
  • Spine 1.2.10

Compiling

  • compiler: gcc version 9.2.0 (Gentoo Hardened 9.2.0-r2 p3)
  • autoconf: autoconf (GNU Autoconf) 2.69
  • glibc: ldd (Gentoo 2.29-r7 p8) 2.29
  • source: release (cacti-spine-1.2.10.tar.gz)

Additional context
gdb log

2020/03/20 23:01:54 - SPINE: Poller[1] PID[15304] WARNING: Error resolving host my-ipv6-host.example.com (Name or service not known)
free(): invalid pointer
--Type <RET> for more, q to quit, c to continue without paging--

Thread 216 "spine" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fb723ca0700 (LWP 17768)]
0x00007fb7250d35e1 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007fb7250d35e1 in raise () from /lib64/libc.so.6
#1  0x00007fb7250bc539 in abort () from /lib64/libc.so.6
#2  0x00007fb72511a228 in ?? () from /lib64/libc.so.6
#3  0x00007fb725121f7a in ?? () from /lib64/libc.so.6
#4  0x00007fb725123ae4 in ?? () from /lib64/libc.so.6
#5  0x00007fb72518a008 in freeaddrinfo () from /lib64/libc.so.6
#6  0x000055997380c272 in init_sockaddr (name=0x7fb723c7a410, 
    hostname=0x7fb71803b780 "my-ipv6-host.example.com", port=7) at ping.c:878
#7  0x000055997380aa53 in ping_icmp (host=0x7fb718027eb0, ping=0x7fb718011c70) at ping.c:367
#8  0x0000559973809fde in ping_host (host=0x7fb718027eb0, ping=0x7fb718011c70) at ping.c:69
#9  0x0000559973800e39 in poll_host (host_id=558, host_thread=1, last_host_thread=1, host_data_ids=0, 
    host_time=0x7fb723c9fdd0 "2020-03-20 23:01:54", host_errors=0x7fb723c9fd80, host_time_double=1584745314.5383811)
    at poller.c:571
#10 0x00005599737ff595 in child (arg=0x559973d5a290) at poller.c:77
#11 0x00007fb7253c4427 in start_thread () from /lib64/libpthread.so.0
#12 0x00007fb7251a1b2f in clone () from /lib64/libc.so.6

Also note that the my-ipv6-host.example.com is a dummy host that I have replaced for privacy. However, it was a valid DNS name that resolves to valid AAAA record.

What I see in cacti.log is

2020/03/20 23:25:52 - SPINE: Poller[Main Poller] PID[15682] FATAL: Spine Encountered An Unhandled Exception Signal Number: '6' [0, Success] (Spine thread)
2020/03/20 23:25:52 - SPINE: Poller[Main Poller] PID[15682] WARNING: Error resolving host my-ipv6-host.example.com (Name or service not known)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions