News › linux
By Zayden R., June 15, 2026
Linux 7.2 integrates the zerocopy Rust library to eliminate unsafe memory operations. The kernel gains 40,000 lines of Rust code plus AutoFDO support for better performance.
Linux 7.2 introduces a significant update by integrating the zerocopy Rust library into the kernel, a move aimed at enhancing memory safety without sacrificing performance. This addition brings around 40,000 lines of Rust code to the kernel, with 32,000 dedicated to the library's implementation and the remainder to documentation. The zerocopy library facilitates safe byte sequence conversions through derivable traits like FromBytes and macros such as transmute!, eliminating the need for the manual unsafe code blocks that developers traditionally relied on for memory manipulation.
Beyond just safety, the zerocopy integration promises tangible performance gains. Specifically, Rust Binder code exhibits a notable 13% performance boost when AutoFDO, or Automatic Feedback Directed Optimizations, is enabled. This improvement stems from the compiler's ability to statically prove memory safety, thereby removing the need for runtime panic checks. As a result, kernel modules can operate faster and more securely.
In conjunction with the zerocopy library, Linux 7.2 also introduces AutoFDO support for Rust kernel code. By leveraging runtime profiling data, the compiler can automatically refine hot code paths, a technique already employed by Google to enhance Chrome and other high-performance applications. For developers, this translates into writing clear Rust code while relying on the compiler to optimize performance.
The update further includes support for the software tag-based Kernel Address Sanitizer (KASAN) in Rust code. This tool helps catch memory corruption bugs during development, preventing potential data corruption or security issues in production environments. The kernel's support for Rust 1.98 ensures that developers have access to the latest language features and optimizations, in line with upstream Rust releases.
Zerocopy's licensing under "BSD-2-Clause OR Apache-2.0 OR MIT" aligns well with kernel requirements, and only minor modifications (2-3 lines) were necessary for its integration. Additionally, upstream maintainers have added SPDX identifiers as requested by the kernel team, which should help reduce merge conflicts in future updates.
For kernel developers, the integration of the zerocopy library marks a step forward in writing memory-safe code without compromising on performance. By handling unsafe operations internally, the library provides compile-time assurances regarding memory layout and access patterns. This development not only makes kernel programming more accessible but also ensures that Linux remains a robust choice for everything from embedded systems to large-scale data centers.
The Linux Camp teaches these topics as hands-on labs on real virtual machines, verified as you type.