Closed Bug 2000640 Opened 10 months ago Closed 8 months ago

WeakMap::Ptr may allow bypassing barriers

Categories

(Core :: JavaScript: GC, task, P3)

task

Tracking

()

RESOLVED FIXED
148 Branch
Tracking Status
firefox148 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I don't think this happens anywhere but right now you can lookup a key in a WeakMap to get a Ptr and this gives you mutable access to the underlying hash table entry. This potentially allows code to bypass the barrier that maintains information about which keys and values are in the nursery.

We should restrict this API to make this impossible.

Blocks: GC.easeofuse
Severity: -- → N/A
Priority: -- → P3

Currently it's possible to modify the hash table entry and bypass the barriers
we rely on for correctness.

This patch wraps the raw Ptr/AddPtrs from the hash map in versions that only
return const references to the hash table entries.

Assignee: nobody → jcoppeard
Status: NEW → ASSIGNED
Pushed by jcoppeard@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/600e9b0e54b1 https://hg.mozilla.org/integration/autoland/rev/941aff9e24f1 Restrict mutable access to weak map hash table entries maps via use of Ptr/AddPtr r=spidermonkey-reviewers,sfink
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: