Assertion failure: dest.isDouble(), at jit/arm/MacroAssembler-arm.cpp:195
A JavaScript engine assertion failure occurs when calling Math.fround on a function that captures a variable, leading to a crash in the ARM simulator. An attacker could potentially cause a denial of service by triggering this assertion.
Originally disclosed on Mozilla
- Fixed in 3 days
- Paid in 11 days
- Disclosed after 3 days
Created attachment 9372654
debug shell stack
'''
function f(x) {
Math.fround(function () {
x;
});
}
for (let j = 0; j < 29; j++) {
f(Math.fround(1));
}
'''
'''
Assertion failure: dest.isDouble(), at /home/gen32gx500/trees/mozilla-central/js/src/jit/arm/MacroAssembler-arm.cpp:195
#01: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x2731ee3]
#02: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x274e9ad]
#03: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x26fbd29]
#04: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x290a2fe]
#05: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x296abb1]
#06: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x29b42c2]
#07: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x29b56d5]
#08: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x29b62de]
#09: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x29b6c47]
#10: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x2763d65]
#11: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x2760d57]
#12: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x27696ab]
#13: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x2769c70]
#14: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x25d2b87]
#15: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1a5b0d6]
#16: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1a55073]
#17: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1a54b9f]
#18: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1a57e1c]
#19: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1a5828a]
#20: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1bdecb8]
#21: JS_ExecuteScript(JSContext*, JS::Handle<JSScript*>)[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1bdee98]
#22: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1994677]
#23: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1993767]
#24: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x1953758]
#25: ???[/home/gen32gx500/shell-cache/js-dbg-32-armsim32-linux-x86_64-734e2e027196/js-dbg-32-armsim32-linux-x86_64-734e2e027196 +0x194d636]
Segmentation fault
'''
'''
The first bad revision is:
changeset: https://hg.mozilla.org/mozilla-central/rev/ee6468bab0dd
user: Jan de Mooij
date: Wed Apr 05 11:37:15 2023 +0000
summary: Bug 1826078 part 4 - Optimize GC barriers for stores to MNewCallObject. r=iain
'''
Run with `--fuzzing-safe --no-threads --fast-warmup`, compile with `PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig 'CC="clang -msse2 -mfpmath=sse"' 'CXX="clang++ -msse2 -mfpmath=sse"' AR=ar sh ../configure --host=x86_64-pc-linux-gnu --target=i686-pc-linux --enable-simulator=arm --enable-debug --enable-debug-symbols --with-ccache --enable-gczeal --enable-rust-simd --disable-tests`, tested on m-c rev 734e2e027196.
Jan/Iain, is bug 1826078 a likely regressor? Setting s-s just in case.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a regression from a change that optimized garbage collection barriers for object creation, causing an incorrect assumption about value types in the ARM JIT compiler.
Impact
The crash could lead to a denial of service, but only in debug builds or specific configurations; the report does not claim remote code execution.
What the attacker needed
Debug build with ARM simulator; ability to run JavaScript code
How it was found
- Run the JavaScript shell with the provided flags.
- Execute the JavaScript code that defines a function f and calls it in a loop with Math.fround(1).
- Observe the assertion failure and segmentation fault.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This report shows a bug in a JavaScript engine where a specific piece of code makes the engine crash. The crash happens because the engine's internal check fails when it tries to handle a number conversion in a certain way. An attacker could use this to make the browser or server crash, but it doesn't let them run their own code.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.