Greg Kroah-Hartman discussed how Rust can aid in combating errors in the Linux kernel

Greg Kroah-Hartman, who is responsible for maintaining the stable and 'staging' branches of the Linux kernel and serves as a maintainer in 16 kernel subsystems, spoke at the Rust Week 2026 conference about how the Rust language can help prevent vulnerabilities in the kernel that arise from typical memory handling mistakes made by C developers, such as those related to memory management, locking, error handling, and dealing with untrusted data. The main advantage of Rust is said to be its ability to catch such errors at the build stage rather than through human code reviews. However, Rust is not seen as a panacea capable of solving all problems, and there are no plans to rewrite the kernel in Rust; instead, it is expected that Rust will be gradually integrated through its use for new drivers and subsystems.

As an example of kernel errors that could have been avoided with Rust, a Bluetooth subsystem issue that went unnoticed for 15 years and a problem in the Xen hypervisor were mentioned. In the first case, the developer dereferenced a pointer without checking it, while in the second case, a lock was forgotten in the error handling code.
According to Greg, most kernel errors are caused by such small oversights that accumulate over time and emerge as vulnerabilities. In Rust, many of these issues are prevented by the compiler; for instance, Rust abstractions for locks in the kernel allow access to internal structure pointers only after acquiring the corresponding lock, which is released automatically. Without acquiring the lock, accessing structure pointers in Rust is impossible.

Greg believes that such features of Rust could have prevented 60% of the errors identified in the kernel, and the checks performed by the compiler would save maintainers time discussing the correctness of error handling and the justification for placing locks properly. Moreover, the introduction of Rust support has already positively impacted the C code in the kernel by tidying up C code and interfaces, as well as adopting some development practices (for example, scoped locking has been implemented).

Thanks to the type system that ensures adherence to specified rules and the implementation of continuous integration systems that check code at the build stage, reviewers of changes in Rust can focus on evaluating the logic of operations rather than tracking manipulations with resources. The use of Rust also allows for a more careful approach to data coming from hardware or external systems. This is achieved through a clear distinction between trustworthy and untrustworthy data at the type system level: a developer only needs to perform an analysis when transitioning from an untrusted to a trusted state.

Recently, the team responsible for kernel security has been publishing about 13 vulnerability reports every day, which, compared to the previous dynamics of vulnerability detection, feels like some kind of madness (for example, 277 vulnerability reports in the kernel were published just yesterday). According to Greg, using Rust is one of the real ways to reduce the number of errors in the kernel caused by traditional mistakes in error handling and resource management. Support for Rust in the kernel has already gone beyond experimentation and was recognized as a standard feature of the kernel at the end of last year.

Play video


Source: opennet.ru
Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster