Aborting GC during marking can leave gray marking state invalid
Categories
(Core :: JavaScript: GC, defect, P3)
Tracking
()
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug)
Details
(Keywords: csectype-uaf, sec-moderate, Whiteboard: [adv-main146+r])
Attachments
(1 external file, 1 obsolete file)
While working on bug 1994871 I realised that there's a problem with gray unmarking where aborting an incremental GC can leave things in a bad state.
Gray unmarking stops when it comes to a zone that is currently being incrementally marked and hands the work over to the GC marking (which is doing something very similar but can do it incrementally and in hopefully in parallel too). When GC marking traverses something gray in a zone that isn't being marked it will perform gray unmarking on it. So gray unmarking can flow through zones that are being collected and out again.
This breaks down if we abort incremental GC while it's marking. This can leave us with black to gray edges, violating our promise to the cycle collector. This can possibly lead to use after free if the CC can be persuaded to free the gray thing that should have been marked black.
| Assignee | ||
Comment 1•1 year ago
|
||
We depend on GC marking to propagate gray umarking through zones that are being
marked incrementally. Aborting this raises the possibility of creating black to
gray edges as previously happened with this testcase.
Marking the gray bits as invalid will cause the CC to perform another GC to
redo the marking. Aborting GC is pretty rare in practice so I don't expect this
to have a performance impact.
| Assignee | ||
Comment 2•1 year ago
|
||
I don't know how one would craft an exploit based on this and aborting GC is pretty rare in practice so I'm going to mark this sec-moderate for now.
Comment 3•1 year ago
|
||
Yes, that seems reasonable. I'll mark this as a "use-after-free" but really it is more of a "use-after-unlink", which is usually less bad but maybe it could be bad in some weird circumstance depending on the unlink method.
Updated•1 year ago
|
Comment 6•1 year ago
|
||
PROCESS-CRASH | 649f64b7-b91c-342e-36d6-5f5fce254c15 | MOZ_CRASH(JS::UnmarkGrayGCThingRecursively(thing)) [@ js::gc::ExposeGCThingToActiveJS] | js/src/tests/non262/extensions/regress-363988.js
| Assignee | ||
Updated•1 year ago
|
Comment 8•1 year ago
|
||
Updated•1 year ago
|
Comment 9•1 year ago
|
||
The patch landed in nightly and beta is affected.
:jonco, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval. Also, don't forget to request an uplift for the patches in the regression caused by this fix.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox145towontfix.
For more information, please visit BugBot documentation.
Comment 10•1 year ago
|
||
Doesn't seem like something we need to uplift at the last second for 145 given comment 2, but probably still worth an ESR140 uplift next cycle.
Updated•1 year ago
|
| Assignee | ||
Comment 11•11 months ago
|
||
Comment on attachment 9523270 [details]
(secure)
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: This is a sec-moderate security vulnerability
- User impact if declined: Potential crash or security vulnerability
- Fix Landed on Version: 146
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): The change is very simple (mark gray marking state as invalid in one place). The change is covered by tests (the bulk of the patch). This has been on central for a while.
Comment 12•11 months ago
|
||
Comment on attachment 9523270 [details]
(secure)
The request flag was missing on the attachment
Comment 13•11 months ago
|
||
:jonco there are conflicts with ESR140. Could you please rebase?
https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift#Manual_Cherry-Pick_(Recommended_if_Conflicts_Are_Likely)
| Assignee | ||
Comment 14•11 months ago
|
||
We depend on GC marking to propagate gray umarking through zones that are being
marked incrementally. Aborting this raises the possibility of creating black to
gray edges as previously happened with this testcase.
Marking the gray bits as invalid will cause the CC to perform another GC to
redo the marking. Aborting GC is pretty rare in practice so I don't expect this
to have a performance impact.
Updated•11 months ago
|
| Assignee | ||
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Comment 15•11 months ago
|
||
| uplift | ||
Updated•11 months ago
|
| Assignee | ||
Comment 16•11 months ago
|
||
(In reply to Pulsebot from comment #15)
The uplift has caused some assertion failures on esr140. There have been several changes in this area recently and I'm not sure what the dependency is here. Since this is only sec-moderate on balance I'd rather leave this to ride the trains.
Comment 17•11 months ago
|
||
| uplift | ||
Comment 18•11 months ago
|
||
Backed out from ESR140 for causing Bug 2003035, see Comment 16.
Updated•11 months ago
|
Updated•11 months ago
|
Updated•6 months ago
|
Updated•5 months ago
|
Description
•