TL;DR
While fuzzers like Syzkaller can uncover thousands of critical Linux kernel bugs, repairing them remains a slow, manual process due to the kernel's immense complexity. KAGENT is a new execution-guided agent that automates this repair by combining hypothesis-driven reasoning with KGYM++, a specialized toolstack that slashes kernel build times and distills massive execution logs into actionable insights.
What Problem Does This Paper Address?
Automated fuzzing has become incredibly efficient at finding "deep" bugs in the Linux kernel, but the "fix rate" hasn't kept pace. Existing Large Language Model (LLM) repair agents typically target user-space applications where bug reports are written in natural language and test suites are fast.
The Linux kernel presents three unique "C" challenges:
- Lack of Failure Semantics (C1): Fuzzers produce "machine-flavored" artifacts (stack traces, register dumps) rather than human-readable bug reports.
- Scale and Opacity (C2): With over 20 million lines of code and complex concurrency, static analysis isn't enough to understand a crash.
- Validation Cost (C3): A single kernel rebuild can take 30–60 minutes, making the iterative "trial and error" approach of standard agents prohibitively expensive.
Methods
The authors propose a paradigm of agent-tool co-design, consisting of two main components:
- KAGENT: A workflow-based agent that mimics a human developer. Instead of jumping straight to code edits, it follows a Hypothesis-Driven Reasoning scaffold. It generates natural language hypotheses about the root cause, performs "self-reflection" to score these hypotheses against execution traces, and then synthesizes patches. It uses a "replace-based" interface for code edits to avoid the brittleness of line-number-dependent git diffs.
- KGYM++: A custom toolstack designed to support the agent. It features a Trace Minimization Algorithm that filters millions of kernel events down to a high-signal window (roughly 200 functions) centered around the crash. Crucially, it uses KCACHE (an object cache) and incremental builds to reduce the feedback loop from 20 minutes to under 3 minutes.
Datasets
The researchers evaluated KAGENT using:
- KBENCHSYZ: A curated benchmark of 279 Syzkaller-reported bugs, partitioned into "Small Context" (SCS) and "Large Context" (LCS) subsets based on the amount of code needed for localization.
- "Wild" Syzkaller Bugs: A set of 42 recently reported, real-world bugs used to test the agent's generalization beyond the primary benchmark.
Key Insights and Ideas
- Reshaping the Evidence: The authors found that feeding raw crash logs to LLMs fails. The "aha moment" was realizing that the agent needs "reshaped" artifacts—converting raw traces into natural language hypotheses and minimized execution slices—to reason effectively.
- The Power of Fresh Starts: By using a tree-based exploration (multiple narrow trajectories) rather than one deep search, KAGENT avoids "early edit" traps where a bad initial change dooms all subsequent steps.
- Beyond the "Pass/Fail" Binary: The paper introduces a nuanced Patch Utility Taxonomy. They found that many patches "resolve" a crash but are actually "incorrect" because they "amputate" functionality (e.g., simply deleting a warning or skipping a critical check). They categorize patches as Plausible (equivalent to developer fix), Helpful (correct root cause but imperfect), or Incorrect.
- Localization Heuristics: In the Linux kernel, the buggy file is mentioned in the crash report 74% of the time. KAGENT leverages this "file hint" to narrow the search space significantly.
Key Results
- High Success Rate: KAGENT resolved 54.5% of crashes in a fully automated "non-oracle" setting. When provided with the correct file hint (the "oracle" setting), the success rate jumped to 65%.
- Model Scaling: Performance improved steadily with stronger models; Gemini 2.5 Pro resolved significantly more bugs (101 in the LCS set) compared to Gemini 1.5 Pro (65).
- Semantic Quality: In a manual study of 79 patches, 32.9% were found to be semantically equivalent to the ground-truth fixes provided by human kernel maintainers.
- Efficiency Gains: KGYM++'s optimizations resulted in a 42.69% average speedup in kernel build times, making high-throughput agentic repair a reality.
Limitations and Future Work
- Functionality Preservation: A major open question remains: how can an agent verify that it hasn't broken intended features while fixing a crash? Because the Linux kernel has low test coverage for many subsystems, a patch might pass the "reproducer" but fail in real-world usage.
- Multi-file Bugs: While KAGENT handles single-file bugs well, multi-file fixes remain a challenge, with the agent achieving lower recall in those scenarios.
- Trace Extraction Failures: About 8% of bugs failed trace extraction due to VM or configuration issues, suggesting that the "tool" side of the co-design still has room for hardening.
Summary updated