[asterisk-bugs] [JIRA] (ASTERISK-25094) PBX core: Investigate thread safety issues

Corey Farrell (JIRA) noreply at issues.asterisk.org
Fri May 15 08:05:33 CDT 2015


Corey Farrell created ASTERISK-25094:
----------------------------------------

             Summary: PBX core: Investigate thread safety issues
                 Key: ASTERISK-25094
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25094
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/PBX
    Affects Versions: 13.3.2, 11.17.1, SVN
            Reporter: Corey Farrell


While working on ASTERISK-25085 I found that {{ast_context_find}} and {{ast_context_find_or_create}} are not thread safe. They both return an ast_context, but as soon as these functions run {{ast_unlock_contexts}} it's possible for another thread to cause the context to be freed.

Any function that works with ast_context pointers (input or output) and runs it's own locking is likely unsafe for the same reason.

I think we need a _nolock versions of many functions, where the caller would run them with a lock.  For master maybe it would be better for ast_context to become an AO2 object?  This way we could avoid destroying contexts during merge operations, we would just copy references of original contexts that we still need, then unreference everything from the original list when we swap out.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list