Closed Bug 1981471 Opened 1 year ago Closed 1 year ago

WeakCache<GCHashMap<>> can trigger assertions in StoreBuffer::checkAccess() when used with nursery pointers

Categories

(Core :: JavaScript: GC, defect)

defect

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(3 files)

As discovered by Jan.

Access to the store buffer during sweeping is protected by a lock and we assert that it is held. Unfortunately we are failing to take the lock sometimes.

This is because GCHashMap::traceWeakEntries doesn't match the version in GCHashSet. It should not initialise e in the for loop:

https://searchfox.org/mozilla-central/rev/169951beec18e0505611537cfdcf7f7d3a330404/js/public/GCHashTable.h#91
https://searchfox.org/mozilla-central/rev/169951beec18e0505611537cfdcf7f7d3a330404/js/public/GCHashTable.h#280

This is a problem because destroying the Enum may require taking the store
buffer lock which we don't hold at this point. That's why these methods take an
Enum, so that we can control its lifetime like this.

This brings it into line with the GCHasSet version.

This removes a bunch of duplicated code with templates.

Blocks: 1981133
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: