Closed
Bug 1398711
Opened 6 years ago
Closed 6 years ago
Data race in accessing mClosed in MediaCacheStream::Seek()
Categories
(Core :: Audio/Video: Playback, enhancement, P3)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox57 | --- | fixed |
People
(Reporter: jwwang, Assigned: jwwang)
References
Details
Attachments
(2 files)
http://searchfox.org/mozilla-central/rev/00fa5dacedb925022f53d025121f1a919508e7ce/dom/media/MediaCache.cpp#2115 mClosed is updated on the main thread without holding the lock. It is a data race to read mClosed off the main thread in Seek(). http://searchfox.org/mozilla-central/rev/00fa5dacedb925022f53d025121f1a919508e7ce/dom/media/MediaCache.cpp#2286
Assignee | ||
Updated•6 years ago
|
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Updated•6 years ago
|
Attachment #8907384 -
Flags: review?(gsquelart)
Attachment #8907385 -
Flags: review?(gsquelart)
Comment 3•6 years ago
|
||
mozreview-review |
Comment on attachment 8907384 [details] Bug 1398711. P1 - remove unused methods. https://reviewboard.mozilla.org/r/179068/#review184166
Attachment #8907384 -
Flags: review?(gsquelart) → review+
Comment 4•6 years ago
|
||
mozreview-review |
Comment on attachment 8907385 [details] Bug 1398711. P2 - write to mClosed only when the cache monitor is held. https://reviewboard.mozilla.org/r/179070/#review184168 ::: dom/media/MediaCache.h:225 (Diff revision 1) > void SetTransportSeekable(bool aIsTransportSeekable); > // This must be called (and return) before the ChannelMediaResource > // used to create this MediaCacheStream is deleted. > void Close(); > // This returns true when the stream has been closed > bool IsClosed() const { return mClosed; } AFAICS IsClosed() is only called from ChannelMediaResource::IsClosed(), which you nuked in P1, so you could get rid of this one too; that's one fewer instance of mClosed to worry about. ::: dom/media/MediaCache.h:227 (Diff revision 1) > bool IsAvailableForSharing() const > { > return !mClosed && !mIsPrivateBrowsing && What about this access?
Attachment #8907385 -
Flags: review?(gsquelart) → review+
Assignee | ||
Comment 5•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8907385 [details] Bug 1398711. P2 - write to mClosed only when the cache monitor is held. https://reviewboard.mozilla.org/r/179070/#review184168 > AFAICS IsClosed() is only called from ChannelMediaResource::IsClosed(), which you nuked in P1, so you could get rid of this one too; that's one fewer instance of mClosed to worry about. It is used here: http://searchfox.org/mozilla-central/rev/e76c0fee79a34a3612740b33508276f4b37c3ee8/dom/media/MediaCache.cpp#243 It is safe for ResourceStreamIterator to call IsClosed() only after P2 is landed. > What about this access? IsAvailableForSharing() is called only on the main thread. I will add a main-thread assertion so it is easier to read and reason about the code.
Comment 6•6 years ago
|
||
mozreview-review-reply |
Comment on attachment 8907385 [details] Bug 1398711. P2 - write to mClosed only when the cache monitor is held. https://reviewboard.mozilla.org/r/179070/#review184168 > It is used here: http://searchfox.org/mozilla-central/rev/e76c0fee79a34a3612740b33508276f4b37c3ee8/dom/media/MediaCache.cpp#243 > > It is safe for ResourceStreamIterator to call IsClosed() only after P2 is landed. Ah you're right, sorry -- Searchfox didn't find it! > IsAvailableForSharing() is called only on the main thread. I will add a main-thread assertion so it is easier to read and reason about the code. Thanks.
Assignee | ||
Comment 7•6 years ago
|
||
Thanks for the review!
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 10•6 years ago
|
||
Pushed by jwwang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/84abfad4ada9 P1 - remove unused methods. r=gerald https://hg.mozilla.org/integration/autoland/rev/b420bb292e68 P2 - write to mClosed only when the cache monitor is held. r=gerald
![]() |
||
Comment 11•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/84abfad4ada9 https://hg.mozilla.org/mozilla-central/rev/b420bb292e68
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox57:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in
before you can comment on or make changes to this bug.
Description
•