Asterisk13.8 malloc segment fault

In recently, I meet a problem when I use the asterisk13.8 to dail. The asterisk program killed by the signal SIGSEGV, Segmentation fault。 And I use the gdb to debug the coredumpfile, the following is the print:
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/libthread_db.so.1”.
Core was generated by `asterisk -c’.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0xb6a40034 in ?? () from /lib/libc.so.0
[Current thread is 1 (Thread 0xb28704c0 (LWP 23942))]
(gdb) bt
#0 0xb6a40034 in ?? () from /lib/libc.so.0
#1 0xb6a3f3b8 in malloc () from /lib/libc.so.0
#2 0xb286f660 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

The stack has been destroy by the fault.But I also use the i r sp and i r fp to dump the backtrace.
The followings are the func name I get :slight_smile:

__malloc_state in section .bss of /lib/libc.so.0
malloc + 288 in section .text of /lib/libc.so.0
pthread_mutex_unlock in section .text of /lib/libpthread.so.0
__malloc_lock in section .data of /lib/libc.so.0
pthread_mutex_unlock in section .text of /lib/libpthread.so.0
sym__malloc_lock in section .data of /lib/libc.so.0b
__malloc_lock in section .data of /lib/libc.so.0
option_debug in section .bss of /tmp/mount/usb/main/asterisk
calloc + 124 in section .text of /lib/libc.so.0
pthread_mutex_unlock in section .text of /lib/libpthread.so.0
__malloc_lock in section .data of /lib/libc.so.0
__ast_string_field_init + 204 in section .text of /tmp/mount/usb/main/asterisk
channel_by_name_topic in section .bss of /tmp/mount/usb/main/asterisk
ast_channel_snapshot_create + 112 in section .text of /tmp/mount/usb/main/asterisk
PRETTY_FUNCTION.13380 in section .rodata of /tmp/mount/usb/main/asterisk
hash_ao2_find_next in section .text of /tmp/mount/usb/main/asterisk
_pthread_cleanup_pop_restore + 212 in section .text of /lib/libpthread.so.0
malloc + 2056 in section .text of /lib/libc.so.0
option_timedlock in section .bss of /tmp/mount/usb/main/asterisk
__ast_pthread_mutex_lock + 200 in section .text of /tmp/mount/usb/main/asterisk
pthread_mutex_unlock in section .text of /lib/libpthread.so.0
__malloc_lock in section .data of /lib/libc.so.0
option_timedlock in section .bss of /tmp/mount/usb/main/asterisk
__ast_pthread_mutex_lock + 200 in section .text of /tmp/mount/usb/main/asterisk
channel_by_name_topic in section .bss of /tmp/mount/usb/main/asterisk
option_debug in section .bss of /tmp/mount/usb/main/asterisk
ast_channel_publish_snapshot + 84 in section .text of /tmp/mount/usb/main/asterisk
FUNCTION.6705 in section .rodata of /tmp/mount/usb/main/asterisk
ast_channel_destructor + 1960 in section .text of /tmp/mount/usb/main/asterisk
I want to know, anyone meet the issue before.
And I also search what casuses the malloc segfat.And I get the malloc the outsize of the memory before and the next malloc caused the issue.
Thanks all.

That sort of error is typically a delayed result of memory corruption, which can be very difficult to track down, as the real fault is likely to be in a different thread. Enabling thread debugging may help, as this is sometiems the result of locking problems that may get reported before the actual crash.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.