Closed dsseng closed 9 months ago
Looks like ifa_addr
in the ifaddrs struct might be null in some cases (i.e. the interface does not have an address for some reason), which we don't check for.
Yes, it's null as per lldb debug. I couldn't fix that myself because I'm unsure what's the case. Interfaces have both IPv4 and IPv6 addresses.
It occurs when there is any interface without link address, e.g. VPN. It is indicated by link/none
line in ip addr
output.
Example:
$ ip a
[...]
38: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet [...]/24 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::[...]/64 scope link stable-privacy
valid_lft forever preferred_lft forever
$ sudo killall openvpn
After stopping VPN, statime-linux started without crashing.
Thank you for reporting and triaging this. I have gone over all the unsafe code in the crate again and the linked pull request should fix the issue, as well as provide proper reasoning for why all our unsafe code is valid now. Please let us know if you find any further issues.
Segfault by null pointer dereference at src/interface.rs:89:31, on both a PC with openSUSE Tumbleweed and Raspberry Pi 5 with Debian 12