Skip to content

LATX, kzt: cumulative library passthrough refactor - #6

Draft
LaurenIsACoder wants to merge 8 commits into
masterfrom
lauren/kzt-t98-latest-integration
Draft

LATX, kzt: cumulative library passthrough refactor#6
LaurenIsACoder wants to merge 8 commits into
masterfrom
lauren/kzt-t98-latest-integration

Conversation

@LaurenIsACoder

Copy link
Copy Markdown
Owner

目的

在最新 LAT 上游代码基础上,累计保存并审查本轮 KZT 库直通重构。该 PR 是本轮重构从 Step1 到最终收口的唯一源码 PR,后续阶段继续更新同一分支,不再按阶段拆分 PR。

PR3 保持原样,仅作为上一版重构方案的对照参考。

当前范围

  • 建立随现有 KZT/context 生命周期管理的 GuestObjectRegistry。
  • 完善 guest 动态链接信息读取、对象观察和卸载处理。
  • 接通 GOT/PLT 候选、owner、wrapper、版本与 bridge 证据链。
  • 增加保守的 Patch Planner、权限安全写入、写后验证和回滚保护。
  • 对证据不足、读取失败或冲突情况继续使用旧 KZT 流程。
  • 增加 KZT 白盒测试、真实 guest 测试入口和性能测试入口。

影响

当前改动仍以安全收敛和验证为主。只有证据完整时才允许新的库直通写入;无法确认时保持原有行为。

已完成验证

  • l1 LoongArch build32:KZT 全量单测 36/36 通过。
  • l1 LoongArch build64:KZT 全量单测 36/36 通过。
  • 已确认未版本化符号专项测试:build32 5/5、build64 5/5 通过。

后续

  • 完成真实纵向链路验证、完整回归和性能门禁。
  • 继续对照旧 KZT 与 PR3,保留已有正确性和性能优点。
  • 所有后续 KZT 重构提交继续推入本 draft PR,完成整体审核后再决定是否 ready。

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Track exact loader identities, generations, namespaces, dynamic view revisions, and decision leases in the guest registry. Add allocation-free live identity queries and coherent observation helpers for later loader and patching stages.\n\nCover registry lifecycle, concurrency, address resolution, loader handles, and decision lease behavior with focused white-box tests.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Add context-local loader quiescence readers and writers, exact binding lifetime gates, lazy prebind epochs, and loader lifecycle event publication. Replace fixed lifecycle snapshot capacity with inline storage that grows only on loader event paths and reports allocation or overflow failures.\n\nCover teardown, writer admission, prebind leases, hook failure paths, and 1025-object lifecycle generation rollover with white-box tests.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Build symbol-scope and dynsym proofs before patch decisions, route every KZT-owned slot update through expected-value CAS, and treat RELRO permission restoration as part of the write transaction. Add per-object GOT/PLT claims, exact wrapper bridge provenance, and fail-open atfork protection for concurrent bridge publication.\n\nCover scope revalidation, route policy, rollback and unrecoverable outcomes, bridge concurrency, and wrapper selection with focused white-box tests.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Route dlopen, dlsym, dlclose, namespaces, eager relocations, and lazy completion through guest ld.so evidence while preserving fail-open behavior. Connect exact binding and lifecycle publication to loader callbacks, protect dlclose with the loader-quiescence writer, and keep slot publication behind scope, generation, CAS, and RELRO transaction checks.\n\nIntegrate prebound bridge translation, thread-local dlerror state, teardown diagnostics, and targeted fast paths without adding work to disabled KZT paths. Add focused API, production-route, lifecycle, and source-contract coverage.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Add reusable x86_64 guest loader fixtures, deterministic harnesses, and launchers for namespace, visibility, versioning, lifecycle, preemption, and wrapper-handle behavior. Register the accumulated KZT unit, source-contract, and real-guest coverage in Meson while keeping performance execution opt-in.\n\nThis completes the internal commit sequence intended for one future cumulative KZT pull request.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Keep the guest dlvsym result authoritative unless the exact loader identity, retained library binding, guest dynsym address and requested symbol version all agree with a wrapper bridge. Treat missing, mismatched, and empty version evidence as fail-open, while leaving the explicit NULL dlsym path on its existing unversioned cache.

Add public selector behavior coverage for exact matches and fail-open boundaries, and update the related source contracts so both libc and libdl remain on the shared guest DL API.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
Route loader, symbol, relocation, and X11/XCB decisions through context-owned KZT state with retained lifetime evidence and guarded guest fallbacks. Remove the superseded lazy binding and diagnostic paths so production no longer depends on the old direct-routing state.

Add focused lifecycle, cancellation, bridge, relocation, and source-contract coverage, including exact dlsym/GLOB_DAT wrapper selection and cache invalidation checks.

Signed-off-by: Hanlu Li <heuleehanlu@gmail.com>
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