[asterisk-dev] [Code Review] 4457: translator: Prevent invalid memory accesses on fast shutdown

Mark Michelson reviewboard at asterisk.org
Tue Mar 3 12:52:41 CST 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4457/#review14576
-----------------------------------------------------------

Ship it!


Ship It!

- Mark Michelson


On March 3, 2015, 5:23 p.m., Matt Jordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4457/
> -----------------------------------------------------------
> 
> (Updated March 3, 2015, 5:23 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When a 'core restart now' or 'core stop now' is executed and a channel is currently in a media operation, the translator matrix can be destroyed while a channel is currently blocked on getting the best translation choice (see ast_translator_best_choice). When the channel gets the mutex, the translation matrix now has invalid memory, and Asterisk crashes.
> 
> This patch does two things:
> (1) We now only clean up the translation matrix on a graceful shutdown. In that case, there are no channels, and so there is no risk of this occurring.
> (2) We also now set the __matrix and __indextable to NULL. In some initial backtraces when this occurred, it looked as if there was a memory corruption occurring, and it wasn't until we determined that something had restarted Asterisk that the issue became clear. By setting these to NULL on shutdown, it becomes a bit easier to determine why a crash is occurring.
> 
> Note that we could litter the code with NULL checks on the __matrix, but the act of making the translation matrix cleaned up on shutdown should preclude this issue from occurring in the first place, and this part of the code needs to be as fast as possible.
> 
> 
> Diffs
> -----
> 
>   /branches/13/main/translate.c 432443 
> 
> Diff: https://reviewboard.asterisk.org/r/4457/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Matt Jordan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150303/88141e67/attachment.html>


More information about the asterisk-dev mailing list