We have recently upgraded our Alpine base image (3.23) along with Kamailio (6.0.4) and we are getting segfault at startup. Our custom config was working in Alpine 3.22 with Kamailio 5.8.4.
We are not building Kamailio from source. We're getting it from apk.
We were able to locate the problem with TLS. We tested with the default config that shipped with the package - segfault.
openssl req -newkey rsa:2048 -x509 -keyout private.key -out cert.pem -days 3650 -nodes -subj "/C=US/ST=/L=/O=/OU=/CN="
Then we tried the same exercise with Ubuntu - apt install kamailio kamailio-tls-modules
Using the same certificate, using the default config in the package, no segfault.
(gdb) bt full
#0 0x0000ffffbe397df4 in __pthread_getspecific (k=k@entry=0) at src/thread/pthread_getspecific.c:8
self = <optimized out>
#1 0x0000ffffbe2c2300 in mod_init () at tls_mod.c:406
method = <optimized out>
verify_client = <optimized out>
rand_buf = "\210\000\001\000\001\000\000\000\200\004\360\330\377\377\000\000\024\3518\276\377\377\000\000\275@=\276\377\377\000"
k = 0
__func__ = "mod_init"
__llevel = <optimized out>
__kld = <optimized out>
#2 0x0000aaaad4e659b8 in init_mod (m=0xffffbdb86660) at core/sr_module.c:1037
ret = <optimized out>
__func__ = "init_mod"
#3 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb89bb0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#4 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb8a110) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#5 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb8aac0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#6 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb8b840) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#7 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb8dad0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#8 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb8eab0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#9 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb8f2c0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#10 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb90220) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#11 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9a740) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#12 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9ac60) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#13 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9b0b0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#14 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9bad0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#15 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9ceb0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#16 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9dc70) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#17 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9eba0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#18 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9f410) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#19 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9f8c0) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#20 0x0000aaaad4e658c4 in init_mod (m=0xffffbdb9ff70) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#21 0x0000aaaad4e658c4 in init_mod (m=0xffffbdba1b60) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#22 0x0000aaaad4e658c4 in init_mod (m=0xffffbdba2060) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#23 0x0000aaaad4e658c4 in init_mod (m=0xffffbdba3040) at core/sr_module.c:1032
ret = <optimized out>
__func__ = "init_mod"
#24 0x0000aaaad4e6a34c in init_modules () at core/sr_module.c:1068
t = <optimized out>
i = <optimized out>
__func__ = "init_modules"
#25 0x0000aaaad4c349b4 in main (argc=<optimized out>, argv=<optimized out>) at main.c:3353
cfg_stream = <optimized out>
c = <optimized out>
r = <optimized out>
tmp = 0xffffbe3f7ba0 <ldso> ""
tmp_len = 0
port = 5060
proto = 0
aproto = 0
ahost = 0x0
socket_name = 0x0
aport = 0
listen_field_count = <optimized out>
listen_fields = {0x18 <error: Cannot access memory at address 0x18>, 0x99ba <error: Cannot access memory at address 0x99ba>,
0x18 <error: Cannot access memory at address 0x18>}
options = 0xaaaad4f178ee ":f:cm:M:dVIhEeb:B:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
ret = -1
seed =
1938757098 rfd = <optimized out>
debug_save = <optimized out>
debug_flag = <optimized out>
dont_fork_cnt = <optimized out>
n_lst = <optimized out>
p = <optimized out>
tbuf = 0xffffd8f01ab0 "!"
tbuf_tmp = <optimized out>
st = {st_dev = 63, st_ino = 48481, st_mode = 16877, st_nlink = 1, st_uid = 100, st_gid = 0, st_rdev = 0, __pad = 0, st_size = 4096,
st_blksize = 4096, __pad2 = 0, st_blocks = 8, st_atim = {tv_sec =
1766082557, tv_nsec = 947394010}, st_mtim = {tv_sec =
1766093215,
tv_nsec = 591712013}, st_ctim = {tv_sec =
1766093215, tv_nsec = 591712013}, __unused = {0, 0}}
l1 = <optimized out>
lim = {rlim_cur =
1048576, rlim_max = 1048576}
option_index = 0
long_options = {{name = 0xaaaad4f18d0a "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0xaaaad4f2682c "version", has_arg = 0, flag = 0x0,
val = 118}, {name = 0xaaaad4f3197d "alias", has_arg = 1, flag = 0x0, val = 1024}, {name = 0xaaaad4f18d0f "subst", has_arg = 1, flag = 0x0,
val = 1025}, {name = 0xaaaad4f18d15 "substdef", has_arg = 1, flag = 0x0, val = 1026}, {name = 0xaaaad4f18d1e "substdefs", has_arg = 1,
flag = 0x0, val = 1027}, {name = 0xaaaad4f18d28 "server-id", has_arg = 1, flag = 0x0, val = 1028}, {name = 0xaaaad4f18d32 "loadmodule",
has_arg = 1, flag = 0x0, val = 1029}, {name = 0xaaaad4f18d3d "modparam", has_arg = 1, flag = 0x0, val = 1030}, {
name = 0xaaaad4f18d46 "log-engine", has_arg = 1, flag = 0x0, val = 1031}, {name = 0xaaaad4f26949 "debug", has_arg = 1, flag = 0x0,
val = 1032}, {name = 0xaaaad4f18d51 "cfg-print", has_arg = 0, flag = 0x0, val = 1033}, {name = 0xaaaad4f18d5b "atexit", has_arg = 1,
flag = 0x0, val = 1034}, {name = 0xaaaad4f18d62 "all-errors", has_arg = 0, flag = 0x0, val = 1035}, {name = 0x0, has_arg = 0, flag = 0x0,
val = 0}}
__func__ = "main"