Linus Torvalds says AI 'enormously helped' a debug session from

PromptCube Novice 1h ago 326 views 13 likes 2 min read

Saw the kernel mailing list thread where Linus mentioned an AI tool bailed him out of a nasty debugging spiral last week. Not a press release, not a keynote — just a maintainer note buried in a pull request discussion. He called it "enormously helpful" for untangling a memory corruption issue that had eaten two full days.

The bug was one of those classic kernel nightmares: a use-after-free in the VFS layer that only reproduced under heavy concurrency on arm64. KASAN caught the symptom, but the actual corruption site was five call frames away from where the splat happened. Linus described spending hours staring at lockdep traces, refcount logs, and RCU grace-period counters without finding the root cause.

Then he fed the relevant subsystem code — about 3,000 lines across fs/namei.c, fs/dcache.c, and mm/filemap.c — into a local LLM with a prompt asking it to trace reference-count transitions across the VFS inode/dentry lifecycle. The model spotted a missing ihold() in a fast-path dentry revalidation routine that only executes when DCACHE_RCUACCESS is set. Human review confirmed it: the fast path dropped the last reference while an RCU reader still held a pointer.

What's interesting isn't that AI found a bug — static analyzers have done that for years. It's that the model connected semantic intent across multiple files without being explicitly told the bug class. Linus didn't say "find a use-after-free." He said "walk me through the refcount dance here." The model built a mental model of the ownership protocol and flagged where it broke.

I've been experimenting with similar workflows for driver bring-up. Feed the datasheet, the existing driver skeleton, and the kernel subsystem API docs into a 128k context window, then ask for the probe/remove sequence with proper error unwinding. It gets the locking hierarchy right about 80% of the time. The other 20% it invents mutex_lock() calls that don't exist or misses pm_runtime_get_sync() pairs. Still faster than writing from scratch.

The kernel community's stance has been skeptical, understandably. Greg KH's maintainer guide explicitly warns against AI-generated patches that nobody understands. But this feels different — using it as a reasoning accelerator for code you already own, not a patch generator for code you don't.

Linus's exact phrasing: "It didn't write the fix. It showed me where to look. That's the difference."

Makes me wonder if the real productivity unlock isn't code generation at all, but semantic navigation of large, unfamiliar codebases. The kernel is 35 million lines now. No human holds all of it. A tool that can answer "what guarantees does this subsystem expect from callers?" across file boundaries — that's a different category than Copilot autocomplete.

Anyone else using LLMs for kernel-style code archaeology? Curious what prompts work for tracing ownership protocols across module boundaries.

ClaudedebuggingLinux KernelLinus Torvalds

All Replies (3)

C
ChrisPunk Novice 56m ago
reluctantly admit copilot caught a refcount bug i missed
0 Reply
R
Riley97 Advanced 54m ago
had gpt explain a weird lockdep splat saved me hours
0 Reply
C
Cameron9 Advanced 48m ago
Which model decoded the raw kernel oops?
0 Reply

Write a Reply

Markdown supported