[asterisk-bugs] [JIRA] (ASTERISK-25645) res_rtp_asterisk: Lock inversion

Steve Davies (JIRA) noreply at issues.asterisk.org
Fri Sep 16 04:09:02 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232314#comment-232314 ] 

Steve Davies commented on ASTERISK-25645:
-----------------------------------------

I have recently been running my local builds with ASTERISK-25614 applied. On 6/Jan I commented (above) about a hackish patch I was applying to pjproject-2.4.5 at the same time, which I believe may in fact be correct. It ensures that the lock inversion does not occur. I've had no obvious problems with it.

--- pjproject-2.4.5.orig/pjnath/src/pjnath/ice_session.c
+++ pjproject-2.4.5/pjnath/src/pjnath/ice_session.c
@@ -1157,9 +1157,11 @@ static void on_timer(pj_timer_heap_t *th
            ice_status = ice->ice_status;
            on_ice_complete = ice->cb.on_ice_complete;
 
+           pj_grp_lock_release(ice->grp_lock);
            /* Notify app about ICE completion*/
            if (on_ice_complete)
                (*on_ice_complete)(ice, ice_status);
+           return;
        }
        break;
     case TIMER_START_NOMINATED_CHECK:


> res_rtp_asterisk: Lock inversion
> --------------------------------
>
>                 Key: ASTERISK-25645
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25645
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_rtp_asterisk
>            Reporter: Steve Davies
>         Attachments: deadlocked_threads.txt, experimental_anti_deadlock, unlock_ice_before_callback
>
>
> Reported by Steve Davies on asterisk-dev:
> commit 5e6b1476a087407a052f007d326c504cfeefebe7
> ASTERISK-25614
> 2 code paths which approximate the following will cause a lock-inversion deadlock:
> approximate call orders are:
> a)
> pj_timer_heap_poll (PJ_LOCK)
> ast_rtp_on_ice_complete
> ast_rtp_instance_set_remote_address
> remote_address_set
> ast_rtp_remote_address_set
> (DTLS_LOCK)
> ...
> b)
> ast_pbx...
> app_dial
> bridge...
> read
> rtp_read
> ...
> __rtp_recvfrom
> (DTLS_LOCK)
> dtls_srtp_check_pending
> __rtp_sendto
> pj_ice_sess_send_data
> (PJ_LOCK)



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



More information about the asterisk-bugs mailing list