=== Description ===
use $sel() in event_route from evapi module will cause segfault and kamailio crash.
=== How to re-produce ===
--- Step 1. kamailio.cfg: ---
# --- evapi params --- #
loadmodule "evapi.so"
modparam("evapi", "bind_addr", "127.0.0.1:8448")
modparam("evapi", "netstring_format", 1)
modparam("evapi", "workers", 4)
# --- set a custom options outside any route block
self.MYIP = "1.2.3.4"
# --- set event_route for evapi and invoke $sel; both route will segfault and crash
event_route[evapi:connection-new] {
xlog("L_NOTICE", "[ROUTEDEBUG][evapi:connection-new] new connection
from $evapi(srcaddr):$evapi(srcport)");
xlog("L_NOTICE", "[ROUTEDEBUG][evapi:connection-new] TEST sel:
$sel(cfg_get.self.MYIP)");
}
event_route[evapi:message-received] {
xlog("L_NOTICE", "[ROUTEDEBUG][evapi:message-received] test sel:
$sel(cfg_get.self.MYIP)");
}
--- 2. try connect to evapi ---
You can use any client to try to connect or send message.
in bash, you can just use the following command to connect to and send a message:
exec 3<>/dev/tcp/127.0.0.1/5014; printf "5:Hello," >&3;
=== Debug level 3 error log at event_route[evapi:connection-new] ===
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47034]: NOTICE: <script>:
[ROUTEDEBUG][evapi:connection-new] new connection from 127.0.0.1:27088
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: ALERT: <core>
[main.c:728]: handle_sigs(): child process 47034 exited by a signal 11
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: ALERT: <core>
[main.c:731]: handle_sigs(): core was not generated
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[46977]: INFO: <core>
[main.c:743]: handle_sigs(): terminating due to SIGCHLD
Aug 12 16:35:07 SIP kernel: [28325875.619264] kamailio[47034]: segfault at 10 ip
00007f062cd91470 sp 00007fff5518e068 error 4 in libc-2.13.so[7f062cc6e000+182000]
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47056]: INFO: <core>
[main.c:794]: sig_usr(): signal 15 received
Aug 12 16:35:07 SIP /home/pkg/kamailio/sbin/kamailio[47057]: INFO: <core>
[main.c:794]: sig_usr(): signal 15 received
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/287