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

RESOLVED FIXED in Firefox 38, Firefox OS v1.4

Status

()

Core
JavaScript Engine
--
critical
RESOLVED FIXED
3 years ago
a year ago

People

(Reporter: Jesse Ruderman, Assigned: terrence)

Tracking

(Blocks: 2 bugs, {assertion, sec-high, testcase})

Trunk
mozilla40
x86_64
Mac OS X
assertion, sec-high, testcase
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(firefox37 wontfix, firefox38+ fixed, firefox39+ fixed, firefox40 fixed, firefox-esr3138+ 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)

Details

(Whiteboard: [adv-main38+][adv-esr31.7+])

Attachments

(7 attachments)

(Reporter)

Description

3 years ago
Created attachment 8589472 [details]
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
(Reporter)

Comment 1

3 years ago
Created attachment 8589473 [details]
stack
This looks like JS mostly...
Component: DOM: Workers → JavaScript Engine
Flags: needinfo?(terrence)
(Assignee)

Comment 3

3 years ago
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)
(Assignee)

Comment 4

3 years ago
Created attachment 8589948 [details] [diff] [review]
make_jsid_and_value_barriers_symetrical-v0.diff

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+
(Assignee)

Comment 6

3 years ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=36fa7dc616ee
https://hg.mozilla.org/integration/mozilla-inbound/rev/fa5dc09027fd
https://hg.mozilla.org/mozilla-central/rev/fa5dc09027fd
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox40: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Does this affect any older versions?
Flags: in-testsuite?
(Assignee)

Comment 9

3 years ago
(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.
status-firefox37: --- → affected
status-firefox38: --- → affected
status-firefox39: --- → affected
status-firefox-esr31: --- → affected
status-firefox-esr38: --- → affected
Sounds like this bug needs a sec rating and possibly a retroactive sec-approval request then too.
status-b2g-v1.4: --- → affected
status-b2g-v2.0: --- → affected
status-b2g-v2.0M: --- → affected
status-b2g-v2.1: --- → affected
status-b2g-v2.1S: --- → affected
status-b2g-v2.2: --- → affected
status-b2g-master: --- → fixed
(Assignee)

Comment 11

3 years ago
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.
status-firefox37: affected → wontfix
tracking-firefox-esr31: --- → ?
Flags: needinfo?(terrence)
BTW, this has conflicts on Aurora, so please do post a rebased patch for that (and beta if necessary).
tracking-firefox38: --- → +
tracking-firefox39: --- → +
tracking-firefox-esr31: ? → 38+
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+
(Assignee)

Comment 16

3 years ago
Created attachment 8593542 [details] [diff] [review]
backport_1152177_aurora-v0.diff

Here is a backport for Aurora.
Flags: needinfo?(terrence)
(Assignee)

Comment 17

3 years ago
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?
(Assignee)

Comment 19

3 years ago
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.
status-firefox38: affected → fixed
status-firefox39: affected → fixed
status-firefox-esr38: affected → fixed
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2/rev/239e61f3b0db
status-b2g-v2.2: affected → fixed
(Assignee)

Comment 22

3 years ago
Created attachment 8595540 [details] [diff] [review]
backport_1152177_b2g34.diff

Here is a backport for b2g34.
https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/685fa69b59dc
https://hg.mozilla.org/releases/mozilla-b2g34_v2_1s/rev/685fa69b59dc
status-b2g-v2.1: affected → fixed
status-b2g-v2.1S: affected → fixed
Still needs backporting to b2g32/esr31/b2g30.
Flags: needinfo?(terrence)
(Assignee)

Comment 25

3 years ago
Created attachment 8598136 [details] [diff] [review]
backport_1152177-b2g32-v0.diff

Finally got this working on on b2g32; sorry for the delay.
Flags: needinfo?(terrence)
Depressingly, esr31 is all different yet again :(
Flags: needinfo?(terrence)
(Assignee)

Comment 27

3 years ago
Created attachment 8598320 [details] [diff] [review]
backport_1152177_esr31.diff

Here you go.
Flags: needinfo?(terrence)
https://hg.mozilla.org/releases/mozilla-b2g32_v2_0/rev/9a0629dbe008
https://hg.mozilla.org/releases/mozilla-b2g32_v2_0m/rev/9a0629dbe008
https://hg.mozilla.org/releases/mozilla-b2g30_v1_4/rev/eeda70f179d1
https://hg.mozilla.org/releases/mozilla-esr31/rev/068fedc4a117
status-b2g-v1.4: affected → fixed
status-b2g-v2.0: affected → fixed
status-b2g-v2.0M: affected → fixed
status-firefox-esr31: affected → fixed
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.
status-firefox-esr31: fixed → verified
status-firefox-esr38: fixed → verified
(Reporter)

Updated

2 years ago
Blocks: 1183926

Updated

2 years ago
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.