feat(memhub): 读取侧存活校验 is_alive - 补 detection 写入检测盲区:struct_ctor 读 cargs 前校验 cl.args 是否在记录表 active 记录中,不在即 [DET] 读取悬空 打印 cargs 值并终止;拦截 use-after-free 读取(SlotsBugTest KwEntry cargs=cl.args 悬空根因),detection==0 时 is_alive 恒返回 1 不拦截
This commit is contained in:
1 parent
1de7c8d2ca
commit
fefc1e8343
2 files changed
+32
No files matched your search
@@ -127,6 +127,15 @@ class CallGenCtor(CallGenBase.CallGenBase):
|
||||
OOP 结构体:alloca → call __before_init__(ptr) → call __init__(ptr, args) 或 store 参数 → load
|
||||
普通结构体:alloca → zero + defaults → store 参数 → load
|
||||
"""
|
||||
# [DET] 读取侧存活校验(detection 模式启用):cargs(cl.args)必须指向
|
||||
# 存活块——不在记录表(或已 free)= use-after-free 读取(SlotsBugTest
|
||||
# KwEntry cargs 悬空根因定位)。is_alive 内部处理 detection==0 时不拦截,
|
||||
# 默认关闭无开销。补 _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))
|
||||
stdlib.exit(1)
|
||||
# 创建临时 alloca
|
||||
# 确保跨模块结构体的完整定义在当前模块中可用(供 alloca 分配空间)
|
||||
self.Gen.StructGen.ensure_struct_def_in_module(pool, mod, struct_ty)
|
||||
|
||||
Reference in new issue
Block a user