Skip to content

LATX, kzt: publish cumulative refactor through Step4 - #5

Closed
LaurenIsACoder wants to merge 27 commits into
masterfrom
lauren/kzt-step4-wi230-wi231-integrated-20260709094322
Closed

LATX, kzt: publish cumulative refactor through Step4#5
LaurenIsACoder wants to merge 27 commits into
masterfrom
lauren/kzt-step4-wi230-wi231-integrated-20260709094322

Conversation

@LaurenIsACoder

Copy link
Copy Markdown
Owner

Summary

This draft PR publishes the cumulative KZT refactor work through Step4 to the personal fork only. It keeps the new writer path fail-open unless the planner has sufficient evidence, and prepares Step5 to fill the remaining owner/wrapper/bridge trust evidence.

Key changes:

  • Add Guest Object Registry / Dynamic View foundations used by KZT planning.
  • Add immediate JUMP_SLOT candidate planning and writer helper coverage.
  • Hook the Step4 immediate JUMP_SLOT writer path under the existing KZT/context lifecycle.
  • Keep legacy relocation behavior when evidence is missing, mismatched, unsupported, or rollback/verification fails.
  • Add focused KZT unit tests and Step4 whitebox reports.

Validation

Executed on l1 LoongArch worktree:

  • Worktree: /home/loongson/work/code/latu-worktrees/kzt-step4-wi230-wi231-integrated-20260709094322
  • Branch: lauren/kzt-step4-wi230-wi231-integrated-20260709094322
  • HEAD: b03fda0a467dd5bf155d34a5ec48b235d5a63a00
  • git status --short: clean
  • git diff --check: passed
  • ninja -C build64-dbg: passed
  • KZT meson unit tests: 13 passed, 0 failed
  • latxbuild/build-release.sh: exit 0

Evidence was synchronized between control-plane /tmp/kzt-step4-evidence/ and l1:/tmp/kzt-step4-evidence/; rsync dry-run reported no content differences.

AgentsFlow Status

Project/Task: P-18 / T-62, KZT refactor / Step4 - RelocateElfRELA immediate JUMP_SLOT hook.

  • WI-232 is complete: Evidence, ExecutionRun, AI QA, Owner Review, and Done are satisfied.
  • WI-230 and WI-231 have Evidence and ExecutionRun, but AI QA is currently blocked by an AgentsFlow gate/parser issue: latest retries failed with ai_review_output_invalid on testing.verifiability even though the AI review summaries accepted the test evidence, raw output, exit codes, mapping, and checklist.

This PR is therefore a draft for code review and does not claim that all AgentsFlow Step4 gates are complete. WI-230/WI-231 should be rerun after the AgentsFlow gate/parser is fixed.

Safety Notes

  • Remote checked before push: only git@github.com:LaurenIsACoder/lat.git was configured.
  • This PR targets the personal fork LaurenIsACoder/lat, not upstream.
  • Step4 intentionally keeps fail-open behavior when owner/wrapper/bridge evidence is incomplete.
  • Step5 should focus on owner resolver, wrapper probe/minimal manifest, request enrichment, shadow diagnostics, and structured diagnostics gate.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Add the Step2 T1 KZT runtime Dynamic Table parser and view
representation. The parser reads Elf64_Dyn entries through the
kzt_guest_link_map_reader_ops_t reader seam, records the happy-path fields
needed by later KZT stages, and preserves runtime address semantics for
pointer-valued DT_* entries while keeping DT_NEEDED values as string table
offsets.

This change also wires the parser into the LATX context build and adds a
tests/unit/kzt white-box unit test. The test covers a complete
DT_NULL-terminated Dynamic Table, multiple DT_NEEDED offsets, load-bias
preservation, and the T1 address-semantics contract.

This is only the Step2 T1 parser/view happy path. It does not connect the
parser to the KZT registry, observation adapter, diagnostics, patch planner,
relocation patcher, lazy binding, dlopen/dlsym/dlclose, or hook replacement
paths. Error-state coverage for read failures and missing DT_NULL remains
for later Step2 tasks.

Validation:
- cc -I. -Itarget/i386/latx/include tests/unit/kzt/test_guest_dynamic_parser.c target/i386/latx/context/kzt_guest_dynamic.c -o "$out"
- "$out" --filter complete_runtime_dynamic_view
- "$out" --filter dynamic_address_semantics
- ../configure --target-list=x86_64-linux-user --disable-blobs --disable-debug-info --disable-docs --disable-linux-io-uring --disable-werror --enable-kzt --enable-latx --extra-ldflags=-ldl --optimize-O1
- meson compile -C build-t1-review-build-20260706-143954 kzt-guest-dynamic-parser
- meson test -C build-t1-review-build-20260706-143954 kzt-guest-dynamic-parser --print-errorlogs
- git diff --check

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Introduce a KZT input-layer enumerator that walks GuestDynamicView RELA tables and emits minimal planner candidates for x86_64 JUMP_SLOT and GLOB_DAT entries. The collector fails open on unsupported DT_REL, malformed dynamic/relocation/symbol/version inputs, read failures, overflow, and output capacity exhaustion.

Add WI-214 unit coverage for happy paths and fail-open cases.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
@LaurenIsACoder

Copy link
Copy Markdown
Owner Author

该 PR 是本次 KZT 重构累计到 Step4 的阶段性草稿,后续 Step5 及剩余阶段仍在同一提交链上继续推进。为遵循“全部工作完成后一次性创建并合入唯一累计 PR”的约定,现关闭此阶段性 PR;最终验证与人工审核通过后,将从完整累计分支创建唯一的新 PR。分支与提交仍保留供追溯。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant