[JSC] IPInt slow path for `memory.atomic.notify` truncates the Memory64 pointer and offset to 32 bits
Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp
JSTests/wasm/stress/memory64-atomic-notify-out-of-bounds.js
For instructions that cannot be handled inline by IPInt's assembly fast path, IPInt falls back to C++ "slow path" functions. Arguments are passed through an IPIntStackEntry union with both .i32 and .i64 members sharing the same storage — reading the wrong member silently drops the upper bits without any runtime error. Memory64 extends linear memory addressing to 64 bits.
This commit fixes the IPInt C++ slow path for memory.atomic.notify, which read the 64-bit address operand and immediate offset via the .i32 union member of IPIntStackEntry, silently truncating both to 32 bits. The fix changes both reads to .i64. Because the assembly fast path correctly passes full 64-bit values, the bug was invisible to Memory32 modules and only manifested when a Memory64 address had its upper 32 bits set.
Significance
Reading a 64-bit address through IPIntStackEntry's .i32 union member silently dropped the upper 32 bits; pointer 0x1_0000_0000n aliased to address 0 and memory.atomic.notify operated on linear memory's first slot instead of trapping.
Audit directions
- All other atomic and Memory64-capable slow paths in
WasmIPIntSlowPaths.cpp. The.i32-vs-.i64union mismatch is a mechanical pattern that copy-pastes badly. Auditmemory_atomic_wait32,memory_atomic_wait64, everyatomic.rmw.*,atomic.store,atomic.load, and any other Memory64-capable memory instruction slow path for the same shape. memoryIndexandcountfield types. Verify the fix's choice to leave these as.i32is correct against what the assembly fast path actually pushes — a sister mismatch in either field would produce its own truncation primitive.