Open Bug 1901412 Opened 2 years ago Updated 2 years ago

Assertion failure: !data()->args[i].isMagic(), at /root/src/js/src/vm/ArgumentsObject.h:395

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: sm-bugs, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: regression)

Attachments

(1 file)

337 bytes, application/x-javascript
Details
Attached file bug.js —

Steps to reproduce:

Checkout commit 15778b8c32f8535624fff2af36fc669e65a9af3 and invoke the js shell as follows:

/root/js-spidermonkey-shell  --fuzzing-safe  <testcase>

Actual results:

Assertion failure: !data()->args[i].isMagic(), at /root/src/js/src/vm/ArgumentsObject.h:395
Group: firefox-core-security → core-security
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Version: Firefox 125 → Trunk
Group: core-security → javascript-core-security

Test below fails with --fast-warmup --no-threads.

The debugger creates an arguments object for the frame that has a JS_OPTIMIZED_OUT magic value for argument 0.

function f() {
    var dbg = newGlobal({newCompartment: true}).Debugger(this);
    dbg.getNewestFrame().older.eval(`arguments[0] = arguments`);
  }

class Cls {
    constructor(c) {
        for (var i = 0; i < 60; i++) {}
        f();
    }
}
new Cls(Cls);
Group: javascript-core-security
Blocks: js-debugger
Severity: -- → S4
Priority: -- → P3
The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/8246a4ba7eeb
user:        Jon Coppeard
date:        Mon Nov 13 16:03:20 2023 +0000
summary:     Bug 1864419 - Part 2: Add GCOwnedArray for arrays of GC data owned by GC things that may live in the nursery r=jandem

Jon, is bug 1864419 a likely regressor?

Flags: needinfo?(jcoppeard)
Keywords: regression
Regressed by: 1864419

Probably just the last patch to touch this code. Sounds like a debugger issue from previous comments.

Flags: needinfo?(jcoppeard)
No longer regressed by: 1864419
Blocks: 1903968

Ian, thanks for fixing Debugger fuzzbugs recently, might this one be in your ballpark as well?

Flags: needinfo?(iireland)

Taking a quick peek, the reason this is a problem at all is that we are trying to set arguments[0], which asserts that the existing value isn't magic to verify that it isn't a MagicEnvSlotValue. If we tried to return JS_OPTIMIZED_OUT from the debugger eval, it would return an object {optimizedOut: true} instead. If we weren't using the debugger, then we would be correct in optimizing it out. But we don't support trying to modify the value inside the debugger eval.

In this particular case, a release build will ignore the assertion and overwrite the value, which gets the correct behaviour.

I think this is also fairly low-value to spend time fixing right now.

Flags: needinfo?(iireland)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: