Ion-inline WeakMapGetObject skips MarkSymbolForWeakMapReadBarrier
Categories
(Core :: JavaScript Engine: JIT, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox150 | + | fixed |
| firefox151 | + | fixed |
| firefox152 | + | fixed |
People
(Reporter: jandem, Assigned: iain)
References
(Blocks 1 open bug, Regression)
Details
(6 keywords, Whiteboard: [pp1][adv-main150.0.2+r])
Attachments
(4 external files)
In bug 2029295 we added a MarkSymbolForWeakMapReadBarrier call for values returned by WeakMap.prototype.get, but the same issue also affects the Ion code for Weakmap.prototype.get(object):
// More reliable with --no-threads.
// Object key, Symbol value. Ion-inline WeakMapGetObject skips MarkSymbolForWeakMapReadBarrier.
// After GC, the value Symbol is gray in the zone atom bitmap.
// Pass the Ion-returned Symbol to a native (Object.is) to trigger cx->check -> checkAtom crash.
function f(k) {
return wm.get(k);
}
with ({}) {} // Don't Ion-compile.
let key = {};
let val = Symbol();
let wm = new WeakMap();
wm.set(key, val);
grayRoot()[0] = key;
key = val = undefined;
gc();
let r = grayRoot()[0];
for (let i = 0; i < 2000; i++) { // warm into Ion
f({});
}
let sym = f(r); // Ion path: returns gray Symbol
Object.is(sym, sym); // native call → cx->check(args[0])
[3587998] Hit MOZ_CRASH(*** Atom is marked gray for zone 7404d880c000 at argument 0) at js/src/vm/JSContext-inl.h:111
Claude flagged this difference between the C++ code and the JIT code in an audit looking for these types of issues.
| Reporter | ||
Updated•6 months ago
|
| Assignee | ||
Comment 1•6 months ago
|
||
I left a comment in ExposeGCThingToActiveJS, but didn't consider that valueReadBarrier could have code added to it. There's a comment there now.
We have to pass in the Zone because we can't read it off a symbol that lives in the atom zone.
Updated•6 months ago
|
Comment 2•6 months ago
|
||
:iain, since this bug is a regression, could you fill (if possible) the regressed_by field?
For more information, please visit BugBot documentation.
Comment 3•6 months ago
|
||
This bug has been marked as a regression. Setting status flag for Nightly to affected.
Updated•6 months ago
|
Updated•6 months ago
|
| Assignee | ||
Updated•6 months ago
|
| Assignee | ||
Comment 4•6 months ago
|
||
| Assignee | ||
Comment 5•6 months ago
|
||
Comment on attachment 9573640 [details]
(secure)
Security Approval Request
- How easily could an exploit be constructed based on the patch?: Similar difficulty to bug 2029295, where we said "very difficult".
- Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: Yes
- Which branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: Beta + release. Yes.
- If not all supported branches, which bug introduced the flaw?: Bug 2000328
- Do you have backports for the affected branches?: No
- If not, how different, hard to create, and risky will they be?: The patch should apply cleanly.
- How likely is this patch to cause regressions; how much testing does it need?: Unlikely (for the same reasons as bug 2029295)
- Is the patch ready to land after security approval is given?: Yes
- Is Android affected?: Yes
Updated•6 months ago
|
Comment 6•6 months ago
|
||
Comment on attachment 9573640 [details]
(secure)
sec-approval+ to land now and request uplifts.
| Assignee | ||
Comment 7•6 months ago
|
||
I left a comment in ExposeGCThingToActiveJS, but didn't consider that valueReadBarrier could have code added to it. There's a comment there now.
We have to pass in the Zone because we can't read it off a symbol that lives in the atom zone.
Original Revision: https://phabricator.services.mozilla.com/D296441
Updated•6 months ago
|
Comment 8•6 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Possible crash / security vulnerability.
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: yes
- Steps to reproduce for manual QE testing: None
- Risk associated with taking this patch: low
- Explanation of risk level: This is a simple fix.
- String changes made/needed?: None
- Is Android affected?: yes
Comment 9•6 months ago
|
||
firefox-release Uplift Approval Request
- User impact if declined/Reason for urgency: Possible crash / security vulnerability.
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: yes
- Steps to reproduce for manual QE testing: None
- Risk associated with taking this patch: low
- Explanation of risk level: This is a simple fix.
- String changes made/needed?: None
- Is Android affected?: yes
| Assignee | ||
Comment 10•6 months ago
|
||
I left a comment in ExposeGCThingToActiveJS, but didn't consider that valueReadBarrier could have code added to it. There's a comment there now.
We have to pass in the Zone because we can't read it off a symbol that lives in the atom zone.
Original Revision: https://phabricator.services.mozilla.com/D296441
Updated•6 months ago
|
Comment 11•6 months ago
|
||
Comment 12•6 months ago
|
||
Comment 13•6 months ago
|
||
We noticed that the "qe-verify+" label was added on this bug. Can this issue be verified manually? If so, could you please provide specific steps for manual verification?
Updated•6 months ago
|
Updated•6 months ago
|
Comment 14•6 months ago
|
||
| uplift | ||
| Assignee | ||
Comment 15•6 months ago
|
||
(In reply to Brindusa Tot, DTE from comment #13)
We noticed that the "qe-verify+" label was added on this bug. Can this issue be verified manually? If so, could you please provide specific steps for manual verification?
Sorry, that was a misclick. Unsetting it.
Comment 16•6 months ago
|
||
:iain should we wait to uplift bug 2036256 as well?
| Assignee | ||
Comment 18•6 months ago
|
||
I've queued bug 2036256 for landing. My beta uplift request failed because this patch hasn't been uplifted yet. It should apply cleanly on top of this patch. Please include that patch when you uplift this one. I filled in the uplift request form manually on Bugzilla.
Comment 19•6 months ago
•
|
||
:iain it shouldnt have failed for beta because this patch is already in beta. For release, i can apply it once i land this, but i worry that the beta one itself needs a rebased patch for bug 2036256.
| Assignee | ||
Comment 20•6 months ago
|
||
Hmm. That surprises me. The patch is very local, and nothing else should have touched this code. Please let me know if anything goes wrong with the uplift.
Updated•6 months ago
|
Updated•6 months ago
|
Comment 21•6 months ago
|
||
| 150.0.2 uplift | ||
Updated•6 months ago
|
Updated•6 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Comment 22•2 months ago
|
||
Comment 23•2 months ago
|
||
| bugherder | ||
Description
•