Seg fault address when using -b flag and routers= config is set (dhcpcd 8.1.1)
Ross North
Sat Nov 02 20:05:28 2019I am experiencing a seg fault with rb_tree_insert_node ever since upgrading to dhcpcd version 8 and up. Version 7 works without issue.
This only occurs when the -b flag is used and the routers= option is set in the config to assign a static address.
Config file (default file plus the following appended):
static ip_address=192.168.0.150
static routers=192.168.0.1
static domain_name_servers=1.1.1.1 1.0.0.1
static routers=192.168.0.1
static domain_name_servers=1.1.1.1 1.0.0.1
Config file (no crash):
static ip_address=192.168.0.150
static domain_name_servers=1.1.1.1 1.0.0.1
static domain_name_servers=1.1.1.1 1.0.0.1
(Starting without -b flag)
[user@srv1 ~]$ sudo pkill dhcpcd
[user@srv1 ~]$ sudo lldb dhcpcd --
(lldb) target create "dhcpcd"
Current executable set to 'dhcpcd' (x86_64).
(lldb) run
Process 1046 launched: '/usr/bin/dhcpcd' (x86_64)
dev: loaded udev
Process 1046 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1046 stopped and restarted: thread 1 received signal: SIGCHLD
DUID 00:04:00:00:00:00:00:00:00:00:00:00:30:9c:23:21:92:bb
enp2s0: IAID 23:21:92:bb
enp2s0: using static address 192.168.0.140/24
enp2s0: adding route to 192.168.0.0/24
enp2s0: adding default route via 192.168.0.1
Process 1046 stopped and restarted: thread 1 received signal: SIGCHLD
forked to background, child pid 1062
Process 1046 exited with status = 0 (0x00000000)
(lldb) exit
(lldb) target create "dhcpcd"
Current executable set to 'dhcpcd' (x86_64).
(lldb) run
Process 1046 launched: '/usr/bin/dhcpcd' (x86_64)
dev: loaded udev
Process 1046 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1046 stopped and restarted: thread 1 received signal: SIGCHLD
DUID 00:04:00:00:00:00:00:00:00:00:00:00:30:9c:23:21:92:bb
enp2s0: IAID 23:21:92:bb
enp2s0: using static address 192.168.0.140/24
enp2s0: adding route to 192.168.0.0/24
enp2s0: adding default route via 192.168.0.1
Process 1046 stopped and restarted: thread 1 received signal: SIGCHLD
forked to background, child pid 1062
Process 1046 exited with status = 0 (0x00000000)
(lldb) exit
(Starting with a -b flag - invalid address)
[user@srv1 ~]$ sudo pkill dhcpcd
[user@srv1 ~]$ sudo lldb dhcpcd -- -b
(lldb) target create "dhcpcd"
Current executable set to 'dhcpcd' (x86_64).
(lldb) settings set -- target.run-args "-b"
(lldb) run
Process 1081 launched: '/usr/bin/dhcpcd' (x86_64)
dev: loaded udev
forked to background, child pid 1084
Process 1081 stopped
* thread #1, name = 'dhcpcd', stop reason = signal SIGSEGV: invalid address (fault address: 0x10)
frame #0: 0x000055555558f6dd dhcpcd`rb_tree_insert_node + 29
dhcpcd`rb_tree_insert_node:
-> 0x55555558f6dd <+29>: movq 0x10(%r15), %rax
0x55555558f6e1 <+33>: movq (%r15), %rbx
0x55555558f6e4 <+36>: leaq (%rsi,%rax), %rbp
0x55555558f6e8 <+40>: testq %r14, %r14
(lldb) bt
* thread #1, name = 'dhcpcd', stop reason = signal SIGSEGV: invalid address (fault address: 0x10)
* frame #0: 0x000055555558f6dd dhcpcd`rb_tree_insert_node + 29
frame #1: 0x000055555556c54a dhcpcd`rt_headclear0.part.0 + 106
frame #2: 0x000055555556acf6 dhcpcd`free_options + 246
frame #3: 0x000055555555e93e dhcpcd`main + 2286
frame #4: 0x00007ffff7e10153 libc.so.6`__libc_start_main + 243
frame #5: 0x000055555555f47e dhcpcd`_start + 46
(lldb)
[user@srv1 ~]$ sudo lldb dhcpcd -- -b
(lldb) target create "dhcpcd"
Current executable set to 'dhcpcd' (x86_64).
(lldb) settings set -- target.run-args "-b"
(lldb) run
Process 1081 launched: '/usr/bin/dhcpcd' (x86_64)
dev: loaded udev
forked to background, child pid 1084
Process 1081 stopped
* thread #1, name = 'dhcpcd', stop reason = signal SIGSEGV: invalid address (fault address: 0x10)
frame #0: 0x000055555558f6dd dhcpcd`rb_tree_insert_node + 29
dhcpcd`rb_tree_insert_node:
-> 0x55555558f6dd <+29>: movq 0x10(%r15), %rax
0x55555558f6e1 <+33>: movq (%r15), %rbx
0x55555558f6e4 <+36>: leaq (%rsi,%rax), %rbp
0x55555558f6e8 <+40>: testq %r14, %r14
(lldb) bt
* thread #1, name = 'dhcpcd', stop reason = signal SIGSEGV: invalid address (fault address: 0x10)
* frame #0: 0x000055555558f6dd dhcpcd`rb_tree_insert_node + 29
frame #1: 0x000055555556c54a dhcpcd`rt_headclear0.part.0 + 106
frame #2: 0x000055555556acf6 dhcpcd`free_options + 246
frame #3: 0x000055555555e93e dhcpcd`main + 2286
frame #4: 0x00007ffff7e10153 libc.so.6`__libc_start_main + 243
frame #5: 0x000055555555f47e dhcpcd`_start + 46
(lldb)
In both scenarios (non-crash and crash) the master dhcpcd process seems to have been started before crashing/exiting.
I am using the latest Arch Linux build (https://www.archlinux.org/packages/core/x86_64/dhcpcd/) and seems to be an issue for a few users.
I saw a similar thread but that patch did not fix the crash for me.
Any ideas how to fix this? Thanks.
| Re: Seg fault address when using -b flag and routers= config is set (dhcpcd 8.1.1) | Roy Marples |