[asterisk-dev] [Code Review] used auth= parameter freed during sip reload => crash

David Vossel reviewboard at asterisk.org
Fri Jul 1 11:48:47 CDT 2011


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

Ship it!


Yep, this will definitely fix it and the code looks great!

My only concern is that it adds more ref counting/locking complexity into the channel driver.  This could be avoided with more work by converting the auth container to an ao2_container and having the sip_auth objects become ao2_objects.  At that point you could get rid of all the refcounting and locking.  Locking and ref counting will still occur but its within the astobj2 code during the link, unlink, and iterators.  Copying an auth list would just be a matter of linking objects from one list into another.  The global, peer, and dialog auth containers would always be present and only cleared when reloads happened.  The only ref counting that would occur would be when dialogs and peers are destroyed, decrementing their auth containers.

Since this is a small patch I don't feel strongly one way or the other.  I just wanted to point out the advantages of using all ao2 objects and containers.

- David


On June 30, 2011, 4:28 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1303/
> -----------------------------------------------------------
> 
> (Updated June 30, 2011, 4:28 p.m.)
> 
> 
> Review request for Asterisk Developers, Russell Bryant and David Vossel.
> 
> 
> Summary
> -------
> 
> If you use the auth= parameter and do a "sip reload" while there is an ongoing call.  The peer->auth data points to free'd memory.
> 
> The patch does several things:
> 1) Puts the authentication list into an ao2 object for reference counting to fix the reported crash during a SIP reload.
> 2) Converts the authentication list from open coding to AST list macros.
> 3) Adds display of the global authentication list in "sip show settings".
> 
> 
> This addresses bug ASTERISK-17939.
>     https://issues.asterisk.org/jira/browse/ASTERISK-17939
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 325936 
>   /branches/1.8/channels/sip/include/sip.h 325936 
> 
> Diff: https://reviewboard.asterisk.org/r/1303/diff
> 
> 
> Testing
> -------
> 
> Ran asterisk under valgrind and attempted to make an authenticated SIP call.  Added debug statements on the test system and confirmed that the created dialog got the authentication list and that the list was used to create the challenge response.
> 
> Note: My test setup failed to connect because of how my setup was looping back the call.  I got a 482 loopback detected.  For this patch it was sufficient to determine that the necessary code paths were executed.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110701/75d72251/attachment.htm>


More information about the asterisk-dev mailing list