Last Comment Bug 716067 - Possibly missing UnmarkGray in a few places
: Possibly missing UnmarkGray in a few places
Status: RESOLVED FIXED
[sg:low][qa-][advisory-tracking+]
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla13
Assigned To: Bill McCloskey (:billm)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-06 13:58 PST by Bill McCloskey (:billm)
Modified: 2012-07-12 08:54 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+
fixed
-
wontfix


Attachments
fix mPrototypeNoHelper (1.07 KB, patch)
2012-01-06 14:02 PST, Bill McCloskey (:billm)
bent.mozilla: review+
Details | Diff | Review
fix tearoffs (7.06 KB, patch)
2012-01-06 14:19 PST, Bill McCloskey (:billm)
bent.mozilla: review+
Details | Diff | Review
fix waiver wrappers (1.13 KB, patch)
2012-01-06 14:22 PST, Bill McCloskey (:billm)
bent.mozilla: review+
Details | Diff | Review
fix the DOM prototype cache (861 bytes, patch)
2012-02-08 13:04 PST, Bill McCloskey (:billm)
bent.mozilla: review+
Details | Diff | Review

Description Bill McCloskey (:billm) 2012-01-06 13:58:01 PST
I'm not sure if these are correct, but it seems like we could be missing UnmarkGray calls in a few places.
Comment 1 Bill McCloskey (:billm) 2012-01-06 14:02:09 PST
Created attachment 586560 [details] [diff] [review]
fix mPrototypeNoHelper

The concern here is that someone could cause get a reference to a scope's mPrototypeNoHelper. Then it could stash the reference in a DOM object or something and relinquish all other references, cause the mPrototypeNoHelper object to be marked gray. Later, they could cause an object to be created with mPrototypeNoHelper as its proto. This would lead to a black -> gray pointer (via the proto edge), which violates our invariants.
Comment 2 Bill McCloskey (:billm) 2012-01-06 14:19:34 PST
Created attachment 586568 [details] [diff] [review]
fix tearoffs

This patch is questionable. In theory, if a tear-off JS object could become gray while the XPC wrapped native's JS object was black, then the tear-off's JS object could be exposed to JS code via DefinePropertyIfFound's to->GetJSObject() call.

However, as far as I can tell from the code, once a tear-off's JS object has been created, it always has a strong reference from the wrapped native's flattened object (via property that it set during the resolve hook). However, if that's true, then I don't understand the purpose of all this tear-off sweeping code. Why don't we just keep the tear-offs alive as long as the WrappedNative is alive?
Comment 3 Bill McCloskey (:billm) 2012-01-06 14:22:13 PST
Created attachment 586570 [details] [diff] [review]
fix waiver wrappers

Same story. It seems like we could add a waiver wrapper to the map, then it could end up gray if it's stored in a DOM object, and then we could look it up in the map again and return it to JS code.

However, I have no idea what a waiver wrapper is, so I may be wrong.
Comment 4 Daniel Veditz [:dveditz] 2012-01-11 16:59:09 PST
guessing at a moderate security severity due to the uncertainty indicated by "possibly" in the summary.
Comment 5 Ben Turner (not reading bugmail, use the needinfo flag!) 2012-02-08 13:01:43 PST
Comment on attachment 586568 [details] [diff] [review]
fix tearoffs

This looks good!
Comment 6 Bill McCloskey (:billm) 2012-02-08 13:04:24 PST
Created attachment 595499 [details] [diff] [review]
fix the DOM prototype cache

Another weak pointer that I just saw.
Comment 8 Ed Morley [:emorley] 2012-02-10 19:56:40 PST
From philor:
Backed out in https://hg.mozilla.org/integration/mozilla-inbound/rev/71f5bf4df2f6 - one of the six in that push was crashing in js::gc::Mark<JSString>
Comment 10 Bill McCloskey (:billm) 2012-02-13 09:34:53 PST
https://hg.mozilla.org/mozilla-central/rev/8246358d235f
Comment 11 Daniel Veditz [:dveditz] 2012-03-16 18:52:25 PDT
Is this something we ought to take on Firefox 12 or ESR?
Comment 12 Bill McCloskey (:billm) 2012-03-23 11:27:29 PDT
(In reply to Daniel Veditz [:dveditz] from comment #11)
> Is this something we ought to take on Firefox 12 or ESR?

We now know that there are a lot more bugs like this. As far as we know, they'll only lead to a NULL pointer crash. However, we've never connected one of these bugs to an actual crash, so it's all pretty theoretical. I don't think there's much reason to take this on branches.
Comment 13 Daniel Veditz [:dveditz] 2012-03-29 16:07:35 PDT
lowering the severity based on comment 12.

Note You need to log in before you can comment on or make changes to this bug.