reharness 架构

libclang AST + 数据流/污点追踪的驱动 RIS 提取器

前端:解析 & AST 构建 中端:分析引擎(数据流 / 污点 / 调用图) C 驱动源码 .c / .h 文件 输入 CLI 入口 cli.py / __main__.py TU 解析器 tu.py + libclang AST 构建 宏偏移表 macros.py 预处理 AST 模型 ast_model.py 结构化 调用图构建 call_graph.py 过程间分析 MMIO 识别 mmio.py ioremap/readl/writel 污点分析 taint.py BasePtr/ReadTaint 数据流分析 dataflow.py 流敏感 store 意图标注 intent.py 宏名 → intent 形式化引擎 formal.py + formalize.py Expr 代数 提取器主控 extractor.py 流水线编排 .ris 规约 形式化 RIS 输出 输出 验证 & 统计 compare.py verification/ 测试套件 test_extractor.py tests/ MMIO ops 内联调用 污点传播 Legend External Cloud Backend Security Frontend Database

前端:解析层

  • • libclang 解析 C 源码为 AST
  • • 宏偏移表:#define REG 0x20 自动求值
  • • AST 模型:结构化驱动函数

中端:分析层

  • • 调用图 + 包装函数内联 (深度≤3)
  • • MMIO 识别:ioremap→BasePtr, readl→ReadTaint
  • • 流敏感数据流:base+offset, RMW 检测
  • • 分支谓词附到 op (IF/ELSE 嵌套)

后端:形式化层

  • • .ris 规约:Read/Write/RMW/Cond/Loop/Delay
  • • Expr 代数:Const|Var|BinOp|Bits|Top
  • • RegAddr:Symbolic(base.reg) | Fixed(base,off)
  • • 对齐 driver-harness formal.rs (P1–P4)