Windows drivers in Rust for more freedom and security
The Microsoft team recently published Rust components for Windows driver development on GitHub. The goal of this surprising initiative is safer and more reliable Windows drivers.
Microsoft has taken an exciting step to improve the security and reliability of Windows drivers. The Surface development team recently unveiled a set of Rust packages called “crates” on GitHub. These crates are open source and allow developers to write Windows drivers using the Rust programming language. Especially interesting is the fact that Microsoft itself has published these tools.
The Rust crates allow programmers to create drivers that are compatible with the Windows Driver Model (WDM) and Windows Driver Frameworks (WDF) in both user and kernel modes. They also extend their support to W32 services, providing a comprehensive solution for driver development. From creating system services to working at the kernel level to approaching hardware components, these Rust packages provide developers with a versatile platform.
Gather feedback from the developer community
First of all, it is important to mention that this initiative is primarily an experimental test project. Microsoft aims to encourage experimentation and discussion in the developer community. It is not currently intended for commercial use.
Currently, the six packages available on crates.io only support the Kernel Mode Driver Framework (KMDF) version 1.33. However, the project maintainers have indicated that other bindings can be generated. Interested developers can import the project’s GitHub repository and configure it in the build.rs file in the wdk-sys folder. In the future, the team plans to extend the compatibility of the project to include other versions of the Windows Development Kit (WDK).
What distinguishes these Rust crates is their ability to bridge the gap between Rust and the Windows Development Kit and provide a Foreign Function Interface (FFI) to the Windows APIs in the WDK. To work with these tools, developers need LLVM, Cargo Make and an installed Windows Development Kit for more freedom.
Motivation to integrate Rust into Microsoft system core
On a related note, Microsoft’s hardware division has already taken the initiative to rewrite sample drivers in Rust. This shows Microsoft’s commitment to integrating Rust into its system core. A move that has already begun in 2020. The motivation behind this transition, as stated by Microsoft, is to pursue higher security without compromising performance.
In summary, Microsoft’s release of Windows driver development tools based on Rust holds out the prospect of a more secure and reliable Windows driver ecosystem in the future.
Source: heise.de