Closed Bug 2036256 Opened 6 months ago Closed 6 months ago

Assertion failure: zone->needsMarkingBarrier(), at checkouts/gecko/js/src/gc/Marking.cpp:951

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox150 + fixed
firefox151 + fixed
firefox152 + fixed

People

(Reporter: tsmith, Assigned: iain)

References

(Blocks 2 open bugs, Regression, )

Details

(5 keywords, Whiteboard: [adv-main150.0.2+r])

Attachments

(2 external files)

Found with m-c 20260430-3d6e8c604cf2 (--enable-debug)

This was found by visiting a live website with a debug build. Marking as s-s as a precaution until reviewed.

STR:

  • Launch browser and visit site

This issue was triggered by visiting http://www.icloud.com/keynote/0hmu8sUZRot_9XJACva_hdnKA#DocGroup%5FLabeling%5Fin%5FQuantum%5FDOM.

Assertion failure: zone->needsMarkingBarrier(), at checkouts/gecko/js/src/gc/Marking.cpp:951

0|0|xul.dll|js::gc::PerformIncrementalReadBarrier(js::gc::TenuredCell*)|git:github.com/mozilla-firefox/firefox:js/src/gc/Marking.cpp:fcf41d17dfad8cf127eaccab48a783899ee01d4c|951|0x199
0|1|xul.dll|js::jit::WeakMapValueReadBarrier(js::gc::TenuredCell*, JS::Zone*)|git:github.com/mozilla-firefox/firefox:js/src/jit/VMFunctions.cpp:fcf41d17dfad8cf127eaccab48a783899ee01d4c|3460|0x80
0|2|||||
0|3|xul.dll|js::CheckContextLocal::check() const|git:github.com/mozilla-firefox/firefox:js/src/threading/ProtectedData.cpp:fcf41d17dfad8cf127eaccab48a783899ee01d4c|51|0x67
0|4|||||
0|5|xul.dll|js::jit::AssertPropertyLookup(js::NativeObject*, JS::PropertyKey, unsigned int)|git:github.com/mozilla-firefox/firefox:js/src/jit/VMFunctions.cpp:fcf41d17dfad8cf127eaccab48a783899ee01d4c|3446|0x8b

Test case:

// Assertion failure: zone->needsMarkingBarrier(), at gc/Marking.cpp:951
//
// visitWeakMapGetObject in Ion hardcodes the compilation zone as an immediate
// for the WeakMapValueReadBarrier call. If the stored value is a Symbol (atoms
// zone) and a zone-specific incremental GC runs, the compilation zone needs a
// marking barrier but the symbol's zone (atoms zone) does not, causing the
// assertion in PerformIncrementalReadBarrier to fire.
//
// Run: js --fast-warmup --no-threads test.js
let wm = new WeakMap();
let key = {};
wm.set(key, Symbol());
function get() {
  return wm.get(key);
}
function main() {
  get();
  schedulezone(key);
  startgc(1);
  while (gcstate() !== "NotActive") {
    get();
    gcslice(100);
  }
}
main();
Keywords: regression
Regressed by: 2034837
Attached file (secure) —
Assignee: nobody → iireland
Status: NEW → ASSIGNED
Flags: needinfo?(iireland)

I'm not sure how bad the bug is, so I'm putting the test in a separate patch just in case.

A Pernosco session is available here: https://pernos.co/debug/NAe03TX5fadL_mTTRZREVw/index.html

Sorry it was delayed coming in, but since I already had the session I might as well attach it.

Keywords: pernosco

Is this a security issue, Jon? It sounds like we're doing a read barrier on something that doesn't need one? Thanks.

Flags: needinfo?(jcoppeard)

(In reply to Andrew McCreight [:mccr8] from comment #6)
The problem is we can miss the read barrier in a zone GC because the code currently checks the wrong zone. This means we can leave a symbol or marked gray incorrectly, creating a black to gray edge.

Flags: needinfo?(jcoppeard)

Thanks. I think I've been calling black to gray edges sec-moderate. They can lead to a "use after unlink" which could result in a use after free if an unlink method is doing something weird.

Blocks: sm-security
Severity: -- → S3
Priority: -- → P1

Comment on attachment 9575910 [details]
(secure)

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Potential for creating a black->gray edge
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Simple local fix. Clearly more correct than existing code.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9575910 - Flags: approval-mozilla-beta?
Group: javascript-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch

Comment on attachment 9575910 [details]
(secure)

Approved for 150.0.2 dot release and 151.0b7

Attachment #9575910 - Flags: approval-mozilla-release+
Attachment #9575910 - Flags: approval-mozilla-beta?
Attachment #9575910 - Flags: approval-mozilla-beta+
QA Whiteboard: [sec] [uplift] [qa-triage-done-c152/b151]
Whiteboard: [adv-main150.0.2+r]
Group: core-security-release
Attachment #9575911 - Attachment description: (secure) → Bug 2036256: Add test r=jonco

Reverted this because it was causing sm bustages in bug2036256.js

Flags: needinfo?(iireland)
Flags: needinfo?(iireland)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: