Closed Bug 1360961 Opened 7 years ago Closed 7 years ago

Crash in js::GetPrototype during cross-compartment hasInstance

Categories

(Core :: JavaScript: GC, defect)

55 Branch
Unspecified
Windows 10
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox-esr45 --- unaffected
firefox-esr52 --- unaffected
firefox53 --- unaffected
firefox54 --- unaffected
firefox55 + fixed

People

(Reporter: marcia, Assigned: jonco)

References

Details

(5 keywords)

Crash Data

Attachments

(2 files)

This bug was filed from the Socorro interface and is 
report bp-6df16c20-2d29-4c39-bf18-6c9f70170430.
=============================================================

Seen while looking at nightly crash stats - crashes started using 20170427030231: http://bit.ly/2oW0ck8

Possible regression ranged based on Build ID: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=0f5ba06c4c5959030a05cb852656d854065e2226&tochange=0b77ed3f26c5335503bc16e85b8c067382e7bb1e
Group: javascript-core-security
Component: JavaScript Engine → JavaScript: GC
I see a number of crashes with this signature with GC poison values like 0x4b4b4b4f:
  bp-59d8d642-6f40-4128-9b89-dbcce0170501

All of the crashes I looked at were cross-compartment hasInstance calls.

Bug 1352430 is in the range. Maybe that's the issue?
Flags: needinfo?(jcoppeard)
(In reply to Andrew McCreight [:mccr8] from comment #1)
Thanks, that is the likely culprit.
[Tracking Requested - why for this release]: This signature is older, but there's a new spike that looks like a sec-high.
Summary: Crash in js::GetPrototype → Crash in js::GetPrototype during cross-compartment hasInstance
Tracking 55+ based on Comment 3.
Not a fix.  Add compartment asserts to JS::OrdinaryHasInstance (on the stack for  this crash) and make all compartment asserts check for callers passing in dying objects.
Assignee: nobody → jcoppeard
Flags: needinfo?(jcoppeard)
Attachment #8864191 - Flags: review?(sphink)
Keywords: leave-open
I found that plugin object wrappers are also stored in a map and so that requires barriering in the same way as the wrapper cache: a check for dying objects in nsNPObjWrapper::GetNewOrUsed and conditional removal of entries in NPObjWrapper_Finalize if they still point to the dying object.
Attachment #8864199 - Flags: review?(bzbarsky)
Comment on attachment 8864199 [details] [diff] [review]
2 - barrier-plugin-wrappers

>+      entry->mJSObj = nullptr;

I guess this is OK because we're guaranteed to either set mJSObj after this point or to remove "entry" before returning from this function?  Otherwise we'd end up never removing the entry in the finalizer...

May be worth documenting that.

r=me
Attachment #8864199 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky [:bz] (still a bit busy) (if a patch has no decent message, automatic r-) from comment #7)
Good point, I'll add a comment.
Attachment #8864191 - Flags: review?(sphink) → review+
urgh missed leave-open sorry
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Keywords: leave-open
Resolution: --- → FIXED
No longer blocks: 1361594
Target Milestone: --- → mozilla55
Group: javascript-core-security
Can anyone please look at this crash report:

https://crash-stats.mozilla.com/report/index/c914b45a-ab86-4579-b399-c5f971170601

If this will be fixed in FF 55 as per this bug, can the fix be applied to FF 53, too, so I would not wait for three months before FF 55 will become a final release version?
(In reply to User Dderss from comment #13)
> If this will be fixed in FF 55 as per this bug, can the fix be applied to FF
> 53, too, so I would not wait for three months before FF 55 will become a
> final release version?

This bug was about a particular instance of this crash signature that only affected 55. If you are seeing a similar crash in an earlier version, you should file a separate bug. However, without more information it will likely be difficult for us to fix it.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: