[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
IPInt의 assembly fast path에서 inline으로 처리할 수 없는 instruction은 C++ "slow path" 함수로 폴백됩니다. 인자는 .i32와 .i64 멤버가 같은 storage를 공유하는 IPIntStackEntry union을 통해 전달되며, 잘못된 멤버를 읽으면 상위 비트가 아무런 오류 없이 누락됩니다. Memory64는 linear memory 주소 지정을 64비트로 확장합니다.
이 commit은 memory.atomic.notify의 IPInt C++ slow path를 수정했습니다. 기존 코드는 64비트 주소 피연산자와 immediate offset을 IPIntStackEntry의 .i32 union 멤버를 통해 읽었기 때문에, 두 값 모두 오류 없이 32비트로 truncate되었습니다. 수정 후에는 두 읽기 모두 .i64로 변경되었습니다. assembly fast path는 64비트 값을 정상적으로 전달했기 때문에, 이 버그는 Memory32 모듈에서는 드러나지 않았습니다. Memory64 주소의 상위 32비트가 설정된 경우에만 발현되었습니다.
Significance
IPIntStackEntry의 .i32 union 멤버를 통해 64비트 주소를 읽으면 상위 32비트가 아무런 오류 없이 삭제되었습니다. pointer 0x1_0000_0000n은 주소 0에 대응되어, memory.atomic.notify가 trap하는 대신 linear memory의 첫 번째 슬롯에서 동작했습니다.
Audit directions
WasmIPIntSlowPaths.cpp의 다른 atomic 및 Memory64 지원 slow path..i32와.i64union mismatch는 copy-paste 오류가 발생하기 쉬운 기계적인 패턴입니다.memory_atomic_wait32,memory_atomic_wait64, 모든atomic.rmw.*,atomic.store,atomic.load, 그 외 Memory64 지원 memory instruction slow path에서 동일한 패턴을 점검해야 합니다.memoryIndex와count필드 타입. 이번 수정에서 두 필드를.i32로 유지한 선택이 assembly fast path의 실제 push 값과 일치하는지 확인해야 합니다. 두 필드 중 하나라도 mismatch가 있다면 독자적인 truncation primitive로 이어질 가능성이 있습니다.