Assertion failure: [barrier verifier] Unmarked edge: JS Script 38d5a84660b0 'baseline-ic-stub-code' edge to JS JitCode 38d5a84672e0, at gc/Verifier.cpp:385
A debug assertion in the JavaScript engine's garbage collector barrier verifier fails when a baseline IC stub is discarded, leaving an unmarked edge. An attacker could potentially trigger a crash or memory corruption by running crafted JavaScript.
Originally disclosed on Mozilla
- Fixed in 16 days
- Paid in 21 days
- Disclosed after 16 days
Created attachment 9369526
stack
'''
let x = [[]];
for (let i = 0; i < 22; i++) {
for (let j = 0; j < 21; j++) {
(function () {
x[i] | 0;
})();
}
}
verifyprebarriers();
bailAfter(1);
schedulegc(1);
y;
'''
'''
Assertion failure: [barrier verifier] Unmarked edge: JS Script 338c74d660b0 'baseline-ic-stub-code' edge to JS JitCode 338c74d672e0, at /home/gen16gx500/trees/mozilla-central/js/src/gc/Verifier.cpp:385
#01: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x277e42e]
#02: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x26b61b2]
#03: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2682d3a]
#04: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2683299]
#05: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x26b9c40]
#06: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1d073c6]
#07: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x215014b]
#08: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x216fc3f]
#09: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x21515a9]
#10: JS_NewStringCopyUTF8Z(JSContext*, JS::ConstUTF8CharsZ)[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2317335]
#11: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2327499]
#12: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1eb8ce5]
#13: JS_ReportErrorNumberUTF8(JSContext*, JSErrorFormatString const* (*)(void*, unsigned int), void*, unsigned int, ...)[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2303ebe]
#14: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1f15505]
#15: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1cf8978]
#16: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1d08b89]
#17: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2873b5b]
#18: ??? (???:???)
Hit MOZ_CRASH() at /home/gen16gx500/trees/mozilla-central/js/src/gc/Verifier.cpp:386
#01: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x277e442]
#02: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x26b61b2]
#03: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2682d3a]
#04: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2683299]
#05: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x26b9c40]
#06: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1d073c6]
#07: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x215014b]
#08: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x216fc3f]
#09: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x21515a9]
#10: JS_NewStringCopyUTF8Z(JSContext*, JS::ConstUTF8CharsZ)[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2317335]
#11: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2327499]
#12: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1eb8ce5]
#13: JS_ReportErrorNumberUTF8(JSContext*, JSErrorFormatString const* (*)(void*, unsigned int), void*, unsigned int, ...)[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2303ebe]
#14: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1f15505]
#15: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1cf8978]
#16: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x1d08b89]
#17: ???[/home/gen16gx500/shell-cache/js-dbg-64-linux-x86_64-3fd71c45d9fc/js-dbg-64-linux-x86_64-3fd71c45d9fc +0x2873b5b]
#18: ??? (???:???)
Segmentation fault
'''
'''
The first bad revision is:
changeset: https://hg.mozilla.org/mozilla-central/rev/dd251ff86895
user: Jan de Mooij
date: Wed Dec 13 11:53:13 2023 +0000
summary: Bug 1867193 - Reset more IC state when discarding IC stubs. r=iain
'''
Run with `--fuzzing-safe --no-threads --no-ggc`, compile with `AR=ar sh ../configure --enable-debug --with-ccache --enable-nspr-build --enable-ctypes --enable-debug-symbols --enable-gczeal --enable-rust-simd --disable-tests`, tested on m-c rev 3fd71c45d9fc.
Jan, is bug 1867193 a likely regressor? Setting s-s because a previous bug 1804626 with a similar-looking message is marked sec-high.
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 resets IC state when discarding stubs, causing a missing barrier for an edge from a baseline IC stub to JIT code.
Impact
Could cause a crash or potentially memory corruption, but the report only shows a debug assertion and does not demonstrate exploitation.
What the attacker needed
Debug build of JavaScript shell; ability to run JavaScript
How it was found
- Run the JavaScript shell with the provided flags.
- Execute the JavaScript snippet that creates nested arrays and calls a function many times.
- Call verifyprebarriers(), bailAfter(1), schedulegc(1), and reference an undefined variable.
- Observe the assertion failure and crash.
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 is a bug in the JavaScript engine's garbage collector, which manages memory. The engine has a checking tool that verifies all references between objects are properly tracked; when a piece of optimised code is thrown away, a reference is left untracked, causing the checker to abort. This could let a malicious script crash the browser or possibly corrupt memory.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.