Follow us
Breaking
Tech News

Zig and Rust fight for kernel control

Developers weigh Zig's performance against Rust's memory safety for Linux kernel modules. While Zig showed faster AWS Graviton3 benchmarks, the creator of Bun recently migrated a million lines of Zig code to Rust to resolve growing use-after-free bugs.

Share

The Rust mandate

Rust is the standard for Linux kernel subsystems. The 2025 Kernel Maintainer Summit in Tokyo removed its experimental status. Android 16 released in late 2025 used Rust for the ashmem allocator. Debian will require Rust for APT infrastructure starting in May 2026. These deployments showed that Rust safety reduces memory vulnerabilities. You know the memory management headaches in C. Rust integrates with Kbuild through bindgen to create Foreign Function Interface definitions from C headers. This automation helps the kernel match its C types to Rust types. The progress of the gccrs project aims to allow the kernel to build with the GNU toolchain. The 2025 State of Rust Survey reported that 91.7% of respondents currently use Rust, with 46% using it as their primary professional language. Rust moved to number 10 in the July 2026 TIOBE Index.

Zig stays out-of-tree.

The Zig insurgency

Developers use the zig cc command as a compiler driver to trick Kbuild. This method involves setting the CC environment variable to a target like x86_64-linux-gnu. This allows them to use C headers directly with @cImport. The January 2026 discovery of the VoidLink rootkit, a kernel-mode framework targeting cloud environments, showed that malware authors use Zig to produce tiny binaries and perform easy cross-compilation for real-time adaptation. This malware used the ability to generate kernel modules on-the-fly to adapt to specific kernel versions.

Feature Rust Zig
Memory Safety Borrow checker Manual allocators
C Interop bindgen @cImport
Build Tool Cargo zig build

Technical divergence

Rust relies on a borrow checker to enforce ownership rules and verify that references remain valid. This prevents use-after-free errors at compile time. The kernel crate provides safe abstractions for common tasks through the module! macro. In May 2026, the creator of the Bun runtime used Claude coding agents to translate a million lines of Zig code into Rust in just 11 days. This migration happened because the Zig engine accumulated use-after-free bugs that grew harder to contain as the codebase expanded. A backend benchmark on AWS Graviton3 showed Zig finished in 18 seconds, while Rust took 42 seconds. However, Sharkbench measured Zig completing a workload in 1.00 second and Rust finishing in 1.02 seconds.

It works.

Zig handles memory.

Will the kernel maintainers eventually permit Zig to enter the mainline build system?

Share

Technewsdaily

Senior tech writer covering AI, gadgets and cybersecurity. Breaking down the news that matters, every day.