OOM during delazification can clobber TI groups
Categories
(Core :: JavaScript Engine: JIT, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
Details
Attachments
(1 file)
The code in [1] is fired when the parent of a script is first compiled. If we OOM during this, the delazification is unwound but the group remains initialized. This is a design issue and triggers asserts. Unclear if this is a real security issue in practice..
Assignee | ||
Comment 1•5 years ago
•
|
||
oomTest(() => { eval(`
function getCallee() { return getCallee.caller; }
// Use trickery to get a reference to a run-once function. We avoid
// expanding the lazy inner functions in this first invocation.
let fn = function(x) {
if (x) {
// Singletons inside lazy
let _ = function() {
function x00() {}
function x01() {}
function x02() {}
function x03() {}
function x04() {}
function x05() {}
function x06() {}
function x07() {}
function x08() {}
function x09() {}
}();
}
return getCallee();
}(false);
// Run fn but expand inner-lazy this time. Run in a loop to expand
for (var i = 0; i < 2; i += 1) {
try { fn(true); }
catch (e) { }
}
`)});
This triggers the following debug assert:
Assertion failure: !obj->isSingleton(), at /home/tcampbell/projects/gecko.dev/js/src/vm/ObjectGroup-inl.h:108
Assignee | ||
Comment 2•5 years ago
|
||
The function objects never escape to script if their parent failed to delazify. As a result I think this issue is benign. I'll add a check for an existing (non-default) function group to setTypeForScriptedFunction
.
Assignee | ||
Comment 3•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
These functions with clobbered groups cannot escape to script before the outer delazification completes successfully. The result is that know meaningful info can be lost, so this is just a debug-assert. The patch still makes sense to apply because otherwise this is a big footgun.
Updated•5 years ago
|
Comment 6•5 years ago
|
||
bugherder |
Description
•