Re: v8 to v9.3.3 segmentation fault on linux
Roy Marples
Mon Nov 23 12:13:33 2020
On 23/11/2020 10:48, [anp/hsw] wrote:
Hello!
I'm using 3.2.101 kernel and i686 (ia32) build of dhcpcd.
This is part of the problem.
To version 7 it works normally (no segfault). But from v8 and up to
latest git build it gets segmentation fault while trying to add IP
address for interface.
Here is gdb run of latest git version (ip address replaced with 192.168
for security reason):
(gdb) b if_address
Breakpoint 1 at 0x29f0c: file if-linux.c, line 1827.
(gdb) run
Starting program: /tmp/dhcpcd -nBpEAKLGdd -h system -t 0 -l 3600
-c /etc/dhcpcd/dynamic-eth0.1446 eth0.1446
read_config: /etc/dhcpcd.conf: No such file or directory
sending signal HUP to pid 25191
no such user dhcpcd
main: mkdir: /var/db/dhcpcd: No such file or directory
So dhcpcd-9 builds with privilege separation.
This requires a user to be added to your system otherwise it will be disabled.
Also, /var/db doesn't exist. dhcpcd cannot create that for you.
Either create it or adjust your configure to a different location and recompile.
dhcpcd-9.3.3 starting
DUID 00:04:49:43:4d:53:02:00:90:13:25:00:13:90:25:00:c4:84
read_config: /etc/dhcpcd.conf: No such file or directory
eth0.1446: executing: /etc/dhcpcd/dynamic-eth0.1446 PREINIT
eth0.1446: IAID ff:00:05:a6
eth0.1446: delaying IPv6 router solicitation for 0.9 seconds
eth0.1446: delaying IPv4 for 1.9 seconds
eth0.1446: soliciting an IPv6 router
eth0.1446: sending Router Solicitation
eth0.1446: using hwaddr 00:a0:d1:cf:de:34
eth0.1446: reading lease: /var/db/dhcpcd/eth0.1446.lease
eth0.1446: soliciting a DHCP lease
eth0.1446: sending DISCOVER (xid 0x93d1fc8c), next in 3.8 seconds
eth0.1446: offered 192.168.168.51 from 80.89.133.227
eth0.1446: sending REQUEST (xid 0x93d1fc8c), next in 3.1 seconds
eth0.1446: acknowledged 192.168.168.51 from 80.89.133.227
eth0.1446: leased 192.168.168.51 for 3600 seconds
eth0.1446: renew in 1800 seconds, rebind in 3150 seconds
eth0.1446: writing lease: /var/db/dhcpcd/eth0.1446.lease
dhcp_writefile: /var/db/dhcpcd/eth0.1446.lease: No such file or
directory
eth0.1446: adding IP address 192.168.168.51/24 broadcast 192.168.168.255
Breakpoint 1, if_address (cmd=20 '\024', ia=0x800acc48) at
if-linux.c:1827
1827 {
(gdb) info locals
nlm = {hdr = {nlmsg_len = 8, nlmsg_type = 80, nlmsg_flags = 0, nlmsg_seq
= 2426816512, nlmsg_pid = 3085056288}, ifa = {ifa_family = 56 '8',
ifa_prefixlen = 93 ']', ifa_flags = 7 '\a',
This is the second part of the problem.
Your kernel headers are vastly newer than the kernel.
IFA_F_NOPREFIXROUTE was first defined in Linux-3.13 but your running kernel is
Linux-3.2
Essentially using newer headers advertises features which are not available, and
this is what you are seeing.
ifa_scope = 128 '', ifa_index = 3221212584},
buffer = "n.\001\a\000\000\000lM\006╢мЪ©мЪ©\030\000\000\000TNЭ╥╦мЪ©lM
\006 9Б╥\022\000\000\000╢мЪ©\000H╕Ш\000\000\000E\000\000\000\030нЪ©"}
cinfo = {ifa_prefered = 0, ifa_valid = 91, cstamp = 0, tstamp = 57}
retval = 0
flags = 110
(gdb) c
Continuing.
ipv4_addaddr: if_addaddress: Invalid argument
Program received signal SIGSEGV, Segmentation fault.
0x8002ef75 in dhcp_openudp (ia=0x8) at dhcp.c:1604
1604 sin.sin_addr = *ia;
(gdb) print *ia
Cannot access memory at address 0x8
(gdb) print ia
$1 = (struct in_addr *) 0x8
(gdb) info locals
s = 16
sin = {sin_family = 2, sin_port = 17408, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}
n = 1
(gdb) quit
I can try to get more info, it it will be helpful.
Irregardless of the above, dhcpcd should still not crash.
A backtrace here would be helpful.
Roy
Archive administrator: postmaster@marples.name