Crash [@ js::JitFrameIter::realm() const] or Crash [@ js::jit::MaybeForwardedScriptFromCalleeToken]
Categories
(Core :: JavaScript: WebAssembly, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr128 | --- | unaffected |
| firefox135 | --- | wontfix |
| firefox136 | --- | wontfix |
| firefox137 | + | fixed |
| firefox138 | + | fixed |
People
(Reporter: decoder, Assigned: jandem)
References
(Regression)
Details
(5 keywords, Whiteboard: [bugmon:update,bisect][adv-main137+r])
Crash Data
Attachments
(2 files, 2 external files)
The following testcase crashes on mozilla-central revision 20250219-ac2b765f864d (opt build, run with --fuzzing-safe --cpu-count=2 --ion-offthread-compile=off --blinterp-warmup-threshold=0 --ion-osr=off):
try { evalInWorker(`
var g38 = newGlobal({newCompartment: true});
newGlobal({newCompartment: true});
var g25 = newGlobal({newCompartment: true});
g25.eval("var o = {};");
var g38 = newGlobal({newCompartment: true});
newGlobal({newCompartment: true});
var g25 = newGlobal({newCompartment: true});
g25.eval("var o = {};");
function wasmEvalBinary(binary, imports, compileOptions) {
try {
m = new WebAssembly.Module(binary, compileOptions);
} catch(e) { }
return new WebAssembly.Instance(m, imports);
}
function wasmEvalText(str, imports, compileOptions) {
return wasmEvalBinary(wasmTextToBinary(str), imports, compileOptions);
}
var ins0 = wasmEvalText(\`(module
(func \$fac-acc (export "fac-acc") (param i64 i64) (result i64)
(if (result i64) (i64.eqz (local.get 0))
(then (local.get 1))
(else
(return_call \$fac-acc
(i64.sub (local.get 0) (i64.const 1))
(i64.mul (local.get 0) (local.get 1))
)
)
)
)
)\`);
var ins = wasmEvalText(\`(module
(import "" "fac-acc" (func \$fac-acc (param i64 i64) (result i64)))
(type \$ty (func (param i64 i64) (result i64)))
(table \$t 1 1 funcref)
(func \$f (export "fac") (param i64) (result i64)
local.get 0
i64.const 1
i32.const 0
return_call_indirect \$t (type \$ty)
)
(elem \$t (i32.const 0) \$fac-acc)
(func (export "main") (result i64)
i64.const 5
)
)\`, {"": {"fac-acc": ins0.exports["fac-acc"]}});
const fac = ins.exports["fac"];
const check = function() {
fac({} <= ("0, "));
};
for (;;)
check();
`); } catch(exc) {}
Backtrace:
received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xfffff50a60a0 (LWP 476453)]
0x0000aaaaac3865e4 in js::JitFrameIter::realm() const ()
#0 0x0000aaaaac3865e4 in js::JitFrameIter::realm() const ()
#1 0x0000aaaaacac0f54 in js::jit::HandleException(js::jit::ResumeFromException*) ()
#2 0x0000211bec07a40c in ?? ()
#3 0x00002ae0cc735970 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
x0 0xf50a4e90 281474792836752
x1 0xf50a52e8 281474792837864
x2 0x1 1
x3 0x1 1
x4 0x0 0
x5 0x0 0
x6 0x0 0
x7 0xf50a4a90 281474792835728
x8 0xfffff800 4294965248
x9 0x100 256
x10 0x503 1283
x11 0xf50a4e38 281474792836664
x12 0xf50a4e2c 281474792836652
x13 0xf50a4e10 281474792836624
x14 0xf47521f0 281474783060464
x15 0xad099000 187650024247296
x16 0xacac0dc8 187650018119112
x17 0x0 0
x18 0xabae1f05 187650001477381
x19 0xf4736100 281474782945536
x20 0xf50a5028 281474792837160
x21 0x0 -1829587348619264
x22 0xf4736120 281474782945568
x23 0xf50a4f30 281474792836912
x24 0xf4736170 281474782945648
x25 0xf50a4f48 281474792836936
x26 0xf50a5070 281474792837232
x27 0xcc732152 47144991138130
x28 0xf50a5010 281474792837136
x29 0xf50a4b80 281474792835968
x30 0xacac0f54 187650018119508
sp 0xf50a4b80 281474792835968
pc 0xaaaaac3865e4 <js::JitFrameIter::realm() const+36>
cpsr [ EL=0 C Z ]
fpcsr void
fpcr 0x0 0
=> 0xaaaaac3865e4 <_ZNK2js12JitFrameIter5realmEv+36>: ldr x8, [x8, #24]
0xaaaaac3865e8 <_ZNK2js12JitFrameIter5realmEv+40>: and w9, w8, #0x3
This only produces with --ion-osr=off and on ARM64. I reduced this from a more intermittent crash that was trying to deref a random address 0x2def75c in js::jit::MaybeForwardedScriptFromCalleeToken so I am going to mark this s-s until investigated.
| Reporter | ||
Comment 1•1 year ago
|
||
| Reporter | ||
Comment 2•1 year ago
|
||
Comment 3•1 year ago
|
||
Unable to reproduce bug 1950360 using build mozilla-central 20250219093841-ac2b765f864d. Without a baseline, bugmon is unable to analyze this bug.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.
Updated•1 year ago
|
Comment 4•1 year ago
|
||
It looks like the exit frame layout is borked in HandleException:
(rr) p *(js::jit::CommonFrameLayout*) act->jsExitFP()
$36 = {
callerFramePtr_ = 0x757fe1c7fdd0 "\"",
returnAddress_ = 0x7 <error: Cannot access memory at address 0x7>,
descriptor_ = 129192109276664
}
(rr) p/x $rsp
$37 = 0x757fe51fe100
(rr) p/x $rsp - ((js::jit::CommonFrameLayout*) act->jsExitFP()).callerFramePtr_
$38 = 0x357e330
The descriptor and return address are nonsense, and the saved frame pointer is nowhere near the current stack pointer.
Jan, can you take a look at this one? Debugging arm64 code in the simulator is a pain. It might be easier on a Mac?
Updated•1 year ago
|
Comment 5•1 year ago
|
||
The severity field for this bug is set to S3. However, the bug is flagged with the sec-high keyword.
:willyelm, could you consider increasing the severity of this security bug?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 6•1 year ago
|
||
I'll take a look.
Updated•1 year ago
|
| Assignee | ||
Comment 7•1 year ago
|
||
This is a bug in GenerateJitEntry: when we call a function that can perform a tail call, the stack pointer after the call isn't guaranteed to match the stack pointer before the call. I think that was handled by the freeStackTo that I removed in bug 1910880 but I wasn't aware of the tail call issue. I have some patches that simplify the JIT entry stub a bit to avoid this bug.
Comment 8•1 year ago
|
||
Set release status flags based on info from the regressing bug 1910880
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 9•1 year ago
|
||
| Assignee | ||
Comment 10•1 year ago
|
||
This also fixes an OOM reporting issue in AllocateBigIntTenuredNoGC because the
new test fails an assertion without it.
Updated•1 year ago
|
Comment 11•1 year ago
|
||
Set release status flags based on info from the regressing bug 1910880
| Assignee | ||
Comment 12•1 year ago
|
||
Comment on attachment 9469122 [details]
Bug 1950360 - Tidy up stack frame handling in GenerateJitEntry. r?rhunt!
Security Approval Request
- How easily could an exploit be constructed based on the patch?: Very difficult.
- Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
- Which branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: release/beta/nightly
- If not all supported branches, which bug introduced the flaw?: Bug 1910880
- Do you have backports for the affected branches?: Yes
- If not, how different, hard to create, and risky will they be?: Should apply or be easy to backport.
- How likely is this patch to cause regressions; how much testing does it need?: Unlikely.
- Is the patch ready to land after security approval is given?: Yes
- Is Android affected?: Yes
Updated•1 year ago
|
Comment 13•1 year ago
|
||
Comment on attachment 9469122 [details]
Bug 1950360 - Tidy up stack frame handling in GenerateJitEntry. r?rhunt!
Approved to land and request uplift
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Comment 14•1 year ago
|
||
Comment 15•1 year ago
|
||
Comment 16•1 year ago
|
||
We may not have a mid-cycle planned desktop dot release this cycle for Fx136.
:jandem please add a beta uplift request for Fx137 when you have a moment
| Assignee | ||
Comment 17•1 year ago
|
||
Comment on attachment 9469122 [details]
Bug 1950360 - Tidy up stack frame handling in GenerateJitEntry. r?rhunt!
Beta/Release Uplift Approval Request
- User impact if declined/Reason for urgency: Crashes or security bugs.
- 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: Medium
- Why is the change risky/not risky? (and alternatives if risky): Should be pretty low risk and code is covered by tests and fuzzers.
- String changes made/needed:
- Is Android affected?: Yes
Updated•1 year ago
|
Comment 18•1 year ago
|
||
| uplift | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 19•1 year ago
|
||
2 months ago, tjr placed a reminder on the bug using the whiteboard tag [reminder-test 2025-05-15] .
jandem, please refer to the original comment to better understand the reason for the reminder.
Comment 20•1 year ago
|
||
| Assignee | ||
Updated•1 year ago
|
Comment 21•1 year ago
|
||
Updated•1 year ago
|
Description
•