[Home]

Summary:ASTERISK-23104: Specifying the SetVar AMI without a Channel cause Asterisk to crash
Reporter:Joel Vandal (jvandal)Labels:
Date Opened:2014-01-06 14:07:20.000-0600Date Closed:2014-03-04 21:30:32.000-0600
Priority:CriticalRegression?
Status:Closed/CompleteComponents:Core/ManagerInterface
Versions:1.8.25.0 11.6.1 12.0.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS 5Attachments:( 0) asterisk-23104_audiohook_inherit_no_channel-11.diff
Description:From the Asterisk Manager Interface (AMI), when doing a SetVar and the channel is empty, this crash the Asterisk system.


Step to reproduce :

1- connect to the AMI

telnet localhost 5038

2- login to the AMI

Action: Login
UserName: username
Secret: secret

3- Send the SetVar with empty channel

Action: SetVar
Channel:
Variable: AUDIOHOOK_INHERIT(MixMonitor)
Value: yes
Comments:By: Joel Vandal (jvandal) 2014-01-06 14:48:55.542-0600

Strange that all value are always optimized ... but here some info I got from core dump.

#0  0x080aeef0 in ast_channel_get_cc_config_params ()
(gdb) bt
#0  0x080aeef0 in ast_channel_get_cc_config_params ()
#1  0x00b5adb3 in func_inheritance_write (chan=0x0,
   function=0xb63fe750 "AUDIOHOOK_INHERIT", data=0x0, value=0x9fdc3f7 "yes")
   at func_audiohookinherit.c:235
#2  0x08152640 in ast_func_read2 ()
#3  0x08154067 in pbx_builtin_setvar_helper ()
#4  0x08134f80 in action_getvar ()
#5  0x0812fef2 in process_message ()
#6  0x0813d9da in session_do ()
#7  0x081959e9 in __ssl_setup ()
#8  0x081a42da in ast_careful_fwrite ()
#9  0x00880912 in start_thread () from /lib/libpthread.so.0
#10 0x007aa60e in ioperm () from /lib/libc.so.6
#11 0x00000000 in ?? ()

(gdb) bt full
#0  0x080aeef0 in ast_channel_get_cc_config_params ()
No symbol table info available.
#1  0x00b5adb3 in func_inheritance_write (chan=0x0,
   function=0xb63fe750 "AUDIOHOOK_INHERIT", data=0x0, value=0x9fdc3f7 "yes")
   at func_audiohookinherit.c:235
       allow = -1
       datastore = <value optimized out>
       inheritance_datastore = <value optimized out>
       inheritable_audiohook = <value optimized out>
       __PRETTY_FUNCTION__ = "func_inheritance_write"


By: Michael L. Young (elguero) 2014-01-06 17:32:14.524-0600

Please give this patch, [^asterisk-23104_check_channel_defined-11.diff], a try and report back if this solves the issue.

Thanks

By: Joel Vandal (jvandal) 2014-01-06 18:31:39.505-0600

Now it crash on a different section :

#0  0x080af0f0 in ast_channel_datastore_find ()
(gdb) bt
#0  0x080af0f0 in ast_channel_datastore_find ()
#1  0x00f22db3 in func_inheritance_write (chan=0x0, function=0xb6ffe740 "AUDIOHOOK_INHERIT", data=0xb6ffe752 "MixMonitor",
   value=0xa01e74f "yes") at func_audiohookinherit.c:235
#2  0x081579a5 in ast_func_write ()
#3  0x08159437 in pbx_builtin_setvar_helper ()
#4  0x08139deb in action_setvar ()
#5  0x08134d82 in process_message ()
#6  0x0813ff75 in session_do ()
#7  0x0819b0b9 in handle_tcptls_connection ()
#8  0x081aa631 in dummy_start ()
#9  0x00b03912 in start_thread () from /lib/libpthread.so.0
#10 0x00a2d7ce in clone () from /lib/libc.so.6

(gdb) bt full
#0  0x080af0f0 in ast_channel_datastore_find ()
No symbol table info available.
#1  0x00f22db3 in func_inheritance_write (chan=0x0, function=0xb6ffe740 "AUDIOHOOK_INHERIT", data=0xb6ffe752 "MixMonitor",
   value=0xa01e74f "yes") at func_audiohookinherit.c:235
       allow = -1
       datastore = <value optimized out>
       inheritance_datastore = <value optimized out>
       inheritable_audiohook = <value optimized out>
       __PRETTY_FUNCTION__ = "func_inheritance_write"
#2  0x081579a5 in ast_func_write ()



By: Matt Jordan (mjordan) 2014-01-07 14:04:13.669-0600

As a comment on the patch here: it is technically valid to not specify {{Channel}} in the {{SetVar}} action. That should set a global variable.

What is not valid is using functions that require a channel in such a fashion. The functions themselves should be sanitizing their inputs however.

By: Michael L. Young (elguero) 2014-01-15 17:04:26.187-0600

Here is another patch to try and resolve this.

Please give this a try. [^asterisk-23104_audiohook_inherit_no_channel-11.diff]

By: Rusty Newton (rnewton) 2014-02-07 09:44:04.844-0600

Joel are you able to report back on whether Michael's patch fixes the issue for you?

By: Rusty Newton (rnewton) 2014-02-21 17:28:10.874-0600

Michael, Joel hasn't responded in a few weeks, so if you can reproduce the issue and your patch fixes it then I would move forward with it.

By: Joel Vandal (joel_vandal) 2014-02-21 19:42:29.980-0600

Sorry, I've been very busy since last weeks, I will do some test this week.

By: Joel Vandal (joel_vandal) 2014-02-24 13:02:30.590-0600

I *confirm* that everything work as expected using patch from Jan 15.

[2014-02-24 14:00:23] WARNING[13956]: func_audiohookinherit.c:233 func_inheritance_write: No channel was provided to INHERITANCE function.