Repository navigation
tests+fix: 修复管线契约测试 phase-1 + fix_so.py 对齐 Go 基线(含冻结基线) - #21
Merged
Merged
Conversation
- tests/gen_fixtures.py: 确定性生成 17 个 DEX/SO 契约样例 + manifest(意图/预测/原始哈希) - gui/contract_test.go: -tags contract 运行 FixDexDirectory/FixSoDirectory 并输出分类 JSON - tests/contract/run_python.py: 调用两个 Python 模块的 fix_directory_aligned - tests/contract/v9_harness.cpp + run_v9.py: v9 原语级 harness(编不过则诚实 SKIPPED,Linux CI 覆盖) - tests/contract/compare.py: 编排/报告/冻结(--freeze)/校验(--check)/严格(--strict) - Makefile test: 接线;新增 .github/workflows/contract-tests.yml - 首轮报告: DEX 10/10 字节级一致;SO 3 处分叉集中在 fix_so.py repair_elf (对健康 SO 重建 SHT;对 offset skew 的 clamp 破坏 PT_DYNAMIC) - 按约定本 PR 不冻结 expected.json,待确认口径后另行提交 Co-Authored-By: Claude Code <noreply@anthropic.com>
按确认的 A 口径(以 Go/dev 版 bad/ 隔离为准): - 新增 repair_elf_aligned():只做 Go sofix.go repairSo 的四件事 (补 magic/EI_DATA/EI_VERSION、PT_LOAD/PT_DYNAMIC p_offset=p_vaddr、 PT_LOAD p_filesz 抬到 p_memsz),不重建 SHT、不裁 extent、 不动 PT_DYNAMIC 类型;判读不了抛错交调用方隔离。 - fix_so_file() 改走对齐管线,并按 Go 流程补"修复后深校验,仍不合格 移 bad/"一步。此前它误用重型 repair_elf:对健康无 SHT 的 dump 多 写 6 段 SHT,对 p_offset≠p_vaddr 的真实 dump 把 p_filesz 归 0、 把 PT_DYNAMIC 清成 PT_NULL(修复反而破坏文件)。 - CLI(main/--carrier/repair_file)仍走原 repair_elf 全量路径,能力 保留未动;其 skew-clamp 缺陷记为后续独立议题。 - 契约: 17/17 用例 Python 与 Go 分类一致且逐字节一致; 冻结 tests/contract/expected.json(Go 基线),CI --check 门生效; v9 列改为仅按其记录值做漂移告警(设备端语义有意不同)。 Co-Authored-By: Claude Code <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.
内容(两个 commit)
93289fd契约测试基建:gen_fixtures(17 样例+manifest)、三家 runner(python/go -tags contract/v9 原语 harness)、compare 编排、仓库首个 CI。0fc56da按确认的 A 口径(以 Go/dev 版 bad/ 隔离为准)修fix_so.py并冻结expected.json。fix_so.py 改了什么
repair_elf_aligned():严格镜像 GorepairSo——补 magic/EI_DATA/EI_VERSION、PT_LOAD/PT_DYNAMIC p_offset=p_vaddr、p_filesz抬到p_memsz;不再对健康文件重建 SHT、不再 extent-clamp、不再清 PT_DYNAMIC。fix_so_file()改走对齐管线,并补上与 Go 一致的"修复后深校验,仍不合格移 bad/"。main/--carrier/repair_file)仍走原repair_elf全量路径,能力未动。p_filesz→0、PT_DYNAMIC→PT_NULL)仍在,契约管线已不经过它;建议后续单独立项处理。首轮发现的差异 → 现在已收敛
基线与门禁
tests/contract/expected.json从 Go 基线冻结(17 例:分类+字节哈希+位置)。--check(任何实现行为漂移→红)。本地--check --strict已验证 exit 0。-tags contract后;fix_dex_checksum.py未动;TUI/GUI 流程不经过 fix_so.py。验证记录
sys/uio.h无 Windows 等价物按设计 SKIPPED。🤖 Generated with Claude Code