← All issues

[19] [JSC Wasm IPInt] Widen frame-size accumulator in IPInt::finalize

Severity: High | Component: JSC Wasm IPInt | 9161e71

IPIntGenerator::finalize()m_maxFrameSizeInV128 계산에서 단위/스케일 불일치를 수정한 패치입니다. 패치 이전에는 stack-overflow probe가 실제 frame 사용량과 괴리된 값을 참조했습니다. locals가 많은 Wasm 모듈이 probe를 통과하면서도 남은 native stack을 초과할 수 있었고, worker thread에서 stack overflow가 검사되지 않고 발생하는 상황이 가능했습니다.

IPIntGenerator::finalize()에서 m_maxFrameSizeInV128을 runtime layout(LOCAL_SIZE = 16)과 일관된 방식으로 재계산하도록 수정되었습니다. 이를 통해 prologue에서 v128-slot 단위로 해석되는 값과 일치하게 됩니다.

Source/JavaScriptCore/wasm/wasmllint/IPIntGenerator.cpp

- m_maxFrameSizeInV128 = computeFrameSize(); // unit mismatch
+ m_maxFrameSizeInV128 = computeFrameSizeInV128(); // matches runtime LOCAL_SIZE

단위/스케일 오계산으로 인한 stack-overflow check bypass: prologue의 stack probe와 실제 frame 할당이 locals가 많은 모듈에서 괴리를 보였습니다.

frame-size accumulator는 IPIntLocal의 16바이트 slot에 맞게 v128 단위로 일관되게 계산됩니다. 이제 runtime prologue의 stack-check는 실제 사용량과 일치하는 값을 참조합니다.

IPInt 헤더에서 IPIntLocal은 16바이트(LOCAL_SIZE = 16)로 선언되어 있습니다. 각 local은 IPInt frame에서 v128 슬롯 하나를 차지합니다. IPIntGenerator::finalize()는 IPInt 티어의 최종 컴파일 단계로, prologue의 stack-overflow check에 사용되는 함수별 frame 크기를 계산합니다.

패치 이전에는 finalize 단계에서 m_maxFrameSizeInV128을 runtime layout과 일치하지 않는 단위로 계산했습니다. 바이트(또는 8바이트) 단위로 계산된 값이 v128 slot으로 해석되거나, 반대로 v128 단위로 계산된 값이 다른 단위로 해석되었다면, prologue probe는 실제 frame 사용량과 괴리가 발생합니다.

🔒

Detailed walkthrough of how the IPInt frame layout, the unit chosen for the stack-check arithmetic, and the worker-thread harness combine to determine whether this is a correctness regression or a memory-safety primitive.

더 확인하려면 구독해 주세요

🔒

Four reusable audit patterns covering unit-scale arithmetic in stack guards, declared-vs-runtime local-size mismatches, and the shape of regression tests that probe these bugs.

더 확인하려면 구독해 주세요