Microsoft is progressing further in its adoption of the memory-safe Rust programming language by enabling the development of Windows hardware drivers in Rust. This move allows developers to transition away from the unsafe C and C++ languages.
According to Microsoft Technical Fellow and Azure CTO Mark Russinovich, the company is working towards enabling Windows driver development in Rust. Russinovich shared a GitHub repository created by Microsoft that facilitates Windows driver development in Rust.
The repository consists of Rust crates designed to support the development of Windows drivers in Rust. It intends to provide assistance for both Windows Driver Model (WDM) and Windows Driver Frameworks (WDF) driver development models.
This development follows Microsoft’s previous announcement in April regarding its plan to rewrite key parts of the Windows kernel in Rust. Later, the company showcased the first live code in a Windows Insider Program build of the operating system. Microsoft has been exploring the use of Rust for several years as a replacement for legacy C/C++ code with enhanced safety and security.
Rust is an excellent choice for these purposes. It compels developers to write secure code that effectively handles memory, minimizing the risk of malicious attacks. Addressing memory vulnerabilities is crucial as they account for approximately two-thirds of all security vulnerabilities.
Although it is impossible to completely eradicate C/C++ code from the internet due to its extensive usage, transitioning such code into maintenance mode and gradually replacing it with safer Rust code is a logical step. While most user-mode code in Windows is written in C++, and most kernel code is in C, Microsoft recognizes the benefits of leveraging Rust for enhanced security and reliability.
By embracing Rust, Microsoft is aligning its approach with that of the Linux kernel maintainers and Linus Torvalds. Rust’s emphasis on memory safety significantly reduces the chances of coding errors that can be exploited. This shift towards safer languages reflects the industry’s growing awareness of the need for enhanced security measures.
Overall, Microsoft’s embrace of Rust is a progressive step towards creating a more secure and resilient software ecosystem. Transitioning to Rust for Windows driver development contributes to the company’s goal of minimizing vulnerabilities and ensuring safer computing experiences for its users.