Skip to content
Cyber Attacks

Reviewers Find Race Condition in AI-Assisted Linux Kernel Memory Patches

Linus Torvalds used Claude Code to draft kernel patches that were not merged after reviewers found a race condition in a later series.

Illustration: An open laptop sits on a wooden desk with its screen displaying a complex web of abstract blue and red lines.
AI-generated illustration: BlueTeam Herald

Key points

  • Linus Torvalds used Anthropic’s Claude Code to create an eight-patch series for Linux 7.3-rc6.
  • Reviewers identified a race condition in filemap_read_rcu_batch in a later 10-patch series.
  • The patches are not merged and Kiryl Shutsemau is now carrying the revised work forward.

Linus Torvalds employed Anthropic’s Claude Code to develop experimental patches intended to resolve a long-standing page-cache scalability bottleneck in the Linux kernel. The resulting eight-patch series sits on Linux 7.3-rc6 but has not been merged into the mainline kernel. Reviewers identified a race condition and raised concerns about memory reclamation before the changes could be accepted.

The risk

The experimental patches aimed to reduce cross-core load caused by atomic writes to cache lines during small reads of cached files. Torvalds reported that folio reference-count contention accounted for nearly all cross-core load hits in his synthetic tests. The proposed solution used Read-Copy-Update (RCU) to allow readers to copy data without taking references. However, reviewers found that this approach introduced significant safety risks in how memory is freed and reused.

Who is exposed

These patches are currently confined to an experimental branch named noref-filemap-read-with-llm in Torvalds’ personal repository. Because the series is not merged, production systems running stable Linux kernels are not exposed to these specific code changes. The work affects only developers and testers who explicitly pull this experimental branch from the Linux kernel Git repository for local evaluation or testing purposes.

Cost and compliance

Torvalds warned that real-world performance gains would likely be smaller than the synthetic benchmarks suggested. The patches introduced an extra fault for reads into unmapped user pages, increasing single-thread read cycles from approximately 4,150 to 6,550. As BlueTeam Herald reported on 2026-10-12, IBM Db2 Mirror for i versions 7.4 through 7.6 contain a critical flaw allowing authenticated attackers to escalate privileges and execute code, highlighting the ongoing need for rigorous review in software development.

Our take on the response

The discovery of a race condition that could expose data that had never been written demonstrates the necessity of human oversight when integrating AI-generated code into critical infrastructure. Teams should treat AI-assisted development as a drafting tool rather than a final authority, ensuring that security reviews focus heavily on concurrency and memory management logic before any code reaches production environments.

What defenders should look for

Teams usually monitor source code repositories for rapid commits or branches labeled as experimental, especially when they involve core system components. Check whether development workflows include mandatory security reviews for AI-generated code, focusing on concurrency issues and memory safety. Look for alerts indicating unusual data exposure or race conditions in test environments before merging changes. Contain potential risks by isolating experimental branches from production systems and ensuring that all code changes undergo rigorous peer review before integration.

What to do and how to stay safe: Linux

  • Review your organization's policy on using AI assistants for code generation in critical systems.
  • Ensure that all experimental kernel patches are tested in isolated environments before any consideration for production use.
  • Monitor security mailing lists for reports of race conditions or memory safety issues in recent kernel updates.
  • Train developers to recognize the limitations of AI-generated code, particularly in complex concurrency scenarios.

Step-by-step guide: Multi-Factor Authentication Fatigue: Why Users Click Yes Too Fast

General security guidance from the BlueTeam Herald newsroom. It is not confirmed advice from the organisations named in this story.

Frequently asked questions

Did Linus Torvalds merge the AI-assisted patches into the Linux kernel?

No, the patches were not merged after reviewers identified a race condition in a later series.

What specific issue did reviewers find in the patches?

Reviewers identified a race in filemap_read_rcu_batch that could expose data that had never been written.

Who is now carrying forward the work on this bottleneck?

Kiryl Shutsemau folded the suggested changes into a revised patch and is now carrying the work forward.

Sources

  1. GBHackers
LinuxKernelAnthropicClaude CodeLinus Torvalds

Related stories