December 8, 2023

Microsoft’s embrace of the memory-safe Rust programming language continues, with the software program big taking the primary steps down an all-new path: It’s enabling the event of Home windows {hardware} drivers in Rust in order that builders can lastly transfer off of the unsafe C and C++ languages.

“[We’re] working in the direction of enabling Home windows driver growth in Rust,” Microsoft Technical Fellow and Azure CTO Mark Russinovich revealed on Twitter. He then linked to a GitHub repository created by Microsoft that enabled Home windows driver growth in Rust.

Home windows Intelligence In Your Inbox

Join our new free e-newsletter to get three time-saving suggestions every Friday — and get free copies of Paul Thurrott’s Home windows 11 and Home windows 10 Discipline Guides (usually $9.99) as a particular welcome reward!

*” signifies required fields

“This repo is a set of Rust crates that allow builders to develop Home windows drivers in Rust,” the repository’s readme notes. “It’s [our] intention to help each WDM [Windows Driver Model] and [the higher-level] WDF [Windows Driver Frameworks] driver growth fashions.”

Microsoft introduced that it might rewrite key components of the Home windows kernel in Rust again in April, after which it adopted up with the primary dwell code in a Home windows Insider Program construct of the OS a month later. However the agency had been investigating this risk for years, with a watch on changing legacy C/C++ code with one thing extra secure and safe. In 2022, for example, Mr. Russinovich declared that “it’s time to halt beginning any new tasks in C/C++ and use Rust for these situations the place a non-GC [garbage-collected] language [like C# or Java] is required. For the sake of safety and reliability, the trade ought to declare these languages as deprecated.”

Effectively, it seems to be like Microsoft is taking that recommendation significantly. And Rust is a superb alternative: As I wrote in Small Bytes: Rust (Premium), Microsoft is embracing the language for a similar causes that Linus Torvalds and the opposite maintainers of the Linux kernel are as effectively. Rust forces builders to write down secure code that can’t improperly deal with reminiscence, a key avenue of assault for malicious hackers and the underlying reason for about two-thirds of all safety vulnerabilities.

After all, C/C++ code is so pervasive all through the Web that we’ll by no means eliminate all of it—in Home windows, most user-mode code is (or no less than was) C++ whereas most kernel code is C, based on Microsoft’s Raymond Chen—however shifting this code into upkeep mode is sensible. As does changing it, the place potential, with safer Rust code.