Closed Bug 1551907 Opened 5 years ago Closed 5 years ago

WeakMaps can become gray after being marked black

Categories

(Core :: JavaScript: GC, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox-esr60 --- unaffected
firefox67 --- wontfix
firefox68 + fixed
firefox69 + fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Regression)

Details

(Keywords: csectype-other, sec-moderate, Whiteboard: [post-critsmash-triage][adv-main68+])

Attachments

(1 file, 1 obsolete file)

I added some more tests for weak map marking and ran into a bug: if we mark a weak map gray after it has already been marked black, it changes colour black to gray. This should not happen. (This refers to the weak map's internal concept of its color, not that of its associated JSObject).

I don't know how it would be possible to exploit this but it makes sense to hide this just in case.

It feels like the worst that can happen here is a reference from a black object to a gray object, but I think the worst that can do is a "use after unlink", which will result null pointer dereferences, unless there are other bugs in code, so I'll mark it sec-moderate.

Keywords: sec-moderate

We shouldn't allow a weak map to become gray after it has already been marked black.

Depends on D30948

This releases all foreground finalized arenas at the end of sweeping the sweep group rather than at the end of sweeping the zone (for objects) or immediately (for everything else) as happens currently. This simplifies the code in a couple of places and I don't think it will have any noticeable effects.

Priority: -- → P1

Comment on attachment 9065353 [details]
Bug 1552118 - Don't release foreground finalized arenas until the end of sweeping the zone group r=sfink

I uploaded this patch to the wrong bug though - this is a fix for bug 1552118.

Attachment #9065353 - Attachment is obsolete: true
Attachment #9065345 - Attachment description: Bug 1551907 - Fix interaction between gray unmarking and weakmap marking r=sfink? → Bug 1551907 - Fix interaction between gray unmarking and weakmap marking r=sfink
Attachment #9065353 - Attachment description: Bug 1551907 - Don't release foreground finalized arenas until the end of sweeping the zone group r=sfink? → Bug 1552118 - Don't release foreground finalized arenas until the end of sweeping the zone group r=sfink
Attachment #9065353 - Attachment is obsolete: false

Comment on attachment 9065353 [details]
Bug 1552118 - Don't release foreground finalized arenas until the end of sweeping the zone group r=sfink

Revision D31415 was moved to bug 1552118. Setting attachment 9065353 [details] to obsolete.

Attachment #9065353 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Group: javascript-core-security → core-security-release

I'm guessing we'll want to nominate this for Beta uplift at least. Do we want this on ESR60 also?

Flags: needinfo?(jcoppeard)
Flags: in-testsuite+

Comment on attachment 9065345 [details]
Bug 1551907 - Fix interaction between gray unmarking and weakmap marking r=sfink

Beta/Release Uplift Approval Request

  • User impact if declined: Possible crash / security vulnerability.
  • 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): The change to the code is very simple and is covered by additional tests in the patch.
  • String changes made/needed:
Flags: needinfo?(jcoppeard)
Attachment #9065345 - Flags: approval-mozilla-beta?

Comment on attachment 9065345 [details]
Bug 1551907 - Fix interaction between gray unmarking and weakmap marking r=sfink

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: I don't know how easy this would be to trigger but it has the potential to be a crash / security vulnerability. The fix is simple so it would be nice to take this.
  • User impact if declined: Possible crash / security vulnerability.
  • Fix Landed on Version: 69
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This is a simple change that is covered by tests in the patch.
  • String or UUID changes made by this patch:
Attachment #9065345 - Flags: approval-mozilla-esr60?

Comment on attachment 9065345 [details]
Bug 1551907 - Fix interaction between gray unmarking and weakmap marking r=sfink

sec fix in GC, approved for 68.0b4

Attachment #9065345 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

The patch has conflicts with bug 1551275. Please provide a patch which applies cleanly.

Flags: needinfo?(jcoppeard)

(In reply to Sebastian Hengst [:aryx] (needinfo on intermittent or backout) from comment #12)
Sorry, this does require uplift of bug 1551275. I'll request.

Flags: needinfo?(jcoppeard)
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Regressions: 1558061

Comment on attachment 9065345 [details]
Bug 1551907 - Fix interaction between gray unmarking and weakmap marking r=sfink

Fixes a possibly s-s GC crash. Includes automated tests. Approved for 60.8esr.

Attachment #9065345 - Flags: approval-mozilla-esr60? → approval-mozilla-esr60+

Please provide a patch for ESR60. There are conflicts due to bug 1479388 (at least).

Flags: needinfo?(jcoppeard)

Turns out that this bug was introduced in bug 1463462 with landed in FF66 so the backport is not required.

Flags: needinfo?(jcoppeard)
Regressions: 1463462
Attachment #9065345 - Flags: approval-mozilla-esr60+
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main68+]
Group: core-security-release
Regressed by: 1463462
No longer regressions: 1463462
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: