-
Notifications
You must be signed in to change notification settings - Fork 640
Open
Description
Opensips with wolfssl segfaulting in Init.
This is explanation of dev ( not chat GPT :-) true real one )
movaps requires the destination to be 16-byte aligned. If %rbx + 0x480 isn't aligned to 16 bytes, instant SIGSEGV. Since 0x480 is already 16-byte aligned, %rbx itself must be misaligned.
OpenSIPS uses custom memory allocators (pkg_malloc/shm_malloc) that likely return 8-byte aligned memory. wolfSSL 5.8.x is compiled with SSE optimizations that require 16-byte alignment for its internal structures.
OPensips 3.4.11
Wolfssl 5.8.4
Feb 9 21:41:16 cavprx01 opensips[562820]: [OSIP-SBC-1] [562820]: CRITICAL:core:sig_usr: segfault in process pid: 562820, id: 17
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:handle_sigs: child process 562820 exited by a signal 11
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:handle_sigs: core was generated
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:handle_sigs: terminating due to SIGCHLD
Feb 9 21:41:17 cavprx01 opensips[562810]: [OSIP-SBC-1] [562810]: INFO:core:sig_usr: signal 15 received
Feb 9 21:41:17 cavprx01 opensips[562805]: [OSIP-SBC-1] [562805]: INFO:core:sig_usr: signal 15 received
Feb 9 21:41:17 cavprx01 opensips[562808]: [OSIP-SBC-1] [562808]: INFO:core:sig_usr: signal 15 received
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 2(562805) [RTPEngine notification receiver] terminated, still waiting for 21 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 7(562810) [time_keeper] terminated, still waiting for 20 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 21(562824) [Timer handler] terminated, still waiting for 16 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 22(562825) [Timer handler] terminated, still waiting for 15 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 23(562826) [TCP main] terminated, still waiting for 13 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 4(562807) [MI FIFO] terminated, still waiting for 11 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 20(562823) [TCP receiver] terminated, still waiting for 10 more
Feb 9 21:41:17 cavprx01 opensips[562811]: [OSIP-SBC-1] [562811]: INFO:core:sig_usr: signal 15 received
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:shutdown_opensips: process 18(562821) [TCP receiver] terminated, still waiting for 0 more
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:core:cleanup: cleanup
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: INFO:tls_wolfssl:mod_destroy: destroying tls_wolfssl module
Feb 9 21:41:17 cavprx01 opensips[562803]: [OSIP-SBC-1] [562803]: NOTICE:event_stream:destroy: destroy module ...
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/opensips -P /run/opensips/opensips.pid -f /etc/opensips/opensips.cfg -m 512 -M 128'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f091cd6c395 in InitSSL () from /lib64/libwolfssl.so.44
Missing rpms, try: dnf --enablerepo='*debug*' install opensips-tls-wolfssl-debuginfo-3.4.11-17.fc41.x86_64 wolfssl-debuginfo-5.8.4-11.fc41.x86_64
(gdb) bt
#0 0x00007f091cd6c395 in InitSSL () from /lib64/libwolfssl.so.44
#1 0x00007f091cdaf2cd in wolfSSL_new () from /lib64/libwolfssl.so.44
#2 0x00007f094529030e in _wolfssl_tls_conn_init () from /usr/lib64/opensips/modules/tls_wolfssl.so
#3 0x0000560645611063 in handle_io (fm=<optimized out>, idx=idx@entry=2, event_type=event_type@entry=1) at net/net_tcp_proc.c:253
#4 0x0000560645611aa7 in io_wait_loop_epoll (h=<optimized out>, t=<optimized out>, repeat=<optimized out>) at net/../io_wait_loop.h:305
#5 tcp_worker_proc_loop () at net/net_tcp_proc.c:450
#6 0x0000560645613a92 in tcp_start_processes (chd_rank=0x560645729eb4 <chd_rank>, startup_done=0x7f091d7d16f8) at net/net_tcp.c:2138
#7 0x00005606454736b8 in main_loop () at /usr/src/debug/opensips-3.4.11-17.fc41.x86_64/main.c:243
#8 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/opensips-3.4.11-17.fc41.x86_64/main.c:966
(gdb)
(gdb) x/i $rip
=> 0x7f091cd6c395 <InitSSL+773>: movaps %xmm0,0x480(%rbx)
(gdb) info registers rdi rsi rdx
rdi 0x7f091d7ddda0 139677126221216
rsi 0x7f091d356ca4 139677121473700
rdx 0x0 0
(gdb) frame 1
#1 0x00007f091cdaf2cd in wolfSSL_new () from /lib64/libwolfssl.so.44
(gdb) info args
No symbol table info available.
(gdb)
(gdb) info registers rbx
rbx 0x7f091d7dd2d8 139677126218456
Potential fix wolssl.c
# Before wolfSSL_Init() in tls_wolfssl mod_init:
wolfSSL_SetAllocators(malloc, free, realloc);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels