|
| 1 | +# AArch64 authenticated exit-word representation checks (2026-08-28) |
| 2 | + |
| 3 | +## Scope |
| 4 | + |
| 5 | +This checkpoint hardens the exact first-side admission, publication, native |
| 6 | +entry and retirement certificates before they are exposed to an ordinary |
| 7 | +arm64e build. Authenticated exit-table entries are stored data words. Their |
| 8 | +complete signed representation, including the discriminator-dependent PAC, |
| 9 | +is the authority for generation identity. |
| 10 | + |
| 11 | +This does not open the production side recorder. It preserves the existing |
| 12 | +one-shot first-side grammar and changes only how already-required raw target |
| 13 | +identity is compared and tested. |
| 14 | + |
| 15 | +## Representation rule |
| 16 | + |
| 17 | +Ordinary C pointer equality is suitable for object identity such as |
| 18 | +`GCtrace *`, `MCode *`, snapshot pointers and exit-slot addresses. It is not |
| 19 | +used for an encoded exit-table word on arm64e: a compiler is allowed to treat |
| 20 | +pointer equality semantically, while the lockless protocol must distinguish |
| 21 | +two words which strip to the same address but were signed with different |
| 22 | +discriminators. |
| 23 | + |
| 24 | +The first-side code now copies each acquired or freshly encoded `void *` into |
| 25 | +`uintptr_t` with `memcpy` and compares those integer representations. Views and |
| 26 | +transaction plans cache the representation bits alongside the pointer value, |
| 27 | +so double-capture and post-token revalidation prove the exact word they first |
| 28 | +observed. This covers: |
| 29 | + |
| 30 | +- the root fallback at hot-side metadata admission; |
| 31 | +- every private child exit slot before publication; |
| 32 | +- the parent fallback and desired child target in the publication plan; |
| 33 | +- the published parent-to-child edge and all child fallbacks at native entry; |
| 34 | +- live, detached and retired parent-edge states during transactional |
| 35 | + retirement; and |
| 36 | +- the arm64e wrong-discriminator negative and raw compare/exchange fixtures. |
| 37 | + |
| 38 | +The atomic raw compare/exchange remains pointer-sized and receives the |
| 39 | +original signed pointer values. The compiler atomic compares the stored |
| 40 | +representation; only surrounding C `==`/`!=` checks were replaced. No native |
| 41 | +entry, exit-stub or generated-code fast path gains work. |
| 42 | + |
| 43 | +The existing `mcauth` checks for the exact parent and child already use the |
| 44 | +same `memcpy`-to-`uintptr_t` rule. The focused first-side fixture now does so as |
| 45 | +well. |
| 46 | + |
| 47 | +## Fail-closed behavior |
| 48 | + |
| 49 | +The PAUTH negative creates a target with the correct stripped fallback address |
| 50 | +but a deliberately wrong discriminator. Its representation must differ from |
| 51 | +the saved slot word, semantic stripping must still produce the same raw |
| 52 | +address, and the publication seal must reject it before `PUBLISH`. The exact |
| 53 | +word is restored before the VM executes again. |
| 54 | + |
| 55 | +The native-entry and retirement validators similarly reject any same-address, |
| 56 | +wrong-signature edge as a lost generation rather than accepting it as a live, |
| 57 | +detached or idempotent state. |
| 58 | + |
| 59 | +## Validation |
| 60 | + |
| 61 | +The following focused and adjacent contracts passed on this Apple Silicon |
| 62 | +host for arm64 and arm64e, with BTI/PAUTH enabled in the arm64e slices: |
| 63 | + |
| 64 | +- `tools/ci/arm64_jit_side_ingress_metadata_contract.sh`; |
| 65 | +- `tools/ci/arm64_jit_exit_contract.sh`; |
| 66 | +- `tools/ci/arm64_jit_side_asm_consumption_contract.sh`; |
| 67 | +- `tools/ci/arm64_jit_first_side_publish_contract.sh`; and |
| 68 | +- `tools/ci/arm64_jit_root_entry_contract.sh`. |
| 69 | + |
| 70 | +The first-side runtime modes covered GC claim, scoped flush and full flush, |
| 71 | +twice per architecture. The exit-table negative covered raw, null-context, |
| 72 | +trace-context and wrong-global signatures. The only build diagnostic was the |
| 73 | +pre-existing unused `ccall_rawchild_wait` warning. |
| 74 | + |
| 75 | +A macOS x86_64 cross-build with `-Wall -Wextra` also completed. A diagnostic- |
| 76 | +free `-Werror` cross-build remains unavailable because that existing target |
| 77 | +reports unrelated unused parameters and one unused-but-set local in the string, |
| 78 | +table, metatable and API sources; none are in this checkpoint's files. |
| 79 | + |
| 80 | +## Next step |
| 81 | + |
| 82 | +With raw authenticated-word identity explicit, the next checkpoint can admit |
| 83 | +the existing exact exit-2 first child through ordinary `trace_hotside` and the |
| 84 | +finite publication transaction at dynamic trace numbers. Unsupported first |
| 85 | +side shapes, side-of-side recording, TRACE callbacks and GDBJIT/PERFTOOLS must |
| 86 | +remain fail-closed until their own complete transactions and contracts exist. |
0 commit comments