TyPatch: Transforming Patches into Typestate Rules for Kernel Bug Detection
Ruoyu Wang, Tuo Li, Jia Li
Key points
From the paper's conclusion- On Linux v6.16, TyPatch finds 559 distinct bugs, 121 of which have been confirmed by kernel developers.
Abstract
Historical Linux kernel patches capture defect knowledge that applies beyond their original repair sites. Recent work has shown that large language models (LLMs) can generate static-analysis checkers from historical patches and use them to uncover new kernel bugs. However, complete-checker generation requires the model both to recover the defect semantics expressed by a patch and to implement sophisticated program-analysis machinery, including object tracking, alias analysis, path-state maintenance, and interprocedural propagation. Coupling these responsibilities in a single end-to-end code-generation task can turn a simple defect rule into an unstable and expensive analyzer-implementation problem. To address this problem, we present TyPatch, which decouples patch-specific defect semantics from analyzer implementation. An LLM translates each patch into a typestate rule specifying its tracked object, actions, guards, transitions, and violations. A shared backend then executes these rules, binding their actions to program events, tracking object identity across aliases, propagating typestate along program paths, and producing reports for all rules. On Linux v6.16, TyPatch finds 559 distinct bugs, 121 of which have been confirmed by kernel developers. In a matched 38-patch comparison with the state-of-the-art complete-checker construction workflow, TyPatch uses 88.3-90.1% fewer generation tokens, while its initial report pools achieve 3.42-14.95$\times$ the precision of those produced by that workflow.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Beyond Crash-to-Patch: Patch Evolution for Linux Kernel RepairarXiv · 2026
- Guided Generation of Linux Kernel Semantic Patches with Small Local Language ModelsarXiv · 2026
- ReproShift: Cross-Version Adaptation of Linux Kernel Fuzzing Crash ReproducersarXiv · 2026
- SemWeaver: Refining LLM-Generated Static Vulnerability Checkers with Analyzer-Internal EvidencearXiv · 2026
- Reproducer Synthesis for AI-Reported Bugs in the Linux KernelarXiv · 2026
- From Faulty Claims to Incorrect Patches: An Empirical Study of Task-Grounded Reasoning in Coding AgentsarXiv · 2026