You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm testing kamailio v 5.6.1 in an alpine linux docker with musl libc (x86_64) Version 1.2.3 and I see a kamailio crash just with version option (kamailio --version).
The crash occur if I haven't localhost resolution in /etc/hosts. This isn't a canonical situation, but crash occur!
Running kamailio with gdb I see that the problem is in freeaddrinfo call in log_init function.
# gdb --args kamailio --version
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alpine-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from kamailio...
(gdb) run
Starting program: /usr/local/sbin/kamailio --version
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f9f5ed in freeaddrinfo () from /lib/ld-musl-x86_64.so.1
(gdb) bt
#0 0x00007ffff7f9f5ed in freeaddrinfo () from /lib/ld-musl-x86_64.so.1
#1 0x000055555559087d in calc_proc_no () at main.c:1976
#2 0x00007fffffffe8d0 in ?? ()
#3 0x00007fffffffed58 in ?? ()
#4 0x000055555561b143 in log_init () at core/dprint.c:483
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Possible Solutions
I suppose that log_init function needs a check for info pointer. If info pointer is not NULL, then call freeaddrinfo. I see similar protections in other points of code.
Thanks for the report. Most people are using Kamailio on "standard" glibc based distributions, but some people are also using alpine linux. Its probably something related to a special configuration, as you also mentioned. Please open a pull requests with the improvement you suggested, this makes it much easier to review and also integrate into the code base.
henningw
changed the title
kamailio crashs at startup in musl enviroment
kamailio crashs at startup in musl enviroment with empty localhost in /etc/hosts
Nov 22, 2022
Description
I'm testing kamailio v 5.6.1 in an alpine linux docker with musl libc (x86_64) Version 1.2.3 and I see a kamailio crash just with version option (kamailio --version).
The crash occur if I haven't localhost resolution in /etc/hosts. This isn't a canonical situation, but crash occur!
Running kamailio with gdb I see that the problem is in freeaddrinfo call in log_init function.
Reproduction
cat /etc/hosts
#127.0.0.1 localhost
#::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
#172.30.0.3 bd9375eeb5af
#2001:db8:1111:2222:0:242:ac1e:3 bd9375eeb5af
/ #
/ # kamailio --version
Segmentation fault (core dumped)
Debugging Data
Possible Solutions
I suppose that log_init function needs a check for info pointer. If info pointer is not NULL, then call freeaddrinfo. I see similar protections in other points of code.
Additional Information
kamailio -v
The text was updated successfully, but these errors were encountered: