超越边覆盖:通过LLVM在核函数边界进行每任务数据流提取
Beyond Edge Coverage: Per-Task Data-Flow Extraction at Kernel Function Boundaries via LLVM
AI总结:
提出BOUNDARY FLOW框架,基于LLVM扩展KCOV,在函数边界提取参数和返回值数据流,为内核模糊测试提供状态感知反馈,并支持Rust内核模块,开销低于3%。
摘要:
基于覆盖引导的内核模糊测试工具(如syzkaller)依赖边覆盖(trace-pc)作为唯一的反馈信号。这种上下文无关的方法无法区分仅在参数值上有所不同的执行路径。例如,两次调用copy_from_user(),即使参数size不同,也会命中相同的基本块,但安全含义却大相径庭。我们提出了BOUNDARY FLOW,一个基于LLVM的插桩框架,它扩展了Linux KCOV,实现了函数参数和返回值的数据流提取。一个编译器pass(-fsanitize-coverage=dataflow-args, dataflow-ret)在函数入口处发出轻量级回调,捕获结构化元组<PC, arg_idx, arg_size, ptr, offsets[]>,在返回时捕获<PC, ret_size, ptr, offsets[]>。复合类型通过DWARF DICompositeType元数据自动分解,无需源代码注释。一个独立的内核设备(/sys/kernel/debug/kcov_dataflow)提供无锁的每任务环形缓冲区,不会干扰现有的KCOV或syzkaller基础设施。我们展示了双重用途:模糊测试工具获得状态感知反馈,用于指导进入值依赖状态转换的变异;安全分析师获得确定性的参数记录,用于根本原因分析,而无需printk或kprobe开销。一个编译后流水线(rustc, opt, llc)使得Rust内核模块插桩成为可能,无需修改rustc,这是在drgn/vmcore因-O2 DWARF省略而失败的情况下捕获Rust函数参数的唯一运行时方法。在五类漏洞(越界、释放后使用、双重释放、10层深度链传播、Rust FFI、Rust for Linux模块)上评估,插桩路径的开销低于3%。
英文摘要:
Coverage-guided kernel fuzzers such as syzkaller rely on edge coverage trace-pc as their sole feedback signal. This context-blind approach cannot distinguish execution paths that differ only in argument values. For example, two invocations of copy_from_user() with different size parameters hit identical basic blocks yet have vastly different security implications. I present, an LLVM-based instrumentation framework that extends Linux KCOV with data-flow extraction of function arguments and return values. A compiler pass emits lightweight callbacks that report one source-level parameter per call, passing the value itself in a register together with its index and byte size. A composite is instead reported by the address of the object holding it, paired with a constant table of field (offset, size) pairs derived from DWARF DICompositeType metadata, with zero source annotation. The callbacks carry no program counter. The kernel derives it from the return address, which also attributes records the compiler emitted from inside an inlined body to the callee that was inlined. A lock-free per-task record buffer delivers variable-length records to user space with no interference to existing KCOV or syzkaller infrastructure, carrying entry, return, and comparison-operand records in one unified stream. I demonstrate dual utility: (1) fuzzers gain state-aware feedback for mutation guidance into value-dependent state transitions, and (2) security analysts obtain deterministic argument records for root-cause analysis without printk or kprobe overhead.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。