Skip to content
DoS Disclosed report Advanced CVE-2021-29981

Live range splitting can lead to conflicting assignments (was: Assertion failure: *def->output() == alloc, at jit/RegisterAllocator.cpp:257)

Gary Kwong Follow

Originally disclosed on Mozilla

  • Fixed in 43 days
  • Paid in 43 days
  • Disclosed after 43 days

Created attachment 9218516 testcase.wasm

This is testcase.wrapper, testcase.wasm is attached.

JavaScript
new WebAssembly.Instance(new WebAssembly.Module(read(scriptArgs[0], "binary")));
Process 36979 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000100977330 js-dbg-64-darwin-arm64-15253a3168d2`_OUTLINED_FUNCTION_0 [opt]
js-dbg-64-darwin-arm64-15253a3168d2`_OUTLINED_FUNCTION_0:
->  0x100977330 <+0>: str    w19, [x8]
    0x100977334 <+4>: b      0x101406e94               ; symbol stub for: abort

js-dbg-64-darwin-arm64-15253a3168d2`_OUTLINED_FUNCTION_1:
    0x100977338 <+0>: mov    w19, #0x476
    0x10097733c <+4>: mov    w2, #0x476
Target 0: (js-dbg-64-darwin-arm64-15253a3168d2) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000100977330 js-dbg-64-darwin-arm64-15253a3168d2`_OUTLINED_FUNCTION_0 [opt]
    frame #1: 0x000000010132dafc js-dbg-64-darwin-arm64-15253a3168d2`js::jit::AllocationIntegrityState::checkIntegrity(js::jit::LBlock*, js::jit::LInstruction*, unsigned int, js::jit::LAllocation) (.cold.17) at RegisterAllocator.cpp:39:19 [opt]
    frame #2: 0x000000010096d280 js-dbg-64-darwin-arm64-15253a3168d2`js::jit::AllocationIntegrityState::checkIntegrity(this=0x000000016fdf9a98, block=0x00000001060ebc28, ins=<unavailable>, vreg=7, alloc=(bits_ = 27)) at RegisterAllocator.cpp:257:9 [opt]
    frame #3: 0x000000010096bf80 js-dbg-64-darwin-arm64-15253a3168d2`js::jit::AllocationIntegrityState::check(this=0x000000016fdf9a98) at RegisterAllocator.cpp:207:14 [opt]
    frame #4: 0x00000001008ab05c js-dbg-64-darwin-arm64-15253a3168d2`js::jit::GenerateLIR(mir=0x000000016fdf9ef0) at Ion.cpp:1536:26 [opt]
    frame #5: 0x00000001009fe26c js-dbg-64-darwin-arm64-15253a3168d2`js::wasm::IonCompileFunctions(moduleEnv=0x000000016fdfda90, compilerEnv=<unavailable>, lifo=0x0000000105785820, inputs=<unavailable>, code=<unavailable>, error=<unavailable>) at WasmIonCompile.cpp:5760:23 [opt]
    frame #6: 0x00000001009e8c6c js-dbg-64-darwin-arm64-15253a3168d2`ExecuteCompileTask(task=0x0000000105785800, error=0x000000016fdfde50) at WasmGenerator.cpp:781:16 [opt]
    frame #7: 0x00000001009e9610 js-dbg-64-darwin-arm64-15253a3168d2`js::wasm::ModuleGenerator::finishFuncDefs() [inlined] js::wasm::ModuleGenerator::locallyCompileCurrentTask(this=0x000000016fdfc8d0) at WasmGenerator.cpp:842:8 [opt]
    frame #8: 0x00000001009e9608 js-dbg-64-darwin-arm64-15253a3168d2`js::wasm::ModuleGenerator::finishFuncDefs(this=0x000000016fdfc8d0) at WasmGenerator.cpp:980 [opt]
    frame #9: 0x00000001009c33b0 js-dbg-64-darwin-arm64-15253a3168d2`bool DecodeCodeSection<js::wasm::Decoder>(env=0x000000016fdfda90, d=0x000000016fdfc890, mg=0x000000016fdfc8d0) at WasmCompile.cpp:686:13 [opt]
    frame #10: 0x00000001009c304c js-dbg-64-darwin-arm64-15253a3168d2`js::wasm::CompileBuffer(args=<unavailable>, bytecode=<unavailable>, error=<unavailable>, warnings=<unavailable>, listener=<unavailable>) at WasmCompile.cpp:708:8 [opt]
    frame #11: 0x0000000100a1375c js-dbg-64-darwin-arm64-15253a3168d2`js::WasmModuleObject::construct(cx=0x0000000105743000, argc=<unavailable>, vp=<unavailable>) at WasmJS.cpp:1517:7 [opt]
    frame #12: 0x0000000100073eb0 js-dbg-64-darwin-arm64-15253a3168d2`CallJSNative(cx=0x0000000105743000, native=(js-dbg-64-darwin-arm64-15253a3168d2`js::WasmModuleObject::construct(JSContext*, unsigned int, JS::Value*) at WasmJS.cpp:1483), reason=<unavailable>, args=0x000000016fdfe198)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) at Interpreter.cpp:437:13 [opt]
    frame #13: 0x000000010007c5f4 js-dbg-64-darwin-arm64-15253a3168d2`CallJSNativeConstructor(cx=0x0000000105743000, native=(js-dbg-64-darwin-arm64-15253a3168d2`js::WasmModuleObject::construct(JSContext*, unsigned int, JS::Value*) at WasmJS.cpp:1483), args=0x000000016fdfe198)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) at Interpreter.cpp:453:8 [opt]
    frame #14: 0x00000001000748b0 js-dbg-64-darwin-arm64-15253a3168d2`InternalConstruct(cx=<unavailable>, args=0x000000016fdfe198) at Interpreter.cpp:626:14 [opt]
    frame #15: 0x00000001000745d8 js-dbg-64-darwin-arm64-15253a3168d2`js::ConstructFromStack(cx=<unavailable>, args=<unavailable>) at Interpreter.cpp:672:10 [opt] [artificial]
    frame #16: 0x000000010006b900 js-dbg-64-darwin-arm64-15253a3168d2`Interpret(cx=<unavailable>, state=0x000000016fdfe630) at Interpreter.cpp:3238:16 [opt]
    frame #17: 0x00000001000648f0 js-dbg-64-darwin-arm64-15253a3168d2`js::RunScript(cx=0x0000000105743000, state=0x000000016fdfe630) at Interpreter.cpp:406:13 [opt]
    frame #18: 0x00000001000750e4 js-dbg-64-darwin-arm64-15253a3168d2`js::ExecuteKernel(cx=0x0000000105743000, script=<unavailable>, envChainArg=JS::HandleObject @ x21, newTargetValue=<unavailable>, evalInFrame=(ptr_ = 0), result=JS::MutableHandleValue @ 0x000000016fdfe6a0) at Interpreter.cpp:776:13 [opt]
    frame #19: 0x0000000100075320 js-dbg-64-darwin-arm64-15253a3168d2`js::Execute(cx=0x0000000105743000, script=JS::HandleScript @ x21, envChain=JS::HandleObject @ x20, rval=JS::MutableHandleValue @ x19) at Interpreter.cpp:808:10 [opt]
    frame #20: 0x000000010015de94 js-dbg-64-darwin-arm64-15253a3168d2`ExecuteScript(cx=0x0000000105743000, envChain=JS::HandleObject @ 0x000000016fdfe780, script=JS::HandleScript @ 0x000000016fdfe778, rval=JS::MutableHandleValue @ x19) at CompilationAndEvaluation.cpp:491:10 [opt]
    frame #21: 0x000000010015e068 js-dbg-64-darwin-arm64-15253a3168d2`JS_ExecuteScript(cx=0x0000000105743000, scriptArg=JS::HandleScript @ x19) at CompilationAndEvaluation.cpp:515:10 [opt]
    frame #22: 0x00000001000463cc js-dbg-64-darwin-arm64-15253a3168d2`RunFile(cx=0x0000000105743000, filename=<unavailable>, file=<unavailable>, compileMethod=<unavailable>, compileOnly=false) at js.cpp:1065:10 [opt]
    frame #23: 0x0000000100045d68 js-dbg-64-darwin-arm64-15253a3168d2`Process(cx=0x0000000105743000, filename="testcase.wrapper", forceTTY=false, kind=FileScript) at js.cpp:1656:14 [opt]
    frame #24: 0x00000001000103b4 js-dbg-64-darwin-arm64-15253a3168d2`Shell(JSContext*, js::cli::OptionParser*, char**) at js.cpp:10934:10 [opt]
    frame #25: 0x0000000100010360 js-dbg-64-darwin-arm64-15253a3168d2`Shell(cx=<unavailable>, op=0x000000016fdff270, envp=<unavailable>) at js.cpp:11658 [opt]
    frame #26: 0x000000010000a908 js-dbg-64-darwin-arm64-15253a3168d2`main(argc=<unavailable>, argv=<unavailable>, envp=<unavailable>) at js.cpp:12613:12 [opt]
    frame #27: 0x000000019b1c5f34 libdyld.dylib`start + 4
The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/b3dfcb849dd2
user:        Julian Seward
date:        Wed Apr 14 07:43:27 2021 +0000
summary:     Bug 1686626 - Enable Ion by default for wasm on AArch64.  r=lth.

Run with --fuzzing-safe --no-threads --no-baseline --no-ion testcase.wrapper testcase.wasm, compile with AUTOCONF=/usr/local/Cellar/autoconf213/2.13/bin/autoconf213 AR=ar sh ./configure --enable-debug --with-ccache --enable-gczeal --enable-debug-symbols --disable-tests, tested on m-c rev 15253a3168d2.

Not sure if this is s-s, I'd leave it to Julian/Lars.

The original report as published on Mozilla's Bugzilla, by Gary Kwong. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity doS bug in JavaScript Engine: JIT. Mozilla made it public on 8 June 2021 as CVE-2021-29981.

About DoS

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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.

More by Gary Kwong

View all

42 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.