Closed
Bug 1281965
Opened 8 years ago
Closed 7 years ago
Hash table re-entrancy during shutdown with non-ASCII font names
Categories
(Core :: Graphics: Text, defect)
Core
Graphics: Text
Tracking
()
RESOLVED
FIXED
mozilla58
People
(Reporter: jruderman, Assigned: milan)
References
Details
(Keywords: assertion, sec-moderate, testcase, Whiteboard: [adv-main58+][post-critsmash-triage])
Attachments
(3 files, 1 obsolete file)
1. Put computer under heavy load
2. Load the testcase
3. Quit
Result:
Assertion failure: IsIdle(oldState), at xpcom/glue/PLDHashTable.h:132
...sometimes.
Reporter | ||
Comment 1•8 years ago
|
||
Partial stack:
* frame #0: XUL`Checker::StartWriteOp
frame #1: XUL`AutoWriteOp::AutoWriteOp
frame #2: XUL`AutoWriteOp::AutoWriteOp
frame #3: XUL`PLDHashTable::Add
frame #4: XUL`PLDHashTable::Add
frame #5: XUL`nsTHashtable<nsStringHashKey>::PutEntry
frame #6: XUL`gfxPlatformFontList::FindAndAddFamilies
frame #7: XUL`gfxMacPlatformFontList::FindAndAddFamilies
frame #8: XUL`gfxPlatformFontList::FindFamily
frame #9: XUL`gfxPlatformFontList::CleanupLoader
frame #10: XUL`gfxFontInfoLoader::CancelLoader
frame #11: XUL`gfxFontInfoLoader::ShutdownObserver::Observe
frame #12: XUL`nsObserverList::NotifyObservers
frame #13: XUL`nsObserverService::NotifyObservers
frame #14: XUL`nsAppStartup::Quit
frame 9, gfxPlatformFontList::CleanupLoader, is iterating over mOtherNamesMissed
frame 6, gfxPlatformFontList::FindAndAddFamilies, adds an entry to mOtherNamesMissed.
Modifying a PLDHashTable while iterating over it is unsafe. In debug builds, it aborts. In release builds, IIRC, it can lead to the use of dangling pointers, especially if the hash table is resized.
Reporter | ||
Comment 2•8 years ago
|
||
I'm guessing the time-based heuristics in gfxPlatformFontList.cpp are responsible for the intermittency :/
Reporter | ||
Updated•8 years ago
|
Attachment #8764785 -
Attachment mime type: text/html → text/html;charset=UTF-8
Updated•8 years ago
|
Keywords: sec-moderate
Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Jesse Ruderman from comment #1)
>...
>
> frame 9, gfxPlatformFontList::CleanupLoader, is iterating over
> mOtherNamesMissed
>
> frame 6, gfxPlatformFontList::FindAndAddFamilies, adds an entry to
> mOtherNamesMissed.
>
> Modifying a PLDHashTable while iterating over it is unsafe. In debug builds,
> it aborts. In release builds, IIRC, it can lead to the use of dangling
> pointers, especially if the hash table is resized.
Didn't think it'd be a problem as we break out of the iteration loop if FindAndAddFamilies adds an entry, but I guess it is.
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 4•7 years ago
|
||
Assignee: nobody → milan
Assignee | ||
Comment 5•7 years ago
|
||
Comment on attachment 8923591 [details] [diff] [review]
When iterating for deletion, do not add more elements. r=jfkthame
https://treeherder.mozilla.org/#/jobs?repo=try&revision=db8c0765a28e8360d367d188270731ecbd08e1f2
Attachment #8923591 -
Flags: review?(jfkthame)
Assignee | ||
Comment 6•7 years ago
|
||
::CleanupLoader does appear to be the only place that needs this different behaviour (don't create if you don't find it), calling through FindFamily() into FindAndAddFamilies().
Comment 7•7 years ago
|
||
Comment on attachment 8923591 [details] [diff] [review]
When iterating for deletion, do not add more elements. r=jfkthame
Review of attachment 8923591 [details] [diff] [review]:
-----------------------------------------------------------------
Looks reasonable, except for one small detail... r=me with that fixed.
::: gfx/thebes/gfxPlatformFontList.h
@@ +152,5 @@
> // family name for a styled variant.
> + eNoSearchForLegacyFamilyNames = 1 << 1,
> +
> + // If set, FindAndAddFamilies will not add a missing entry to mOtherNamesMissed
> + eNoAddToNamesMissedWhenSearching = 1 << 1,
I think you meant "1 << 2" here?
Attachment #8923591 -
Flags: review?(jfkthame) → review+
Assignee | ||
Comment 8•7 years ago
|
||
(In reply to Jonathan Kew (:jfkthame) from comment #7)
> ...
>
> Looks reasonable, except for one small detail
Kind of you calling it a small detail that makes the code not work properly :)
Flags: needinfo?(jfkthame)
Assignee | ||
Comment 9•7 years ago
|
||
I can't recall if sec-moderate needs a security review or not, so here's a request anyway.
[Security approval request comment]
How easily could an exploit be constructed based on the patch? Not easily.
Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem? Not really.
Which older supported branches are affected by this flaw? All of them, but this is sec-moderate so I'm not sure how far back we need to go.
If not all supported branches, which bug introduced the flaw?
Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be? Backports should be easy.
How likely is this patch to cause regressions; how much testing does it need? Not likely, will receive testing through regular Firefox usage.
Attachment #8923591 -
Attachment is obsolete: true
Attachment #8924174 -
Flags: sec-approval?
Attachment #8924174 -
Flags: review+
Comment 10•7 years ago
|
||
https://wiki.mozilla.org/Security/Bug_Approval_Process says you can land a sec-moderate directly; only high or critical are supposed to wait for approval.
Comment 11•7 years ago
|
||
Comment on attachment 8924174 [details] [diff] [review]
When iterating for deletion, do not add more elements. Carry r=jfkthame
Yes, as a sec-moderate, this doesn't need sec-approval to land on trunk.
Attachment #8924174 -
Flags: sec-approval?
Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Comment 12•7 years ago
|
||
Keywords: checkin-needed
Comment 13•7 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a9930291f639
I'm going to assume this is something we don't need to worry about backporting to ESR52, but feel free to set the status to affected and nominate it for approval if you feel strongly otherwise. Same for 57.
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox50:
affected → ---
status-firefox56:
--- → wontfix
status-firefox57:
--- → wontfix
status-firefox58:
--- → fixed
status-firefox-esr52:
--- → wontfix
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Updated•7 years ago
|
Group: gfx-core-security → core-security-release
Updated•7 years ago
|
Whiteboard: [adv-main58+]
Updated•7 years ago
|
Flags: qe-verify-
Whiteboard: [adv-main58+] → [adv-main58+][post-critsmash-triage]
Updated•6 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•