Closed
Bug 1137336
Opened 10 years ago
Closed 10 years ago
fix weak map tracing hazard due to function pointer
Categories
(Core :: JavaScript: GC, defect)
Tracking
()
RESOLVED
FIXED
mozilla39
People
(Reporter: sfink, Assigned: sfink)
References
Details
(Keywords: sec-other, Whiteboard: [adv-main37-][post-critsmash-triage])
Attachments
(1 file, 1 obsolete file)
2.55 KB,
patch
|
terrence
:
review+
lsblakk
:
approval-mozilla-aurora+
lsblakk
:
approval-mozilla-beta+
bkerensa
:
approval-mozilla-esr31-
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #1120655 +++
Function '_ZN2js11WeakMapBase16traceAllMappingsEPNS_13WeakMapTracerE|void js::WeakMapBase::traceAllMappings(js::WeakMapTracer*)' has unrooted 'c' of type 'class js::CompartmentsIterT<js::ZonesIter>' live across GC call js::WeakMapBase.traceMappings at js/src/jsweakmap.cpp:135
The problem here is js::TraceWeakMaps. It is called by https://dxr.mozilla.org/mozilla-central/source/xpcom/base/CycleCollectedJSRuntime.cpp#245 and another place in the same file, and it ends up calling the js::WeakMapTracer.callback function pointer.
I believe this is a false positive. But determining that is not straightforward. This is called by nsCycleCollector::FixGrayBits, which in fact *does* GC, but only after calling mJSRuntime->FixWeakMappingGrayBits(). So it's not like I can just say "the cycle collector won't GC while it's figuring out the gray bits."
I guess the trick would be to prove that the WeakMapTracer.callback won't GC. The easiest way to do that would be to make the API use a virtual function.
Assignee | ||
Updated•10 years ago
|
Summary: Make the analysis detect compartment iterator invalidation → fix weak map tracing hazard due to function pointer
Assignee | ||
Comment 1•10 years ago
|
||
This probably shouldn't be sec-high, as it is very likely to be a false positive. In fact, I think I may "fix" this by adding in an AutoSuppressAnalysis, which will at least crash in debug builds if I am wrong and this can GC.
Keywords: csectype-bounds
Assignee | ||
Comment 2•10 years ago
|
||
Assertion pushed to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c75f426e82e0
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → sphink
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•10 years ago
|
||
The one thing I'm not sure of is whether I should be using AutoAssertGCCallback instead.
Attachment #8570563 -
Flags: review?(terrence)
Assignee | ||
Updated•10 years ago
|
Attachment #8570010 -
Attachment is obsolete: true
Updated•10 years ago
|
Comment 4•10 years ago
|
||
Comment on attachment 8570563 [details] [diff] [review]
Explicitly disallow WeakMapTracer.callback from GCing
Review of attachment 8570563 [details] [diff] [review]:
-----------------------------------------------------------------
Yes, this is the right solution -- disallowing GC from a GC callback seems like a no-brainer.
Attachment #8570563 -
Flags: review?(terrence) → review+
Assignee | ||
Comment 5•10 years ago
|
||
Assignee | ||
Comment 6•10 years ago
|
||
Comment on attachment 8570563 [details] [diff] [review]
Explicitly disallow WeakMapTracer.callback from GCing
Approval Request Comment
[Feature/regressing bug #]: unknown (as in, I didn't bother to dig it up)
[User impact if declined]: none. But if we backport the static analysis fixes that complain about this false positive, then we will have to ignore this failure for the hazard builds.
[Describe test coverage new/current, TreeHerder]: just now landed on mozilla-inbound
[Risks and why]: no change to release builds. For debug builds, adds an assertion that would indicate a serious problem (but is not expected to ever hit.)
[String/UUID change made/needed]: none
Attachment #8570563 -
Flags: approval-mozilla-beta?
Attachment #8570563 -
Flags: approval-mozilla-aurora?
Comment 7•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Updated•10 years ago
|
Attachment #8570563 -
Flags: approval-mozilla-beta?
Attachment #8570563 -
Flags: approval-mozilla-beta+
Attachment #8570563 -
Flags: approval-mozilla-aurora?
Attachment #8570563 -
Flags: approval-mozilla-aurora+
Updated•10 years ago
|
status-firefox37:
--- → affected
status-firefox38:
--- → affected
Comment 8•10 years ago
|
||
Assignee | ||
Comment 9•10 years ago
|
||
Comment on attachment 8570563 [details] [diff] [review]
Explicitly disallow WeakMapTracer.callback from GCing
[Approval Request Comment]
If this is not a sec:{high,crit} bug, please state case for ESR consideration: it gives us the option of backporting bug 1120655, which is the updates to the analysis that mark this as a hazard (though it's believed to be a false positive)
User impact if declined: none. It might make it a little less confusing about what patch landed where, but it's not a huge deal either way.
Fix Landed on Version: it's been backported to 37
Risk to taking this patch (and alternatives if risky): the main risk is that the added debug assert finds out that this is a true positive, and we have to run around and fix something. That's not a problem with landing this patch, though. This patch does not change behavior in a release build.
String or UUID changes made by this patch: none
Attachment #8570563 -
Flags: approval-mozilla-esr31?
Comment 10•10 years ago
|
||
status-b2g-v2.2:
--- → fixed
status-b2g-master:
--- → fixed
status-firefox-esr31:
--- → wontfix
status-firefox-esr38:
--- → fixed
Updated•10 years ago
|
Whiteboard: [adv-main37-]
Comment 11•10 years ago
|
||
bkerensa needs to be able to see this for building ESR.
Comment 12•10 years ago
|
||
Lawrence wanted me to check per comment 11 I was unable to see these bugs and will need my privleges adjusted but do we want to respin on these?
Flags: needinfo?(abillings)
Comment 13•10 years ago
|
||
(In reply to Liz Henry (:lizzard) from comment #11)
> bkerensa needs to be able to see this for building ESR.
Except this is "won't fix" for ESR31 per the flags. It is also a sec-other, which we don't take on ESR without a reason (we only take sec-high and sec-critical normally). There is no reason for anything to think we would take this on ESR31.
Flags: needinfo?(abillings)
Updated•10 years ago
|
Attachment #8570563 -
Flags: approval-mozilla-esr31? → approval-mozilla-esr31-
Updated•10 years ago
|
Group: javascript-core-security
Updated•9 years ago
|
Group: core-security → core-security-release
Updated•9 years ago
|
Whiteboard: [adv-main37-] → [adv-main37-][post-critsmash-triage]
Updated•8 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•