Closed Bug 1152177 Opened 5 years ago Closed 5 years ago

"Assertion failure: js::CurrentThreadCanAccessRuntime(runtime_)" with watch() in Worker

Categories

(Core :: JavaScript Engine, defect, critical)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox37 --- wontfix
firefox38 + fixed
firefox39 + fixed
firefox40 --- fixed
firefox-esr31 38+ verified
firefox-esr38 --- verified
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed
b2g-v2.0M --- fixed
b2g-v2.1 --- fixed
b2g-v2.1S --- fixed
b2g-v2.2 --- fixed
b2g-master --- fixed

People

(Reporter: jruderman, Assigned: terrence)

References

(Blocks 2 open bugs)

Details

(Keywords: assertion, sec-high, testcase, Whiteboard: [adv-main38+][adv-esr31.7+])

Attachments

(7 files)

Attached file testcase
1. Create a profile with:
     e10 disabled
     https://www.squarefree.com/extensions/domFuzzLite3.xpi installed
2. Run: firefox -profile <profiledir> o.html

Assertion failure: js::CurrentThreadCanAccessRuntime(runtime_), at ../../dist/include/js/HeapAPI.h:127
Attached file stack
This looks like JS mostly...
Component: DOM: Workers → JavaScript Engine
Flags: needinfo?(terrence)
Good find! On first glance this appears to be a missing check for permanent atoms when pre-barriering one inside a jsid. I'll take a closer look this afternoon.
Flags: needinfo?(terrence)
My guess was correct. The attached patch makes the jsid pre barrier have the same structure as the Value pre barrier. It also MOZ_CRASHES if we try to use the zone-specified barrier outside HeapSlot.
Assignee: nobody → terrence
Status: NEW → ASSIGNED
Attachment #8589948 - Flags: review?(jcoppeard)
Comment on attachment 8589948 [details] [diff] [review]
make_jsid_and_value_barriers_symetrical-v0.diff

Review of attachment 8589948 [details] [diff] [review]:
-----------------------------------------------------------------

The jsid barrier change looks good.

For the preBarrier() overload that takes a zone, can we just not define it except in InternalGCMethods<Value>?
Attachment #8589948 - Flags: review?(jcoppeard) → review+
https://hg.mozilla.org/mozilla-central/rev/fa5dc09027fd
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Does this affect any older versions?
Flags: in-testsuite?
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #8)
> Does this affect any older versions?

Right, this needs to get uplifted basically everywhere.
Sounds like this bug needs a sec rating and possibly a retroactive sec-approval request then too.
Comment on attachment 8589948 [details] [diff] [review]
make_jsid_and_value_barriers_symetrical-v0.diff

[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 at all.

Which older supported branches are affected by this flaw?
All of them.

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?
Should be simple to backport.

How likely is this patch to cause regressions; how much testing does it need?
Unlikely to cause regressions.
Attachment #8589948 - Flags: sec-approval?
This sounds kind of bad but hard to exploit so I'm going to set it to sec-high.
Keywords: sec-high
Please nominate this for Aurora/Beta/esr31 approval when you get a chance.
Flags: needinfo?(terrence)
BTW, this has conflicts on Aurora, so please do post a rebased patch for that (and beta if necessary).
Comment on attachment 8589948 [details] [diff] [review]
make_jsid_and_value_barriers_symetrical-v0.diff

sec-approval=dveditz
Attachment #8589948 - Flags: sec-approval? → sec-approval+
Here is a backport for Aurora.
Flags: needinfo?(terrence)
Comment on attachment 8593542 [details] [diff] [review]
backport_1152177_aurora-v0.diff

[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 at all.

Which older supported branches are affected by this flaw?
Everything with permanent atoms and incremental gc, which is all of them at this point.

If not all supported branches, which bug introduced the flaw?
n/a

Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Shouldn't be particularly hard to backport.

How likely is this patch to cause regressions; how much testing does it need?
Has been on m-i for a week; risk is pretty low.
Attachment #8593542 - Flags: sec-approval?
Comment on attachment 8593542 [details] [diff] [review]
backport_1152177_aurora-v0.diff

Review of attachment 8593542 [details] [diff] [review]:
-----------------------------------------------------------------

This is just a backport of the other patch, right?  You don't need a separate sec-approval for it, as the assumption is any adversary could see the m-c checkin.  Just flag it for approval-mozilla-aurora.
Attachment #8593542 - Flags: sec-approval?
Comment on attachment 8593542 [details] [diff] [review]
backport_1152177_aurora-v0.diff

NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): ancient
User impact if declined: occasional, rare crashes
Testing completed: 1 week on m-i
Risk to taking this patch (and alternatives if risky): low 
String or UUID changes made by this patch: none
Attachment #8593542 - Flags: approval-mozilla-esr31?
Attachment #8593542 - Flags: approval-mozilla-beta?
Attachment #8593542 - Flags: approval-mozilla-b2g37?
Attachment #8593542 - Flags: approval-mozilla-b2g34?
Attachment #8593542 - Flags: approval-mozilla-b2g32?
Attachment #8593542 - Flags: approval-mozilla-b2g30?
Attachment #8593542 - Flags: approval-mozilla-aurora?
Attachment #8593542 - Flags: approval-mozilla-b2g37?
Attachment #8593542 - Flags: approval-mozilla-b2g34?
Attachment #8593542 - Flags: approval-mozilla-b2g32?
Attachment #8593542 - Flags: approval-mozilla-b2g30?
Attachment #8593542 - Flags: approval-mozilla-esr31?
Attachment #8593542 - Flags: approval-mozilla-esr31+
Attachment #8593542 - Flags: approval-mozilla-beta?
Attachment #8593542 - Flags: approval-mozilla-beta+
Attachment #8593542 - Flags: approval-mozilla-aurora?
Attachment #8593542 - Flags: approval-mozilla-aurora+
https://hg.mozilla.org/releases/mozilla-aurora/rev/0100f5c33e38
https://hg.mozilla.org/releases/mozilla-beta/rev/d79194507f32

The attached patch applies fine to b2g37 as well. Has conflicts from 34 down, though, which Terrence is currently rebasing through.
Here is a backport for b2g34.
Still needs backporting to b2g32/esr31/b2g30.
Flags: needinfo?(terrence)
Finally got this working on on b2g32; sorry for the delay.
Flags: needinfo?(terrence)
Depressingly, esr31 is all different yet again :(
Flags: needinfo?(terrence)
Here you go.
Flags: needinfo?(terrence)
Whiteboard: [adv-main38+][adv-esr31.7+]
Reproduced the initial issue on Asan build from 2015-04-07, verified that this issue is fixed using Firefox 31.7.0 ESR build 2 and 38.0 ESR build 1 on Ubuntu 13.10 64-bit.
Blocks: 1183926
Group: core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.