Closed Bug 1924414 Opened 1 year ago Closed 1 year ago

Assertion failure: js::gc::IsCellPointerValid(bi), at dist/include/js/Value.h:627

Categories

(Core :: JavaScript: WebAssembly, defect, P3)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox131 --- wontfix
firefox132 --- wontfix
firefox133 --- fixed

People

(Reporter: gkw, Assigned: bvisness)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, reporter-external, testcase)

Attachments

(2 files)

Attached file debug stack
function g() {
  new WebAssembly.Memory({ initial: BigInt(0), index: "i64" }).grow(BigInt(0));
  oomTest(g);
}
g();
627         MOZ_ASSERT(js::gc::IsCellPointerValid(bi));
(gdb) bt
#0  JS::Value::setBigInt (this=0x7fffffffc200, bi=0x0) at /home/yksubu/shell-cache/js-dbg-64-linux-x86_64-d0454173ade6/objdir-js/dist/include/js/Value.h:627
#1  0x0000555558756358 in JS::BigIntValue (bi=0x555555777677) at /home/yksubu/shell-cache/js-dbg-64-linux-x86_64-d0454173ade6/objdir-js/dist/include/js/Value.h:1199
#2  IndexValue (cx=cx@entry=0x7ffff6b37000, value=value@entry=0, indexType=<optimized out>) at /home/yksubu/trees/mozilla-central/js/src/wasm/WasmJS.cpp:628
#3  0x0000555558755feb in js::WasmMemoryObject::growImpl (cx=cx@entry=0x7ffff6b37000, args=...) at /home/yksubu/trees/mozilla-central/js/src/wasm/WasmJS.cpp:2254
#4  0x0000555558756548 in JS::CallNonGenericMethod<&(IsMemory(JS::Handle<JS::Value>)), &js::WasmMemoryObject::growImpl> (cx=0x7ffff6b37000, args=...) at /home/yksubu/shell-cache/js-dbg-64-linux-x86_64-d0454173ade6/objdir-js/dist/include/js/CallNonGenericMethod.h:103
#5  js::WasmMemoryObject::grow (cx=cx@entry=0x7ffff6b37000, argc=<optimized out>, vp=<optimized out>) at /home/yksubu/trees/mozilla-central/js/src/wasm/WasmJS.cpp:2261
/snip
The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/8f4fb6c25a2d
user:        Ben Visness
date:        Mon Aug 26 20:49:39 2024 +0000
summary:     Bug 1913350: Use BigInt for memory64 params/results. r=rhunt

Run with --fuzzing-safe --no-threads --no-baseline --no-ion, compile with AR=ar sh ../configure --enable-debug --enable-debug-symbols --with-ccache --enable-nspr-build --enable-ctypes --enable-gczeal --enable-rust-simd --disable-tests, tested on m-c rev d0454173ade6.

Setting s-s just in case. Ben, is bug 1913350 a likely regressor?

Flags: sec-bounty?
Flags: needinfo?(bvisness)

Set release status flags based on info from the regressing bug 1913350

Yes, bug 1913350 seems like the obvious regressor. I'll take a look.

Assignee: nobody → bvisness
Status: NEW → ASSIGNED
Flags: needinfo?(bvisness)
Blocks: wasm64
See Also: → 1922657
Group: core-security → javascript-core-security

We simply were not handling the case where BigInt::createFromUint64
returns nullptr (which it always does under OOM conditions).

Severity: -- → S3
Priority: -- → P3

This is a bug in our OOM handling. The worst case is that we create a tagged big int JS::Value which actually points to nullptr instead of a valid JS::BigInt value. The size of a JS::BigInt is 16 bytes [1], so any access to this value will always be well within the null page for a guaranteed crash.

[1] https://searchfox.org/mozilla-central/rev/d56687458d4e6e8882c4b740e78413a0f0a69d59/js/src/vm/BigIntType.h#488

Group: javascript-core-security
Pushed by bvisness@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f79b56c5c761 Handle BigInt allocation failures in IndexValue. r=rhunt
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch

The patch landed in nightly and beta is affected.
:bvisness, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox132 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(bvisness)
Flags: needinfo?(bvisness)
Flags: sec-bounty? → sec-bounty-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: