ThreadSanitizer: data race [@ nsPluginTag::nsPluginTag] vs. [@ nsFakePluginTag] on nsIInternalPluginTag::sNextId
Categories
(Core Graveyard :: Plug-ins, defect, P3)
Tracking
(firefox73 affected)
Tracking | Status | |
---|---|---|
firefox73 | --- | affected |
People
(Reporter: decoder, Assigned: KrisWright)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
The attached crash information was detected while running CI tests with ThreadSanitizer on mozilla-central revision d1ac49b9eb3e.
This seems to be a race on updating nsIInternalPluginTag::sNextId
. Since that variable is not an atomic, updating it from the two threads at the same time could cause us to have the same id on the two classes instantiated here. Probably nsIInternalPluginTag::sNextId
should be an atomic. It would be good to know what the actual consequences are, if we end up with the same id assigned twice here.
General information about TSan reports
Why fix races?
Data races are undefined behavior and can cause crashes as well as correctness issues. Compiler optimizations can cause racy code to have unpredictable and hard-to-reproduce behavior.
Rating
If you think this race can cause crashes or correctness issues, it would be great to rate the bug appropriately as P1/P2 and/or indicating this in the bug. This makes it a lot easier for us to assess the actual impact that these reports make and if they are helpful to you.
False Positives / Benign Races
Typically, races reported by TSan are not false positives [1], but it is possible that the race is benign. Even in this case it would be nice to come up with a fix if it is easily doable and does not regress performance. Every race that we cannot fix will have to remain on the suppression list and slows down the overall TSan performance. Also note that seemingly benign races can possibly be harmful (also depending on the compiler, optimizations and the architecture) [2][3].
[1] One major exception is the involvement of uninstrumented code from third-party libraries.
[2] http://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong
[3] How to miscompile programs with "benign" data races: https://www.usenix.org/legacy/events/hotpar11/tech/final_files/Boehm.pdf
Suppressing unfixable races
If the bug cannot be fixed, then a runtime suppression needs to be added in mozglue/build/TsanOptions.cpp
. The suppressions match on the full stack, so it should be picked such that it is unique to this particular race. The bug number of this bug should also be included so we have some documentation on why this suppression was added.
Reporter | ||
Comment 1•4 years ago
|
||
Comment 2•4 years ago
|
||
My understanding is that in practice, nothing creates fake plugin tags. We have code and tests for it, it was going to be used for something (mortar/pdfium/flash-in-js, I think?) and is not currently used by anything. So if the only racy mainthread use is through fake plugins, we should be OK in practice.
I haven't audited for other uses, though I'd have expected issues with the "real" nsPluginTag to have come up before now if they existed, assuming we run TSan fairly regularly... I think that when I moved some of this code off the main thread in bug 1545123, I did it in such a way that there is only ever 1 thread creating (the "real") plugin tags, but I am human so I wouldn't be at all surprised if I screwed that up.
Comment 3•4 years ago
|
||
The priority flag is not set for this bug.
:jimm, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Comment 4•4 years ago
|
||
Triage: still an issue
Comment 5•4 years ago
|
||
Comment 6•4 years ago
|
||
Note that Flash support will be disabled in Fx85 (Nightly 2020-11-16), so we shouldn't spend much time analyzing or fixing plugin bugs or tests.
The plugin code (including nsPluginTag) will be deleted after Fx85 ships in January.
Comment 7•4 years ago
|
||
Oh perfect, I was actually going to suggest deleting FakePlugin if it was indeed dead code. The whole subsystem being deleted is even better!
Assignee | ||
Comment 8•3 years ago
|
||
Plugin code is being removed in bug 1677160.
Assignee | ||
Comment 9•2 years ago
|
||
It looks like this data race might not be hit anymore.
Updated•2 years ago
|
Comment 10•2 years ago
|
||
Pushed by kwright@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eb50c6a1ebed Remove TSan suppression for nsPluginTag. r=decoder
Comment 11•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•