[sr-dev] [kamailio/kamailio] pua_dialoginfo: segfault after setting pubruri_caller_dlg_var/pubruri_callee_dlg_var (#1271)

Sebastian Denz notifications at github.com
Fri Oct 13 09:14:59 CEST 2017


<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests.

If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:

  * http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing
C code, ask on sr-dev mailing list

  * http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.

If you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.

If there is no content to be filled in a section, the entire section can be removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a comment).
-->

### Description

Kamailio is segfaulting after activating pubruri_caller_dlg_var and pubruri_callee_dlg_var from pua_dialoginfo.

modparam("pua_dialoginfo", "use_pubruri_avps", 1)
//modparam("pua_dialoginfo", "pubruri_caller_avp", "$avp(s:pubruris_caller)")
//modparam("pua_dialoginfo", "pubruri_callee_avp", "$avp(s:pubruris_callee)")
modparam("pua_dialoginfo", "pubruri_caller_dlg_var", "pubruri_caller")
modparam("pua_dialoginfo", "pubruri_callee_dlg_var", "pubruri_callee")

When i comment the corresponding lines and switch back to the regular avps Kamailio runs without problems.

### Troubleshooting

#### Reproduction

In my setup it seems to be sufficient to just set the module parameters to provoke the segfault.
I dont have to wait for any SIP-Traffic or accessing the dlg_vars. Kamailio segfaults while starting.

#### Debugging Data

<!--
If you got a core dump, use gdb to extract troubleshooting data - full backtrace,
local variables and the list of the code at the issue location.

  gdb /path/to/kamailio /path/to/corefile
  bt full
  info locals
  list

If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->

```
[root at kamroute ~]# gdb /usr/sbin/kamailio /core.6547
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7
Copyright (C) 2013 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/kamailio...Reading symbols from /usr/lib/debug/usr/sbin/kamailio.debug...done.
done.
[New LWP 6547]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio_'.
Program terminated with signal 11, Segmentation fault.
#0  __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:31
31		movdqu	(%rdi), %xmm1
(gdb) bt full
#0  __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:31
No locals.
#1  0x00007fc7c61786c4 in mod_init () at pua_dialoginfo.c:692
        bind_pua = 0x7fc7c6396b88 <bind_pua>
        s = {s = 0x0, len = -969002120}
        avp_spec = {type = 397561584, getf = 0x7fc7ce3b8827 <__fprintf+135>, setf = 0x3, pvp = {pvn = {type = 48, nfree = 0x7ffd17b24e80, u = {isname = {type = 397561264, name = {n = 7976200, s = {s = 0x79b508 "DEBUG", 
                      len = 397562576}, re = 0x79b508}}, dname = 0x7ffd17b24db0}}, pvi = {type = 0, u = {ival = 6547, dval = 0x1993}}}, trans = 0x79b508}
        __FUNCTION__ = "mod_init"
#2  0x00000000005661e2 in init_mod (m=0x7fc7cdbd3ac0) at core/sr_module.c:966
        __FUNCTION__ = "init_mod"
#3  0x0000000000565f1e in init_mod (m=0x7fc7cdbd3e50) at core/sr_module.c:963
        __FUNCTION__ = "init_mod"
#4  0x0000000000566519 in init_modules () at core/sr_module.c:995
        t = 0x20000003e4
        i = 994
        __FUNCTION__ = "init_modules"
#5  0x00000000004293e1 in main (argc=13, argv=0x7ffd17b252d8) at main.c:2584
        cfg_stream = 0x254c010
        c = -1
        r = 397562176
        tmp = 0x7ffd17b256e0 ""
        tmp_len = 0
        port = 0
        proto = 0
        options = 0x737a20 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
        ret = -1
        seed = 286186509
        rfd = 4
        debug_save = 0
        debug_flag = 0
        dont_fork_cnt = 0
        n_lst = 0x0
        p = 0x0
        st = {st_dev = 18, st_ino = 37027, st_nlink = 2, st_mode = 16832, st_uid = 996, st_gid = 2, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1507876455, tv_nsec = 469604021}, 
          st_mtim = {tv_sec = 1507878072, tv_nsec = 553083864}, st_ctim = {tv_sec = 1507878072, tv_nsec = 553083864}, __unused = {0, 0, 0}}
        __FUNCTION__ = "main"
(gdb) info locals
cfg_stream = 0x254c010
c = -1
r = 397562176
tmp = 0x7ffd17b256e0 ""
tmp_len = 0
port = 0
proto = 0
options = 0x737a20 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
ret = -1
seed = 286186509
rfd = 4
debug_save = 0
debug_flag = 0
dont_fork_cnt = 0
n_lst = 0x0
p = 0x0
st = {st_dev = 18, st_ino = 37027, st_nlink = 2, st_mode = 16832, st_uid = 996, st_gid = 2, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1507876455, tv_nsec = 469604021}, st_mtim = {
    tv_sec = 1507878072, tv_nsec = 553083864}, st_ctim = {tv_sec = 1507878072, tv_nsec = 553083864}, __unused = {0, 0, 0}}
__FUNCTION__ = "main"
(gdb) list
26		mov	%edi, %ecx
27		and	$0x3f, %ecx
28		pxor	%xmm0, %xmm0
29		cmp	$0x30, %ecx
30		ja	L(next)
31		movdqu	(%rdi), %xmm1
32		pcmpeqb	%xmm1, %xmm0
33		pmovmskb %xmm0, %edx
34		test	%edx, %edx
35		jnz	L(exit_less16)
(gdb)
```

#### Log Messages

<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
Nothing which seems to be interesting. Kamailios last words are:
```
 0(7450) DEBUG: <core> [core/sr_module.c:965]: init_mod(): pua_dialoginfo
 0(7450) DEBUG: <core> [core/sr_module.c:694]: find_mod_export_record(): find_export_record: found <bind_pua> in module pua [/usr/lib64/kamailio/modules/pua.so]
 0(7450) DEBUG: <core> [core/sr_module.c:694]: find_mod_export_record(): find_export_record: found <load_dlg> in module dialog [/usr/lib64/kamailio/modules/dialog.so]
 0(7448) ERROR: <core> [core/daemonize.c:303]: daemonize(): Main process exited before writing to pipe
```

#### SIP Traffic

<!--
If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->

```
no SIP Traffic needed
```

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix.
-->

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
[root at kamroute ~]# kamailio -v
version: kamailio 5.0.3 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled on 12:31:32 Sep 20 2017 with gcc 4.8.2

[root at kamroute ~]# rpm -qa|grep kamail
kamailio-presence-5.0.3-10.el7.x86_64
kamailio-outbound-5.0.3-10.el7.x86_64
kamailio-debuginfo-5.0.3-10.el7.x86_64
kamailio-5.0.3-10.el7.x86_64
kamailio-ims-5.0.3-10.el7.x86_64
kamailio-xmpp-5.0.3-10.el7.x86_64
kamailio-mysql-5.0.3-10.el7.x86_64
[root at kamroute ~]#
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->
Up2date RHEL7.
```
[root at kamroute ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root at kamroute ~]# uname -a
Linux kamroute.intranet.mydomain.de 3.10.0-514.26.1.el7.x86_64 #1 SMP Tue Jun 20 01:16:02 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
[root at kamroute ~]# 
```
If you need any further information just let me know!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1271
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20171013/3b7e7c7c/attachment-0001.html>


More information about the sr-dev mailing list