Skip to content

[CRASH] 3.6.7 with regex-module will not start on Debian 12 #4069

Description

@LCEbay

OpenSIPS version you are running

version: opensips 3.6.7 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, F_PARALLEL_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: eaee48e28e
main.c compiled on  with gcc 12

Crash Core Dump
If you want the whole core file, I'll upload it somewhere. This is what gdb bt full says:

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        tid = <optimized out>
        ret = 0
        pd = <optimized out>
        old_mask = {__val = {140453535589856}}
        ret = <optimized out>
#1  0x00007fbde3044f4f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
No locals.
#2  0x00007fbde2ff5fb2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
        ret = <optimized out>
#3  0x00007fbde2fe0472 in __GI_abort () at ./stdlib/abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x20, sa_sigaction = 0x20}, sa_mask = {__val = {140453534487911, 1, 11, 36, 2026, 94089539721440, 140453484201440, 3791, 94089539004892, 
              94089538729080, 0, 0, 94089537556529, 94089538736448, 94089539721444, 3791}}, sa_flags = -309548580, sa_restorer = 0x5592ed88bec8}
#4  0x00005592ed76903a in fm_free ()
No symbol table info available.
#5  0x00007fbddffaa566 in ?? () from /usr/lib/x86_64-linux-gnu/opensips/modules/regex.so
No symbol table info available.
#6  0x00007fbddffaa80a in ?? () from /usr/lib/x86_64-linux-gnu/opensips/modules/regex.so
No symbol table info available.
#7  0x00007fbddffad2d2 in ?? () from /usr/lib/x86_64-linux-gnu/opensips/modules/regex.so
No symbol table info available.
#8  0x00005592ed72bcc2 in ?? ()
No symbol table info available.
#9  0x00005592ed688761 in main ()
No symbol table info available.

Describe the traffic that generated the bug
Attempting to start opensips with regex module.

To Reproduce
Install Debian 12 (I used debian-12.11.0-amd64-netinst.iso)

apt update
apt install curl
curl https://apt.opensips.org/opensips-org.gpg -o /usr/share/keyrings/opensips-org.gpg
echo "deb [signed-by=/usr/share/keyrings/opensips-org.gpg] https://apt.opensips.org bookworm 3.6-releases" >/etc/apt/sources.list.d/opensips.list

apt update
apt install opensips opensips-regex-module

Create a minimal opensips.cfg file, for example:

log_level = 4
xlog_level = 4
stderror_enabled = no
syslog_enabled = yes
syslog_facility = LOG_DAEMON
socket = udp:127.0.0.1:5060
loadmodule "proto_udp.so"
mpath = "/usr/lib/x86_64-linux-gnu/opensips/modules/"

loadmodule "regex.so"
modparam("regex", "file", "/etc/opensips/regex_groups")

route
{
    exit;
}

Create a simple regex file, for example:

[0]
^10\.
^172\.1[6-9]\.
^172\.2[0-9]\.
^172\.3[0-1]\.
^192\.168\.

Run opensips. For the sake of debugging, I am running it from the command line like this:
opensips -D -w /etc/opensips/

Relevant System Logs

DBG:core:init_mod: initializing module regex
INFO:regex:mod_init: initializing module...
DBG:regex:mod_init: PCRE options: 0
NOTICE:regex:mod_init: loading pcres...
NOTICE:regex:load_pcres: num groups = 1
NOTICE:regex:load_pcres: <group[0]>((^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.))</group[0]> (size = 74)
WARNING:core:fm_malloc: not enough contiguous free pkg memory (16420304 bytes left, need 94781338288136), attempting defragmentation... please increase the "-M" command line parameter!
ERROR:core:fm_malloc: not enough free pkg memory (16420304 bytes left, need 94781338288136), please increase the "-M" command line parameter!
ERROR:regex:load_pcres: no more memory for pcres_tmp[0]
CRITICAL:regex:mod_init: failed to load pcres
CRITICAL:core:fm_free: freeing already freed shm pointer (0x7f4b0f94a5e0), first free: (null): (null)(0) - aborting!
Aborted (core dumped)

OS/environment information

  • Operating System: Debian 12 (bookworm)
  • OpenSIPS installation: git
  • other relevant information:

Additional context
This is broken starting with 3.6.5

Metadata

Metadata

Assignees

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions