[Home]

Summary:ASTERISK-11401: segfault on module reload chan_console.so
Reporter:Clod Patry (junky)Labels:
Date Opened:2008-02-07 22:17:53.000-0600Date Closed:2008-02-15 16:33:47.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:. I did not set the category correctly.
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:you need to not have the console.conf.

rabbit*CLI> load chan_console.so
The 'load' command is deprecated and will be removed in a future release. Please use 'module load' instead.
[Feb  7 23:06:51] NOTICE[7802]: chan_console.c:1394 load_config: Unable to open configuration file console.conf!
rabbit*CLI>
rabbit*CLI>
rabbit*CLI>
rabbit*CLI> module reload chan_console.so


****** ADDITIONAL INFORMATION ******

(gdb) bt
#0  0xb73aaf67 in set_pvt_defaults (pvt=0xb73af8a0) at chan_console.c:1232
#1  0xb73ac02e in load_config (reload=<value optimized out>) at chan_console.c:1390
#2  0x080cecc0 in ast_module_reload (name=0x0) at loader.c:603
#3  0x08095b29 in handle_reload (e=0x1a, cmd=22, a=0xb6bc4e8c) at cli.c:194
#4  0x08095b55 in handle_reload_deprecated (e=0x8192960, cmd=-4, a=0xb6bc4e8c) at cli.c:214
ASTERISK-1  0x08094bce in ast_cli_command (fd=27, s=0xb6bc4ed8 "reload") at cli.c:1879
ASTERISK-2  0x08094e57 in ast_cli_command_multiple (fd=27, size=7, s=0xb6bc5128 "reload") at cli.c:1912
ASTERISK-3  0x08073e57 in netconsole (vconsole=0x81b12b4) at asterisk.c:1006
ASTERISK-4  0x081306eb in dummy_start (data=0x8243bf8) at utils.c:857
ASTERISK-5  0xb7c1f46b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
ASTERISK-6 0xb7d096de in clone () from /lib/tls/i686/cmov/libc.so.6
(gdb) p *pvt
$1 = {__field_mgr_pool = 0x0, name = 0x8186860 "", input_device = 0x8186860 "", output_device = 0x8186860 "", context = 0x8186860 "", exten = 0x8186860 "",
 cid_num = 0x8186860 "", cid_name = 0x8186860 "", mohinterpret = 0x16 <Address 0x16 out of bounds>, language = 0x8186860 "", __field_mgr = {size = 32,
   used = 26}, owner = 0x0, stream = 0x0, fr = {frametype = 0, subclass = 0, datalen = 0, samples = 0, mallocd = 0, mallocd_hdr_len = 0, offset = 0,
   src = 0x0, data = 0x0, delivery = {tv_sec = 0, tv_usec = 0}, frame_list = {next = 0x0}, flags = 0, ts = 0, len = 0, seqno = 0}, streamstate = 0,
 hookstate = 0, muted = 0, autoanswer = 0, overridecontext = 0, destroy = 0, thread = 4294967295}
(gdb)





this is on beta2, we should add this to the list.
Comments:By: Clod Patry (junky) 2008-02-07 22:35:28.000-0600

if you place that block:
       ast_mutex_lock(&globals_lock);
       set_pvt_defaults(&globals);
       ast_mutex_unlock(&globals_lock);

after the ast_config_load, no more crashes occurs.


based on valgrind:
==10313== Process terminating with default action of signal 11 (SIGSEGV)
==10313==  Access not within mapped region at address 0xE
==10313==    at 0x4F50F3F: ??? (chan_console.c:1233)
==10313==    by 0x4F51FBD: ??? (chan_console.c:1390)
==10313==    by 0x80CECFF: ast_module_reload (loader.c:603)
==10313==    by 0x8095A7D: handle_reload (cli.c:198)
==10313==    by 0x8094BCD: ast_cli_command (cli.c:1879)
==10313==    by 0x8077580: main (asterisk.c:1476)

which was referring to:
set_pvt_defaults(&globals);

By: Russell Bryant (russell) 2008-02-15 11:46:25.000-0600

The issue here is actually that when the module was loaded, it returned AST_MODULE_LOAD_DECLINE.  I wrote the code in such a way that if that was the case, then I didn't expect the reload_module() callback to ever get called.

However, it does get called, and it blows up.

By: Digium Subversion (svnbot) 2008-02-15 12:30:12.000-0600

Repository: asterisk
Revision: 103726

U   branches/1.4/main/loader.c

------------------------------------------------------------------------
r103726 | russell | 2008-02-15 12:30:09 -0600 (Fri, 15 Feb 2008) | 6 lines

Don't attempt to execute the reload callback for a module that returned
AST_MODULE_LOAD_DECLINE.  This fixes a crash that was reported against
chan_console in trunk.

(closes issue ASTERISK-11401, reported by junky, fixed by me)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=103726

By: Digium Subversion (svnbot) 2008-02-15 12:31:22.000-0600

Repository: asterisk
Revision: 103727

_U  trunk/
U   trunk/main/loader.c

------------------------------------------------------------------------
r103727 | russell | 2008-02-15 12:31:21 -0600 (Fri, 15 Feb 2008) | 14 lines

Merged revisions 103726 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103726 | russell | 2008-02-15 12:33:29 -0600 (Fri, 15 Feb 2008) | 6 lines

Don't attempt to execute the reload callback for a module that returned
AST_MODULE_LOAD_DECLINE.  This fixes a crash that was reported against
chan_console in trunk.

(closes issue ASTERISK-11401, reported by junky, fixed by me)

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=103727

By: Digium Subversion (svnbot) 2008-02-15 16:33:47.000-0600

Repository: asterisk
Revision: 103735

_U  team/murf/bug11210/
U   team/murf/bug11210/apps/app_queue.c
U   team/murf/bug11210/channels/chan_sip.c
U   team/murf/bug11210/channels/chan_zap.c
U   team/murf/bug11210/channels/misdn/chan_misdn_config.h
U   team/murf/bug11210/channels/misdn/ie.c
U   team/murf/bug11210/channels/misdn/isdn_lib.c
U   team/murf/bug11210/channels/misdn/isdn_lib.h
U   team/murf/bug11210/channels/misdn/isdn_msg_parser.c
U   team/murf/bug11210/channels/misdn/portinfo.c
U   team/murf/bug11210/configure
U   team/murf/bug11210/configure.ac
U   team/murf/bug11210/doc/tex/imapstorage.tex
U   team/murf/bug11210/include/asterisk/extconf.h
U   team/murf/bug11210/include/asterisk/strings.h
U   team/murf/bug11210/include/asterisk/time.h
U   team/murf/bug11210/main/ast_expr2f.c
U   team/murf/bug11210/main/channel.c
U   team/murf/bug11210/main/config.c
U   team/murf/bug11210/main/loader.c
U   team/murf/bug11210/res/res_config_curl.c
U   team/murf/bug11210/res/res_config_ldap.c
U   team/murf/bug11210/res/res_phoneprov.c
U   team/murf/bug11210/utils/conf2ael.c

------------------------------------------------------------------------
r103735 | murf | 2008-02-15 16:33:45 -0600 (Fri, 15 Feb 2008) | 120 lines

Merged revisions 103710-103711,103714-103716,103723,103725,103727,103729 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r103710 | mmichelson | 2008-02-14 17:53:08 -0700 (Thu, 14 Feb 2008) | 13 lines

Blocked revisions 103709 via svnmerge

........
r103709 | mmichelson | 2008-02-14 18:50:49 -0600 (Thu, 14 Feb 2008) | 6 lines

I apparently misunderstood one of the requirements of this configure change.
Now, if a source directory is specified with the --with-imap option, and a valid
source installation is not detected there, then configure will fail and will not
check for a package installation.


........

................
r103711 | mmichelson | 2008-02-14 17:59:21 -0700 (Thu, 14 Feb 2008) | 3 lines

Same changes as made to 1.4 in revision 103710


................
r103714 | mmichelson | 2008-02-15 08:08:59 -0700 (Fri, 15 Feb 2008) | 15 lines

Blocked revisions 103713 via svnmerge

........
r103713 | mmichelson | 2008-02-15 09:05:49 -0600 (Fri, 15 Feb 2008) | 8 lines

Fix a bit of wrong logic in the configure script that caused problems when trying to configure
without IMAP. Patch suggestion from phsultan, but I modified it slightly.

(closes issue ASTERISK-11447)
Reported by: pj
Tested by: putnopvut


........

................
r103715 | mmichelson | 2008-02-15 08:11:23 -0700 (Fri, 15 Feb 2008) | 3 lines

Merging of changes from 1.4 revision 103713.


................
r103716 | tilghman | 2008-02-15 08:45:33 -0700 (Fri, 15 Feb 2008) | 6 lines

Remove extraneous copy
(closes issue ASTERISK-11446)
Reported by: junky
Patches:
      conf2ael.diff uploaded by junky (license 177)

................
r103723 | qwell | 2008-02-15 10:29:08 -0700 (Fri, 15 Feb 2008) | 6 lines

Fix up some doxygen issues.

(closes issue ASTERISK-11440)
Patches:
     bug_11996_doxygen.diff uploaded by snuffy (license 35)

................
r103725 | mmichelson | 2008-02-15 10:32:43 -0700 (Fri, 15 Feb 2008) | 16 lines

Merged revisions 103722 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103722 | mmichelson | 2008-02-15 11:26:37 -0600 (Fri, 15 Feb 2008) | 8 lines

Final round of changes for configure script logic for IMAP

Now if a directory is specified, then we will search that directory for
a source installation of the IMAP toolkit. If none is found, then we will
use that directory as the basis for detecting a package installation of
the IMAP c-client. If that check fails, then configure will fail.


........

................
r103727 | russell | 2008-02-15 11:34:42 -0700 (Fri, 15 Feb 2008) | 14 lines

Merged revisions 103726 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103726 | russell | 2008-02-15 12:33:29 -0600 (Fri, 15 Feb 2008) | 6 lines

Don't attempt to execute the reload callback for a module that returned
AST_MODULE_LOAD_DECLINE.  This fixes a crash that was reported against
chan_console in trunk.

(closes issue ASTERISK-11401, reported by junky, fixed by me)

........

................
r103729 | russell | 2008-02-15 12:50:47 -0700 (Fri, 15 Feb 2008) | 12 lines

Merged revisions 103728 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r103728 | russell | 2008-02-15 13:50:11 -0600 (Fri, 15 Feb 2008) | 4 lines

In the case that you try to directly reload a module has returned
AST_MODULE_LOAD_DECLINE, log a message indicating that the module is not fully
initialized and must be initialized using "module load".

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=103735