Microsoft is rewriting core Windows code in Rust

Martin Brinkmann
Apr 30, 2023
Updated • Apr 30, 2023
Windows 11 News
|
14

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.

Microsoft army goggles
Microsoft

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.

Summary
Microsoft is rewriting core Windows code in Rust
Article Name
Microsoft is rewriting core Windows code in Rust
Description
Core Windows components are rewritten in the memory-safe programming language Rust by Microsoft engineers.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. TelV said on May 1, 2023 at 2:47 pm
    Reply

    Actually, Microsoft along with Amazon, Google and Huawei is one of the founding members of the Rust programming language according to their site: https://foundation.rust-lang.org/members/

    So does this mean the whole Windows OS will ultimately be rewritten using Rust I wonder. Well, not completely since that would mean all Windows licenses would have to become available for free since Rust is open source software and Microsoft has never been an advocate of free software AFAIK.

    Still, it’ll be interesting to see how it develops.

    1. Anonymous said on May 2, 2023 at 10:55 pm
      Reply

      I don’t think that using an open-source language forces you to license your software as open-source. Just like writing some software on a linux machine doesn’t mean that the software has to be open-source.

      And anyways, https://www.rust-lang.org/policies/licenses says that it’s dual licensed, with one license being MIT, which allows sublicensing.

  2. Some Dude said on April 30, 2023 at 9:38 pm
    Reply

    I knew the Windows code was old, but it gives a different meaning to “code rust”.

    1. John G. said on May 1, 2023 at 2:25 am
      Reply

      A pretty joke, a must say!

    2. Anonymous said on April 30, 2023 at 10:38 pm
      Reply

      https://en.wikipedia.org/wiki/Windows_NT

      Windows NT 10 – July 29, 2015

      Is NT 10 ‘the last version’ everyone quotes Windows 10 to be? Windows version may change even if fully re-written in RUST but it remains NT10? That’s a bit like a vintage car with all pats except the number plate replaced {my favorite axe is over 100 years old. It only has two new heads and 10 new handles}.

      To the point, Windows 10/11 may be familiar to look at but if components keep changing, is it old code?

      1. John G. said on May 1, 2023 at 12:26 pm
        Reply

        @Anonymous, W11 should be NT 11. I don’t remember now the exact site I visited some time ago searching for one update of one driver for my first computer, however the site said that I was using W10 not W11, and the site offered the drivers for W10. I needed to refine the search by OS and then I finally found the exact driver for the W11. However, at first instance, the site offered the W10 version. Anyway I turn back to W10 so I don’t have this problem now.

  3. John G. said on April 30, 2023 at 11:10 am
    Reply

    Microsoft engineers = ChatGPT.

    1. Someone said on April 30, 2023 at 11:40 pm
      Reply

      ..Rust In Peace.

  4. John G. said on April 30, 2023 at 11:08 am
    Reply

    They have too much to rewrite. They are unable to rebuild a better W11 and they want to rewrite entire Windows. Drugs tests are needed before enter to their offices. Probably.

    1. Tom Hawack said on April 30, 2023 at 1:31 pm
      Reply

      Microsoft is rewriting core Windows code in Rust, but they’d “have too much to rewrite”? Maybe not with the help of ChatGPT? (LOL). Just makes me wonder if AI would ever be able to write the entire code of a browser, something like ‘ChatGPT Browser’, which would maybe yell at the user trying to tweak it “Hey, don’t touch me, I’m perfect, nothing to change!”.

      1. John G. said on April 30, 2023 at 6:48 pm
        Reply

        @Tom, LOL, indeed I meant that they have too much to rewrite in the most ironic words that I have been able to use, with no ofending terms. I think that Microsoft have too many things that can be rewritten, to be redone, to be painted, to be washed… As you see, I am more cautious, otherwise the comment would fly at high speed (LOL). :]

  5. Anonymous said on April 30, 2023 at 10:36 am
    Reply

    Prevent potentially exploitable code lol, but they created a huge security hole with all the webview2 nonsense inside the Windows shell.

    1. Anonymous said on May 1, 2023 at 12:38 am
      Reply

      Windows is like Humpty Dumpty. They will never be able to fix it without starting over from scratch.

  6. Saad said on April 30, 2023 at 8:17 am
    Reply

    Why reduced performance?!! :(

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.