Closed Bug 1395241 Opened 9 years ago Closed 8 years ago

Crash in mozilla::DataChannelConnection::SctpDtlsOutput

Categories

(Core :: WebRTC: Networking, defect, P1)

49 Branch
x86
Windows
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox-esr52 --- wontfix
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- wontfix
firefox60 --- wontfix

People

(Reporter: drno, Assigned: jesup)

Details

(4 keywords)

Crash Data

Attachments

(1 file)

Looking at crash stats it looks like we did not completely fix the problem in bug 1294095. It is still happening with a lot lower frequency then before, but still happening for example with 55.0.3. +++ This bug was initially created as a clone of Bug #1294095 +++ This bug was filed from the Socorro interface and is report bp-c237a768-7c3a-4c28-b18c-ad34f2160810. ============================================================= Crashing Thread (54) Frame Module Signature Source 0 xul.dll mozilla::DataChannelConnection::SctpDtlsOutput(void*, void*, unsigned int, unsigned char, unsigned char) netwerk/sctp/datachannel/DataChannel.cpp:691 1 xul.dll sctp_lowlevel_chunk_output netwerk/sctp/src/netinet/sctp_output.c:5010 2 mozglue.dll je_malloc memory/mozjemalloc/jemalloc.c:6184 3 xul.dll sctp_abort_an_association netwerk/sctp/src/netinet/sctputil.c:4212 4 xul.dll sctp_threshold_management netwerk/sctp/src/netinet/sctp_timer.c:167 5 xul.dll sctp_t3rxt_timer netwerk/sctp/src/netinet/sctp_timer.c:832 6 xul.dll sctp_timeout_handler netwerk/sctp/src/netinet/sctputil.c:1706 7 xul.dll sctp_handle_tick netwerk/sctp/src/netinet/sctp_callout.c:155 8 xul.dll user_sctp_timer_iterate netwerk/sctp/src/netinet/sctp_callout.c:194 9 kernel32.dll BaseThreadInitThunk 10 ntdll.dll __RtlUserThreadStart 11 ntdll.dll _RtlUserThreadStart crashes with this signature are regressing in number since the 49 nightly cycle & the signature is currently making up 0.3% of browser crashes in 49.0b1.
Whiteboard: [adv-main49+][adv-esr45.4+]
Group: core-security → media-core-security
sec-high - plain UAF read, low-frequency
Maire, can you help find an owner for this?
Flags: needinfo?(mreavy)
Worth a shot to try to ensure the timer queues are cleared and won't call us back late. Michael, could this help? Note that currently we're use-after-free on the addr value ('peer' -- DataChannelConnection object) in SctpDtlsOutput(), while outputing a chunk from a SCTP_TIMER_TYPE_SHUTDOWN timer callback. It's very hard to clearly see where the timer is known to be shutdown and how one can ensure that - there's no usrsctp_disconnect() to match usrsctp_connect(). In any case, this looks safe. Might it help? is there another call we can make that's sure to help? Even if we have to call into a non-public layer?
Attachment #8907785 - Flags: review?(tuexen)
Assignee: nobody → rjesup
Status: NEW → ASSIGNED
Randell's going to take a shot at this because he knows about datachannels and the sctp library better than anyone else at Moz currently.
Flags: needinfo?(mreavy)
Rank: 9
Mass change P1->P2 to align with new Mozilla triage process.
Priority: P1 → P2
Priority: P2 → P1
Comment on attachment 8907785 [details] [diff] [review] shutdown SCTP sockets before usrsctp_close() Review of attachment 8907785 [details] [diff] [review]: ----------------------------------------------------------------- You can call that, but I don't think it will help. You can abort the association (if that is possible there) by setting the SO_LINGER option can then calling usrsctp_close() on the sockets. I'm also working on a change in the usrsctp stack, that after registering the address, it will not be used anymore. That change should fix this issue.
Attachment #8907785 - Flags: review?(tuexen) → review+
Randel: do you want to land your r+ed patch and see if it helps, or do you want to wait for Michaels changes (not sure how long we would have to wait though)?
Flags: needinfo?(rjesup)
Flags: needinfo?(rjesup)
This is likely wrapped up with the other shutdown bugs for SCTP
SO_LINGER is already turned off. Can someone trace the packet(s) that are being sent when addr is a dangling pointer? This might help to identify the cause. Randell, it could be that shutdown triggers a message, so it's probably wise to reverse the calls (call usrsctp_shutdown first and then usrsctp_deregister_address). Correct me if I'm wrong, Michael.
Needinfo'ing the two persons mentioned in the comment above in case they didn't it.
Flags: needinfo?(tuexen)
Flags: needinfo?(rjesup)
Flags: needinfo?(rjesup)
usrsctp_shutdown() triggers the graceful shutdown. If you want to do an ungraceful shutdown, call usrsctp_close() after setting the SO_LINGER option. If you want to send SHUTDOWN chunk, you should call usrsctp_deregister_address() later.
Flags: needinfo?(tuexen)
So, calling usrsctp_shutdown is definitely not what we want as we don't do graceful shutdowns. As I know that the usrsctp code base has just been updated for Firefox, should we wait and see if it happens again? I don't see anything wrong in the call order at the moment (then again, it's threaded and really messes with my head).
Agree that looking at comment #11 suggests that we don't land the patch. And as it's somewhat likely that is also part of the shutdown race condition we discovered we should wait and see if this issue here dis-appears as well.
No crashes since the crash-stats DB clear in a version with the SCTP update
another month with no crashes with SCTP update. Fixed or changed signature
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Group: media-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: