feat(tpc): [DET] 读取悬空打印 cargs 指向块头 - is_alive 拦截时输出 cargs/block/hdr(0=已free UAF实锤 奇数=活跃但记录表异常 其它=非pool块),定位 KwEntry cl.args 悬空源

This commit is contained in:
TermiNexus committed 2026-08-25 15:35:28 +08:00
1 parent fefc1e8343
commit b3b82a8093
1 file changed
+6 -2
+6 -2
View File
@@ -133,8 +133,12 @@ class CallGenCtor(CallGenBase.CallGenBase):
# 默认关闭无开销。补 _det_probe 写入侧检测的盲区。
if cargs is not None and pool is not None:
if pool.is_alive(cargs) == 0:
stdio.printf("[DET] 读取悬空: struct-ctor cargs=%llu 不在存活记录(cl.args 悬空 = use-after-free 读取)\n",
t.CUInt64T(cargs))
# 打印 cargs 指向的块头:0=已 free(UAF 实锤) 奇数=活跃(记录表
# 异常) 其它=非 pool 块(stdlib.malloc/垃圾指针)——定位悬空源
blk_c: t.CUInt64T = t.CUInt64T(cargs) - 2 - 8
hdr_c: t.CUInt64T = t.CUInt64T(c.Deref(t.CUInt64T(blk_c, t.CPtr)))
stdio.printf("[DET] 读取悬空: struct-ctor cargs=%llu block=%llu hdr=0x%llX(0=free 奇数=活跃 其它=非pool块)\n",
t.CUInt64T(cargs), blk_c, hdr_c)
stdlib.exit(1)
# 创建临时 alloca
# 确保跨模块结构体的完整定义在当前模块中可用(供 alloca 分配空间)