Files
TransPyC/debug-reexport-strcmp-crash.md
T
2026-08-22 02:35:30 +08:00

2.4 KiB
Raw Blame History

Debug Session: reexport-strcmp-crash

  • Status: [OPEN]
  • Issue: TPV 编译时概率崩溃,ImportsGenMixin.lookup_reexport 内 strcmp 读取垃圾指针 0x12e200000001(READ access-violation)
  • Debug Server: 无(原生编译器,用 stderr 捕获)
  • Log File: 1.log / 用户运行输出

Reproduction Steps

  1. 用 TransPyV/output/TransPyV.exe(ASan 版)编译 TPV 或某个多文件项目
  2. 多次运行,约 1/N 概率在 lookup_reexport 的 strcmp 崩溃
  3. 崩溃栈:AnnAssignHandle → translate_value → translate_call → lookup_reexport → strcmp (for 循环体内 AnnAssign 的值表达式是跨模块调用)

Hypotheses & Verification

ID Hypothesis Likelihood Effort Evidence
A self(ImportsGenMixin 子对象)经 MRO this-adjust 错位 → 读 ReexportSha1s/Count 得到垃圾 High Low Pending
B perm_pool 中 reexport 表被其他分配越界写覆盖(表指针有效但内容被污染) Med Low Pending
C Generator 对象(mb)字段被越界写污染(ReexportCount 变垃圾) Med Low Pending
D mod_sha1 / func_name 参数悬空(AST/SHA1 store 被回收) Low Low Pending
E register_reexport 用悬空源串写入表 → 表内复制了垃圾 Low Low Pending

Log Evidence

(待插桩后收集)

插桩点(2026-08-19 已加,未提交,验证后移除)

  • ImportsGenMixin.vp lookup_reexport:
    • [DBG-RE1] 入口:self/count/sha1s/funcs/srcs/mod_sha1/func_name(表非空时每次调用打印)
    • [DBG-RE2] 循环内每次 strcmp 前状态(已按用户要求移除)
  • CallGenCall.vp _translate_method_call this-adjust:
    • [DBG-ADJ1] class/anc/obj
    • [DBG-ADJ2] find_struct(anc) 结果 + FieldCount
    • [DBG-ADJ3] first_field/anc_off/sub_off/delta

复现操作

  1. 清缓存 + Phase A 重建(含插桩的 TransPyV)
  2. 反复运行编译目标项目(崩溃概率 1/N),捕获 stdout/stderr 到文件
  3. 崩溃前最后几条 [DBG-*] 行即关键证据

Verification Conclusion

(待定)

插桩已全部移除(2026-08-19 用户要求)

  • [DBG-RE1/RE2](ImportsGenMixin.vp)已删,文件恢复 HEAD
  • [DBG-ADJ1/2/3](CallGenCall.vp)已删
  • this-adjust fail-fast 修复已提交:TransPyV 6807082
  • 概率崩溃是否根治待用户重建后观察(如再复发,可重新插桩)