Keynote: Rust in the Linux Kernel: A New Era for Cloud Native Performance and... Greg Kroah-Hartman

Greg Kroah-Hartman

KubeCon + CloudNativeCon Europe 2025 · Keynote

Overview

In a compelling keynote at KubeCon EU, Greg Kroah-Hartman, a venerable Linux kernel maintainer and developer, illuminated the ongoing integration of the Rust programming language into the Linux kernel. The talk, titled "Rust in the Linux Kernel: A New Era for Cloud Native Performance and...", primarily focused on the profound security and maintainability benefits that Rust brings to the world's most pervasive operating system. Kroah-Hartman articulated a vision where Rust's compile-time guarantees, particularly concerning memory safety and concurrency, can significantly reduce the class of vulnerabilities that have historically plagued C-based systems, thereby enhancing the overall robustness and security of the Linux foundation.

Watch on YouTube

Visual summary for Keynote: Rust in the Linux Kernel: A New Era for Cloud Native Performance and... Greg Kroah-Hartman by Greg Kroah-Hartman
Visual summary for Keynote: Rust in the Linux Kernel: A New Era for Cloud Native Performance and... Greg Kroah-Hartman by Greg Kroah-Hartman

Key moments

  1. 0:00 Greg Kroah-Hartman introduces Linux's core function and community
  2. 2:00 Demonstrating Linux's vast presence across billions of devices
  3. 3:00 Unpacking a typical C security bug in the kernel
  4. 4:00 C's new "guards" for automatic resource cleanup
  5. 5:55 How Rust's compiler catches bugs at build time
  6. 6:20 Rust prevents data access without proper lock acquisition
  7. 7:05 Rust's power in validating untrusted kernel input data

Keynote: Rust in the Linux Kernel: A New Era for Cloud Native Performance and...

Speakers: Greg Kroah-Hartman, Kernel Maintainer, Developer

Conference: KubeCon EU

YouTube: https://www.youtube.com/watch?v=kQ4X6-mPHqw

Overview

In a compelling keynote at KubeCon EU, Greg Kroah-Hartman, a venerable Linux kernel maintainer and developer, illuminated the ongoing integration of the Rust programming language into the Linux kernel. The talk, titled "Rust in the Linux Kernel: A New Era for Cloud Native Performance and...", primarily focused on the profound security and maintainability benefits that Rust brings to the world's most pervasive operating system. Kroah-Hartman articulated a vision where Rust's compile-time guarantees, particularly concerning memory safety and concurrency, can significantly reduce the class of vulnerabilities that have historically plagued C-based systems, thereby enhancing the overall robustness and security of the Linux foundation.

This shift is particularly pertinent for the cloud-native ecosystem, where the integrity and performance of the underlying kernel directly impact the reliability and security of containerized workloads, microservices, and vast distributed systems. By adopting Rust for new kernel components, the Linux community aims to mitigate critical security flaws at the development stage, reducing the burden on human reviewers and shifting vulnerability detection leftward in the development lifecycle. Kroah-Hartman emphasized that while C remains foundational, Rust offers a path to a more secure and efficient future for kernel development, promising a safer and more dependable platform for the trillions of devices and services that rely on Linux.

Background

▶ Watch: Greg Kroah-Hartman introduces Linux's core function and community (0:00)

The Linux kernel, the bedrock of modern computing, is an immense and complex project, boasting over 34 million lines of C code. For decades, C has been the undisputed language of choice for operating system development due to its low-level control, performance, and direct hardware access. However, C's power comes with significant responsibility: manual memory management, pointer arithmetic, and a lack of built-in safeguards against common programming errors often lead to critical security vulnerabilities. These include buffer overflows, use-after-free bugs, race conditions, and improper error handling, which can result in denial-of-service attacks, information leaks, or even remote code execution.

Kroah-Hartman highlighted the sheer scale of the Linux development effort, noting that the community, comprising "many thousands of kernel people" from "at least 355 different companies," processes an astonishing 76,000 changes per release, averaging "eight to nine changes an hour for the past decade." Each change undergoes an average of three reviews before acceptance, yet even with this rigorous process, vulnerabilities persist. The kernel averages "13 CVEs a day," though Kroah-Hartman was quick to point out this is "about half the size of number CVEs per day than the other operating systems." Despite this relative advantage, the constant stream of CVEs underscores the inherent challenges of writing secure, high-performance code in C at such a massive scale. The talk specifically pointed to examples of C code where developers forgot to check return values or to unlock resources, leading to exploitable bugs, some even fixed by interns and immediately receiving CVEs. These manual oversight issues, though seemingly simple, are extremely difficult to catch consistently across millions of lines of code and hundreds of developers.

Key Findings

▶ Watch: Unpacking a typical C security bug in the kernel (3:00)

The central finding of Kroah-Hartman's keynote is that Rust offers a compelling, practical solution to a significant portion of the security and maintainability challenges inherent in C-based kernel development. Rust's core design principles — particularly its ownership model, borrow checker, and robust type system — enable the compiler to enforce memory safety and concurrency guarantees at compile time, eliminating entire classes of bugs that are prevalent in C.

Key findings presented include:

  1. Compile-Time Security Guarantees: Rust's compiler can prevent a "huge majority of security issues at build time," rather than relying on human review or runtime detection. This shifts bug detection leftward, making development more efficient and secure.
  2. Enforced Error Handling: The Result type and ? operator in Rust mandate that developers explicitly handle potential errors, preventing critical oversights like failing to check return values, which were demonstrated as common CVE sources in C.
  3. Concurrency Safety: Rust enforces locking rules, ensuring that data protected by a lock cannot be accessed without first acquiring that lock. This prevents data races and other concurrency bugs that are notoriously difficult to debug in C.
  4. Memory Safety: Rust's ownership and borrowing rules eliminate common memory errors such as use-after-free, double-free, and buffer overflows (in safe Rust code) by preventing invalid memory access.
  5. "Fail Safer" Mechanism: While Rust code can still crash (panic) due to logic errors (e.g., an off-by-one array access), it will typically do so in a controlled manner, leading to a system crash and reboot (a CVE) rather than a memory exploit that could allow an attacker to take over the machine. This dramatically reduces the severity of potential vulnerabilities.
  6. Improved Maintainability: Rust's strict compiler, coupled with its clearer syntax and explicit handling of complex operations, makes code "easier to understand, easier to review, and hopefully more stable over time." This reduces the cognitive load on maintainers, allowing them to focus on new features rather than hunting down subtle C bugs.

These findings collectively point to Rust not as a replacement for C, but as a powerful complement that can significantly bolster the Linux kernel's security posture and longevity.

Technical Deep Dive

▶ Watch: C's new "guards" for automatic resource cleanup (4:00)

Kroah-Hartman provided illustrative C code examples to highlight the pervasive nature of security vulnerabilities arising from manual resource management and error handling. One example involved a Bluetooth driver function that failed to check the return value of a parameter request. If the request failed, the code would proceed with invalid data, leading to a security bug and a CVE. The traditional C solution often involves complex goto statements for cleanup, where developers manually jump to specific labels to release acquired resources (like locks or allocated memory) before exiting a function. This pattern is error-prone; forgetting a goto or missing an unlock path is a common source of bugs.

He then introduced a recent improvement in C development for the kernel: scoped references or guards. By incrementing the supported C version, the kernel can now utilize features akin to C++'s Resource Acquisition Is Initialization (RAII). This allows developers to define "guards" that automatically perform cleanup actions (e.g., releasing a lock, freeing memory) when they go out of scope. Kroah-Hartman showed a diff where several lines of manual unlock code were removed, replaced by a guard that ensures automatic release. This makes the code "much cleaner" and simplifies review. However, he noted, "we still have to manually remember to grab the lock."

This is where Rust demonstrates a significant leap forward. Rust's ownership and borrowing system fundamentally changes how resources are managed. Every value in Rust has an owner, and when the owner goes out of scope, the value is dropped, and its resources are automatically freed. This eliminates the need for manual free calls and the associated errors.

Furthermore, Rust's Result enum and the ? operator elegantly address the error-checking problem. Instead of a function returning a raw integer error code that can be ignored, Rust functions that might fail return a Result<T, E>, indicating either success (Ok(T)) or failure (Err(E)). The ? operator allows developers to propagate errors concisely: if a Result is Err, the function immediately returns that error; otherwise, it unwraps the Ok value and continues. As Kroah-Hartman demonstrated, adding a simple ? to a function call in Rust "tells the compiler if there was an error here we'll return the error," effectively "forc[ing] the fact not only do we catch the error that we also looked at the return value." This means the compiler, not just a human reviewer, catches overlooked error handling.

For concurrency, Rust's approach to data races is revolutionary. It ties the lifetime of data to the lock that protects it. Kroah-Hartman presented a Rust example where the compiler "will force you to grab a lock before you can even access the member." If a developer attempts to access data protected by a Mutex without first acquiring the lock, the compiler will produce an error, preventing the code from compiling. This eliminates an entire class of concurrency bugs that are incredibly hard to reproduce and debug in C. Rust's borrow checker ensures that there can be either one mutable reference or many immutable references to a piece of data at any given time, preventing data corruption from concurrent access.

Finally, Kroah-Hartman addressed the critical difference in how C and Rust handle memory violations. In C, an off-by-one error in array access or pointer manipulation can lead to reading or writing arbitrary memory, potentially resulting in a memory exploit that allows an attacker to gain control of the system. In Rust, such an error (if it bypasses compile-time checks, e.g., in unsafe blocks or due to an incorrect index at runtime) would typically cause a panic, leading to a controlled program termination and a system crash. While still a bug and a potential CVE, Rust "will fail safer." The kernel will crash and reboot, but the attacker won't be able to take over the machine. This distinction is paramount for security.

The integration of Rust into the kernel is not just theoretical; "it's in the kernel today." While C still accounts for 34 million lines, 25,000 lines of Rust are already present, notably in "one of the new GPU drivers." This real-world adoption demonstrates the practical viability and benefits of Rust for critical kernel components, particularly where new development is taking place.

Demo / Proof of Concept

▶ Watch: Rust prevents data access without proper lock acquisition (6:20)

While Greg Kroah-Hartman's keynote did not include a live, interactive demonstration of Rust code running in the kernel, he effectively served as a "proof of concept" presenter by showcasing specific code snippets in both C and Rust. He provided direct diff examples of how C code could be improved with newer C features (like guards for scoped cleanup) and then contrasted these with Rust's inherently safer constructs.

For instance, he illustrated a common C security bug in a Bluetooth driver that failed to check a function's return value. He then presented how Rust's ? operator would enforce this check at compile time. Similarly, he used a conceptual Rust code example to demonstrate how the language's type system and borrow checker prevent direct access to data that is protected by a lock, forcing developers to acquire the lock first. These code-based comparisons served as clear, concise demonstrations of Rust's ability to prevent entire classes of bugs that are commonplace in C development, effectively acting as a static proof of concept for Rust's security advantages.

Defensive Implications

▶ Watch: Rust's power in validating untrusted kernel input data (7:05)

The integration of Rust into the Linux kernel has profound defensive implications for system administrators, cloud providers, and security professionals. The primary benefit is a significant reduction in the attack surface exposed by the kernel. By mitigating common memory safety and concurrency bugs at compile time, Rust-written components are inherently more robust against exploits that target these weaknesses. This means fewer critical vulnerabilities (like buffer overflows, use-after-free, and race conditions) making it into production kernels, leading to:

  1. Reduced Patching Burden: While CVEs will still occur, the severity and frequency of certain high-impact vulnerabilities should decrease in Rust-based kernel modules. This could translate to fewer urgent kernel updates and reboots, improving system uptime and reducing operational overhead for patching cycles, especially for cloud-native deployments where rapid patching can be disruptive.
  2. Enhanced System Stability: Rust's "fail safer" approach means that even if a bug leads to a crash, it's less likely to be exploitable for arbitrary code execution. This limits an attacker's ability to escalate privileges or take over a system, turning potential exploits into mere denial-of-service events (reboots), which are significantly less damaging.
  3. Improved Software Supply Chain Security: As more critical components are written in Rust, the overall security posture of the Linux distribution improves. This is vital for the software supply chain, as the kernel is a foundational dependency for virtually all software stacks. Organizations relying on Linux can have greater confidence in the integrity of their underlying infrastructure.
  4. Easier Security Audits: While not explicitly stated, Rust's enforced safety properties can make security audits more focused. Auditors can spend less time hunting for memory safety bugs in Rust code, allowing them to concentrate on higher-level logic errors or potential vulnerabilities arising from unsafe Rust blocks (which are explicitly marked and minimized).
  5. Faster Feature Adoption with Security: The ability to write new kernel features, especially complex ones like GPU drivers, with a higher degree of confidence in their security and stability means that innovation can proceed more quickly without incurring a proportional increase in security debt. Defenders can benefit from new functionalities knowing they are built on a more secure foundation.

Defenders should stay informed about which kernel components are being rewritten or newly developed in Rust. Prioritizing updates that include Rust-based modules for critical functionalities could offer an additional layer of security. Furthermore, encouraging the use of Rust for new development within their own organizations, especially for system-level code, can mirror the benefits observed in the kernel, fostering a broader culture of compile-time security.

Key Takeaways

  • Rust significantly enhances kernel security: By enforcing memory safety, concurrency rules, and proper error handling at compile time, Rust prevents entire classes of vulnerabilities common in C, reducing the attack surface.
  • "Fail safer" is a critical advantage: Rust typically leads to a controlled crash (panic) rather than an exploitable memory corruption, mitigating the severity of bugs from potential system takeovers to reboots.
  • Improved maintainability and developer efficiency: Rust's strict compiler reduces the burden on human reviewers, making code easier to understand, maintain, and contribute to, freeing up maintainers for more impactful work.
  • Rust is already in the Linux kernel: With 25,000 lines of Rust code and new components like GPU drivers being written in it, Rust is a practical and growing part of the kernel's future.
  • A long-term strategy for Linux's resilience: The adoption of Rust is seen as crucial for ensuring the Linux kernel's security and maintainability for the "next 30 to 40 years," adapting to modern security challenges.
  • C remains foundational but benefits from Rust's influence: While Rust won't replace the millions of lines of existing C code, its integration forces a re-evaluation and enforcement of rules on existing C APIs, indirectly improving their quality.

About the Speaker(s)

Greg Kroah-Hartman is a highly respected and influential figure within the Linux kernel development community. Known simply as "Greg" to many, he serves as a prominent kernel maintainer and developer. His extensive contributions span various critical subsystems, including USB, PCI, driver core, and the stable kernel tree, making him one of the most prolific and essential contributors to the Linux project. His role involves reviewing and integrating vast numbers of patches, guiding new developers, and ensuring the long-term stability and security of the kernel. His insights are particularly valuable given his deep, decades-long experience with the intricacies of C-based kernel development and the challenges of maintaining such a massive, globally distributed open-source project.

Reviews

Dr. Zero (Offensive Security Researcher) — MUST SEE

Greg Kroah-Hartman delivers a critical keynote outlining the strategic integration of Rust into the Linux kernel. This isn't just 'AI-powered' marketing fluff; it's a deep, authoritative dive into how Rust's compile-time guarantees directly address the pervasive memory safety and concurrency vulnerabilities that have plagued C-based kernel development for decades. Kroah-Hartman, with unparalleled credibility, provides concrete examples, demonstrating how Rust fundamentally shifts security leftward, promising a more robust, stable, and defensible foundation for the entire cloud-native ecosystem. This talk is a definitive statement from the highest authority on the future security posture of…

Heather Calloway (CISO) — STRONG ACCEPT

Greg Kroah-Hartman's keynote on Rust in the Linux kernel is a critical signal for any CISO or security leader. It articulates a fundamental, pragmatic shift in how the bedrock of our digital infrastructure is addressing systemic security flaws. This isn't about 'best practices'; it's about engineering a safer foundation at scale, directly impacting our long-term resilience and significantly reducing the classes of vulnerabilities we've battled for decades in C-based systems. It demonstrates clear risk ownership and a deep understanding of institutional challenges.

→ Top-rated talks at KubeCon + CloudNativeCon Europe 2025

All talks from KubeCon + CloudNativeCon Europe 2025