一句话:首个利用大语言模型自动合成系统调用规范以增强内核模糊测试的方法。
操作系统内核漏洞影响广泛,内核模糊测试通过生成系统调用序列来发现内核缺陷,但依赖系统调用规范(定义语法与语义)来生成有效序列。现有规范生成工作仍大量依赖人工,大量重要系统调用未被覆盖。本文提出 KernelGPT,首个利用大语言模型自动合成系统调用规范以增强内核模糊测试的方法。其核心洞察是 LLM 在预训练中接触了大量内核代码、文档与用例,可自动提炼构造有效系统调用所需信息。KernelGPT 采用迭代方式自动推断规范,并基于验证反馈进行调试与修复。实验表明,相比现有技术,KernelGPT 能生成更多新的有效规范并获得更高覆盖率;已发现 24 个 Linux 内核新缺陷,其中 12 个被修复、11 个分配 CVE 编号,多项规范被 Syzkaller 开发团队采纳合并。
Bugs in operating system kernels can affect billions of devices and users all over the world. As a result, a large body of research has been focused on kernel fuzzing, i.e., automatically generating syscall (system call) sequences to detect potential kernel bugs or vulnerabilities. Kernel fuzzing aims to generate valid syscall sequences guided by syscall specifications that define both the syntax and semantics of syscalls. While there has been existing work trying to automate syscall specification generation, this remains largely manual work, and a large number of important syscalls are still uncovered. In this paper, we propose KernelGPT, the first approach to automatically synthesizing syscall specifications via Large Language Models (LLMs) for enhanced kernel fuzzing. Our key insight is that LLMs have seen massive kernel code, documentation, and use cases during pre-training, and thus can automatically distill the necessary information for making valid syscalls. More specifically, KernelGPT leverages an iterative approach to automatically infer the specifications, and further debug and repair them based on the validation feedback. Our results demonstrate that KernelGPT can generate more new and valid specifications and achieve higher coverage than state-of-the-art techniques. So far, by using newly generated specifications, KernelGPT has already detected 24 new unique bugs in Linux kernel, with 12 fixed and 11 assigned with CVE numbers. Moreover, a number of specifications generated by KernelGPT have already been merged into the kernel fuzzer Syzkaller, following the request from its development team.