Closed Bug 1133051 Opened 10 years ago Closed 10 years ago

MediaPipeline releases SrtpFlows on the wrong thread

Categories

(Core :: WebRTC: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: bwc, Assigned: bwc)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

While playing with TSAN, I noticed that we're getting data races when MediaPipelines are destroyed, because the SrtpFlow members are being destroyed on main instead of STS. This seems to have been a problem for a long time (the bundle work moved these into another member, but they weren't being deleted correctly before either). We probably need to release the references in MediaPipeline::ShutdownTransport_s, in the same place where we release the TransportFlows.
I should note that the specific race I observed was here, which looks pretty alarming at first glance, but AFAICT we don't actually do anything with the value: https://dxr.mozilla.org/mozilla-central/source/netwerk/srtp/src/crypto/cipher/aes_icm.c?from=aes_icm.c&case=true#149
Attached patch Clean up SctpFlows on STS (obsolete) — Splinter Review
Assignee: nobody → docfaraday
Status: NEW → ASSIGNED
Keywords: sec-audit
Attachment #8564352 - Flags: review?(martin.thomson)
I note that this bug seems to be about SRTP but the patch is titled SCTP. I believe that the bug title is what is correct. This does appear to be a problem. Are we sure that there is never any time when the flows are also manipulated on main, e.g., when they are created?
Yes, I seem to have made a typo in the patch description. I have not carried out any analysis of whether there are other racy accesses on these. I'll try to make some time for this.
It does not look like these are touched anywhere other than STS to me.
Comment on attachment 8564352 [details] [diff] [review] Clean up SctpFlows on STS Review of attachment 8564352 [details] [diff] [review]: ----------------------------------------------------------------- ::: media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ +105,5 @@ > disconnect_all(); > transport_->Detach(); > rtp_.transport_ = nullptr; > + rtp_.send_srtp_ = nullptr; > + rtp_.recv_srtp_ = nullptr; Might be better to move this to a TransportInfo::Detach(). or ::Destroy().
Attachment #8564352 - Flags: review?(martin.thomson) → review+
Incorporate feedback.
Flags: needinfo?(docfaraday)
Attachment #8564352 - Attachment is obsolete: true
Flags: needinfo?(docfaraday)
I was unable to spot any other races than the one in comment 1, and that one looked harmless since the value was never used apart from logging (https://dxr.mozilla.org/mozilla-central/search?q=%2Bvar-ref%3Acipher_type_t%3A%3Aref_count). This is probably not worth keeping as security sensitive.
Keywords: sec-audit
Group: core-security
Blocks: tsan
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: