Microsoft is exploring the use of the Rust programming language for developing Windows drivers. This initiative is evident from a recent tweet by Mark Russinovich, CTO of Azure, and the release of a GitHub repository dedicated to Windows driver development in Rust. The repository is a collection that enable developers to create Windows drivers using Rust, supporting both WDM and WDF driver development models.
Working towards enabling Windows driver development in Rust: https://t.co/XQHpdsFbwW
— Mark Russinovich (@markrussinovich) September 23, 2023
Aiming for Safer Code
The shift towards Rust is driven by the language's reputation for memory safety, which is crucial in preventing several common vulnerabilities. Rust achieves this by managing memory at compile time, eliminating a class of bugs that can lead to security vulnerabilities. “Exploring Rust for Windows drivers,” tweeted Mark Russinovich, shedding light on this strategic move. This exploration aligns with Microsoft's previous unveiling of a Rust-based Azure Quantum Development Kit, indicating a growing trust in Rust's capabilities.
Repository Details and Community Engagement
The GitHub repository, named windows-drivers-rs, is described as a platform that enables Windows driver development in Rust and has been developed by Surface. It contains several crates, including wdk-build, wdk-sys, wdk, wdk-panic, wdk-alloc, and wdk-macros, each serving different purposes in the driver development process. The repository is still in the early stages of development and is not recommended for commercial use yet. However, Microsoft encourages community experimentation, suggestions, and discussions through their GitHub Discussions forum.
The adoption of Rust for such significant projects underscores Microsoft's confidence in the language's safety features. The crates in the windows-drivers-rs repository currently support KMDF v1.33, but support for other WDK configurations is planned in the near future. The project aims to support WDM, KMDF, and UMDF drivers, as well as Win32 Services, and includes support for all versions of WDF included in WDK 22H2 and newer.