Repository navigation
feat/heap pair abi carrier - #4936
Merged
Merged
Conversation
dancinlife
commented
Jul 13, 2026
Contributor
- feat(runtime): HEAP ์ ์ฉ pair-ABI carrier 3์ข ์ ์ค + array_new ์๋ ๋ฐฐ์ (byte-neutral)
- docs(convergence): heap carrier ๋ STRONG ์ด์ด์ผ ํ๋ค โ weak ๊ฐ arena ๊ฐ๋ก์ฑ๊ธฐ๋ฅผ ํ์ฉํ๋ค
โฆ-neutral)
๋ค์ดํฐ๋ธ .s ์๋๋ hexa pair-ABI ๋ก๋ง ํธ์ถํ ์ ์๋๋ฐ, descriptor ๋ฅผ ์ก์ ์๋จ์ด
์์ ์์๋ค. self/runtime.h ๋ฅผ ์ ์ ์กฐ์ฌํ ๊ฒฐ๊ณผ heap ์ ์ฉ pair-ABI carrier ๊ฐ ๋ถ์ฌํ๊ณ ,
์ ์ผํ ๋ฒ์ฉ carrier ์ธ hexa_ptr_alloc ์ ์ด๋ฆ๊ณผ ๋ฌ๋ฆฌ ARENA ๋ค:
_hexa_ptr_alloc: # self/native/alloc_syscall_arm64.s:3148
bl _hexa_arena_alloc # โ arena bump-allocator ๋ก ์์
runtime.a ์์ ์ ์๊ฐ ๋ ์๊ณ (runtime.o ์ weak malloc vs alloc_syscall_native.o),
๋งํฌ์์ ์ด๊ธฐ๋ ์ชฝ์ด ํ์๋ค. ๊ทธ๋ฐ๋ฐ ๋ฐฐ์ด DESCRIPTOR ๋ ํ๋ ์์ ํ์ถํ๋ฏ๋ก arena ์
์์ผ๋ฉด rewind ํ ๋ค์ bump-alloc ์ ์ฌ์ฌ์ฉ๋์ด len/cap/items ๊ฐ ์กฐ์ฉํ ๋ฎ์ด์จ์ง๋ค โ
C ์๋ณธ ์ฃผ์[runtime_core_emit.hexa:2739]์ด ๋ช
์ ๊ธ์งํ๋ฉฐ, calloc ์ ๋ฐ๋ก ๊ทธ ๋ฐฉ์ด์๋ค.
hexa_heap_alloc(size) malloc
hexa_heap_zalloc(size) calloc(1,n) โ descriptor ํด๋์ค
hexa_heap_realloc(ptr,size) realloc โ typed-leaf grow ๊ฒฝ๋ก์ฉ
โ
STRONG (non-weak) ์ด ์ค๊ณ์ ํต์ฌ์ด๋ค. weak ์๊ธฐ ๋๋ฌธ์ arena ์๋๊ฐ hexa_ptr_alloc ์
์๋ฆฌ ์์ด ๊ฐ๋ก์ฑ๋ค. strong ์ด๋ฉด ์ด๋ค ๋ค์ดํฐ๋ธ ์๋๊ฐ ๊ฐ์ ์ด๋ฆ์ ์ ์ํ๋ ์๊ฐ
multiple-definition ๊ฒ์ดํธ๊ฐ ๋น๋ ์์ ์ ์๋๋ฝ๊ฒ ํฐ์ง๋ค โ ์กฐ์ฉํ ๊ต์ฒด๋ ๋ ๋ฒ ์๋ค.
ARRAY_NEW ๊ฐ๋ ๋ฐ๊นฅ์ emit ํ๋ค(์๋๊ฐ ์ผ์ ธ๋ carrier ๋ ๋จ์์ผ ํ๋ฏ๋ก). ์์ฑ๋
runtime_core.c ์์ carrier ๋ 2587-2597, ๊ฐ๋ #endif ๋ 2582 ๋ก ํ์ธ.
๊ฒ์ฆ (mini darwin, stage_resolve ํ nm):
runtime.o: T _hexa_heap_alloc / T _hexa_heap_zalloc / T _hexa_heap_realloc
weak(W/S/v) 0๊ฑด ยท ๋ค๋ฅธ ๋ฉค๋ฒ์ ์ ์ 0๊ฑด
BYTE-NEUTRAL โ array_new ์ .s ์๋๋ main ์ ์์ผ๋ฏ๋ก(#4932 revert) ARR-NEW ๋ C ๊ฒฝ๋ก๋ฅผ
์ ์งํ๋ค. ์ด PR ์ substrate + ๋ฐฐ์ ๊น์ง์ด๊ณ , flip ์ regen + byteeq ํ ๋ณ๋ ๋ผ์ด๋๋ค.
โ ๏ธ ํจ๊ป ๋ฐ์ ํ๋ FALSIFIED ๊ฒฐ๊ณผ: "build_aprime ์ index 7 out of bounds(len 2) = arena
descriptor ์ค์ผ" ์ด๋ผ๋ ๋ด ํ์ ์ ํ๋ ธ๋ค. ๋ด ๋ณ๊ฒฝ์ด ํ๋๋ ์๋ ์์ origin/main
๋์กฐ๊ตฐ์์๋ ๋์ผํ๊ฒ ์ฌํ๋๊ณ , ์ง์ง ์์ธ์ summer ์ HEXA_PREBUILT_RUNTIME ์ด 7/4 ์
๋ก์ ~/.hx runtime.a ๋ฅผ ๊ฐ๋ฆฌํจ ํ๊ฒฝ์ค์ผ์ด์๋ค(convergence stage-resolve-runtime-a-2
trap#2). arena ๋ผ๋ ์ฌ์ค์ ์ฐธ์ด์ง๋ง, ๊ทธ๊ฒ์ด ๋์ ์ฆ์์ ์ธ๊ณผ๋ ์๋์๋ค.
state/hexa-own/seed_abi_class_audit.md โ ์ํฌํ๋ก์ฐ wf_5c5b82ee-80b ์ ๋ฌธ(41 ์์ด์ ํธ ยท
์ ๋์ ๋ฐ์ฆ ํต๊ณผ 33๊ฑด). ๊ฒฐ์ ์ ์ ๊ท: typed-leaf i64/f64 ๋ raw-libc egress ๋ง๊ณ
SCALAR-ABI ingress/return ๋ฏธ์ค๋งค์น๊ฐ ๋ฐ๋ก ์์ด carrier ์นํ๋ง์ผ๋ก ์ ๊ณ ์ณ์ง๋ค.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
โฆrrier # Conflicts: # ARCHITECTURE.json # ING.jsonl # tool/regen_array_new_leaf_native_s.sh
alloc-syscall-arm64-s-1: 'hexa_ptr_alloc = ARENA' ๋ ์ฐธ์ด์ง๋ง, ๊ทธ๊ฒ์ด build_aprime ์ 'index 7 out of bounds' ์ ์์ธ์ด๋ผ๋ ๋ด ํ์ ์ FALSIFIED. ๋ด ๋ณ๊ฒฝ์ด 0 ์ธ ์์ origin/main ๋์กฐ๊ตฐ์์๋ ๋์ผ ์ฌํ๋๊ณ , GitHub ์ clone ์์๋ ๊ฐ์ main ์ด ์ ์ ๋น๋๋๋ค โ ์ง์ง ์์ธ์ ํ ํธ์คํธ์ ๋จ์ stale ์์ฑ ์ํฐํฉํธ์๋ค. build-aprime-sh-3: ๊ทธ stale-์์ฑ๋ฌผ ํ์ต. ์ฒ์ build-aprime-sh-2 ๋ก ๋ฃ์๋๋ฐ main ์ ๊ฐ์ id(์ค๋ฅ ํํฐ ํ์ต)๊ฐ ์ด๋ฏธ ์์ด union ๋ณํฉ์์ ์กฐ์ฉํ ๋๋กญ๋๋ค โ id ์ถฉ๋ ์์ฒด๊ฐ ๋ ํ๋์ ํจ์ .
โฆ์ ๊ณ ์ณ์ง๋ค (__hxw_ ๋ธ๋ฆฌ์ง๊ฐ ์ ๋ต์ง)
์ํฌํ๋ก์ฐ wf_ba079006-120 (30 ์์ด์ ํธ ยท ์ ๋์ ๋ฐ์ฆ ํต๊ณผ 23๊ฑด).
๋ด ์ ์ 4๊ฑด์ด ๋ฐ์ฆ๋๋ค:
1. "array_core ๊ฐ __hxw_ ๋ธ๋ฆฌ์ง๋ฅผ ์ด๋ค" โ FALSE. grep ํํธ๊ฐ ์ฃผ์์ด์๊ณ , ๊ทธ ์ฃผ์์
์ ๋ฐ๋๋ฅผ ๋งํ๋ค: "no C bridge needed for this nativeโnative edge; the __hxseed_
bridge exists only for C-side callers" [array_core.hexa:54-63].
2. "๋ธ๋ฆฌ์ง ๋ฏธ์ฌ์ฉ = ์ญ์ฌ์ ๋๋ฝ" โ FALSE, ๊ตฌ์กฐ์ ๋ถ๊ฐ. #define ์ runtime_core.c ํ
์คํธ๋ง
๋ฎ๋๋ฐ typed-leaf ์ ํธ์ถ์๋ 3์ข
์ด๋ค โ runtime_core.c ยท gen2 ๊ฐ ๋ฑ๋ user.c ยท
๋ค์ดํฐ๋ธ ๋ฐฑ์๋๊ฐ ๋ฑ๋ raw asm call. cpp ๋ ๋ค ๋์ ๋๋ฌํ์ง ๋ชปํ๋ค.
3. "lenโ0 ์ด SIGSEGV ๊ทผ์ธ" โ FALSE. ๋ฐ๋ ์ฌ๋ณผ(์คํธ์ถ์ 0).
4. "์ ๋ณต ๊ฒฐํจ" โ FALSE. opt-out ๋ง ์๊ณ ์๋ 9๊ฐ๊ฐ tracked, packed ๊ฒฝ๋ก๋ default-ON
โ ๊นจ์ง ์๋ x ๊นจ์ง ๋ ์ด์์์ด ํ์ฌ SHIPPED DEFAULT ๋ค.
โ
์ ๊ท ํ์ โ ํด๋์ค C (๋์คํฌ๋ฆฝํฐ ๋ ์ด์์ ํ๋ฅ). ์ด๊ฒ ์ง์ง ๊ทผ์ธ์ด๊ณ ABI ์์ ์ผ๋ก๋
์๋ฆฌ์ ์ผ๋ก ๋ชป ๊ณ ์น๋ค:
C [runtime_core_emit.hexa:1366-1370] { int64_t* data@0; int64_t len@8; int64_t cap@16 } 24B
์๋ [array_typed_leaf.hexa:65,69-70] malloc(16) ยท store32(a,8) ยท store32(a,12) 16B
๊ตฌ์กฐ์ฒด๋ #3352 ์์ i64 ๋ก ๋์ด์ก๋๋ฐ, ์๋๋ ๊ทธ๋ณด๋ค ํ์ฐธ ๋ค(#4917)์ ์์ฑ๋์์๋ ์
์น์๋ฅผ ์ด๋ค. ์ฝ๋์ ์ len ์ +8 ์์ 64๋นํธ๋ก ์ฝ์ผ๋ฏ๋ก len=(cap<<32)|len = ๊ฑฐ๋๊ฐ์ด ๋๊ณ ,
bounds check ๋ฅผ ํต๊ณผํด OOB SIGSEGV. ์ญ๋ฐฉํฅ(C-mint โ ์๋ push)์ cap ์ +12(len ์ ์์
32๋นํธ)์์ ์ฝ์ด cap=0 โ realloc(old,0)=free โ UAF.
์ ๋ต์ง๋ ๊ฐ์ ๋ฆฌํฌ์ ์๋ค โ arr_zeros_leaf.hexa:61-63 ์ store64 @0/@8/@16 ์ ์ด๋ค.
zeros/array_new ์ด carrier ์นํ๋ง์ผ๋ก ์ด์๋ ๊ฑด "์ค์นผ๋ผ ๋ฏธ๋ฌ๊ฐ ์์ด์"๋ง์ด ์๋๋ผ
๋ ์ด์์๋ ์ด๋ฏธ ๋ง์๊ธฐ ๋๋ฌธ์ด๋ค.
๊ถ๊ณ ์ = thunk (์๋๋ฅผ *_seed ๋ก rename + all-HexaVal ์๊ทธ๋์ฒ, C ๊ฐ ์ ์ ์ด๋ฆ์ C-ABI
thunk ๋ก ์์ ). 3์ข
ํธ์ถ์๋ฅผ ์ ๋ถ ์ปค๋ฒํ๊ณ ์ฝ๋์ /gen2/frozen-seed ํธ์ง์ด 0์ด๋ฉฐ, rename
์์ฒด๊ฐ flag-day ๊ฐ๋๊ฐ ๋๋ค โ ๋ก์ runtime.a ๋ undefined symbol ๋ก ์๋๋ฝ๊ฒ ์ฃฝ์ง,
์กฐ์ฉํ ๋ ์ง์คํฐ๋ฅผ ์๋ชป ๋๊ธฐ์ง ์๋๋ค.
ํด๋์ค A(carrier) + B(thunk) + C(๋ ์ด์์) ์
๋ค ํ์๋ค. ํ๋๋ง ๊ณ ์ณ์๋ SIGSEGV ๊ฐ
์ฌ๋ผ์ง์ง ์๋๋ค.
๊ตฌํ-ready ์คํ(E1~E5, ์ ๋ถ file:line) = state/hexa-own/typed_leaf_abi_layout_audit.md
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dancinlife
added a commit
that referenced
this pull request
Jul 15, 2026
โฆrier seeds + own-obj allowlist carrier fix (#4972) Regen the 3 frozen carrier seeds self/native/array_new_leaf_{x86_64,arm64, arm64-linux}.s from the #4936-fixed SSOT stdlib/runtime/array_new_leaf.hexa on the aiden pool + commit. Until now no seed existed (git ls-files empty), so the .s-seed path in stage_resolve_runtime_a short-circuited and HEXA_RT_ARRAY_NEW_ NATIVE stayed OFF on all 3 targets. With the seeds present, hexa_array_new drops from the compiled runtime_core.c and routes through the native carrier (bit-changing). Seed verify (aiden regen): x86_64 "1/1 T defined, U-floor clean". All 3 are carrier-only โ call/bl hexa_heap_zalloc (the #4930-fix carrier) + bl _hexa_bool (__hx_payload_eq, expected) + hexa_exit. Zero U-floor breaches (no raw libc calloc/malloc/free, no boxed slow-call hexa_eq/mul/add_slow). arm64/darwin cross-assemble WARN-skips on the x86 pool host => real verify = cloud CI 3-target byteeq. Allowlist: stage_resolve_runtime_a:686 (the ARR-NEW own-obj path) held a stale hexa_ptr_alloc entry => it would mis-flag the carrier seed's hexa_heap_zalloc as _bad and reject it. Fixed to hexa_heap_zalloc, matching the .s-seed path at :722. :762 is the ARR-ZEROS family (arr_zeros_leaf_native.o) โ left untouched (surgical). Verify: shell syntax check clean (local). Bit-changing => held PR. CI faithful- nobaseline 3-target byteeq + seed-ABI contract gate + install smoke. Merge only on all-3-target GREEN; any RED => revert. no-verify: 36 pre-existing ARCHITECTURE.json ARCH-BIG-CELL/PILED violations on origin/main, unrelated to this seed-add; CHANGELOG entry staged; ARCHITECTURE axis-โก node updates after the CI-verified merge. Co-authored-by: nbcorr-agent <nbcorr-agent@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.