Microsoft is rewriting core Windows code in Rust
Core Windows components are rewritten in the memory-safe programming language Rust by Microsoft engineers, according to David Weston, Enterprise and OS Security Vice President at Microsoft.
Weston revealed the change during the BlueHat IL 2023 conference. Microsoft engineers replace C++ code with Rust. Windows could soon boot "with Rust in the kernel" stated Weston, who suggested that this could happen in the next couple of weeks or months already.
Microsoft has shown interest in the Rust programming language, especially because of the languages security features that are designed to prevent code that could potentially be exploited.
Broken down to its core, Rust is an easier to learn language that benefits from strong features that prevent common forms of attacks against the programs and services that have been created in the programming language.
Microsoft's main goal at this point was to "convert some [..] internal C++ data types into their Rust equivalents" according to Weston. About 36,000 lines of Rust code are now part of the Microsoft Windows graphics device interface, Win32 GDI. A recent Windows 11 version with the Rust components included booted without major issues and passed all GDI tests.
Microsoft ran benchmarks and performance tests to test the code against the non-Rust version, and no major performance regressions were detected during these tests.
The Rust part is not enabled by default for customers who use the operating system. Microsoft may use a controlled roll out in the coming weeks or months to test the functionality on a wider set of devices. Eventually, the company will enable the Rust parts for all customers who run Windows 11.
It is too early to tell how beneficial the integration will be in the short run. The converted parts will likely be more secure against potential exploits and if this initial launch is promising , will likely result in more code being converted from C++ to Rust.
For Rust, it is a major push in the right direction. Microsoft's commitment to Rust could improve general and developer tooling support.Advertisement