Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Microsoft discloses Rust framework for Windows drivers

pwillypwilly Member Posts: 31

Interesting move from Microsoft (after Linux did this already a while ago).

GitHub Repository

Translated from German with DeepL.com from https://golem.de/news/entwicklung-microsoft-legt-rust-framework-fuer-windows-treiber-offen-2309-177932.html

After internal experiments with Rust, Microsoft now apparently wants to encourage its partners to use Rust for drivers.

Microsoft has published a very extensive repository with numerous individual projects as open source on Github, which should enable the development of Windows drivers in the Rust programming language. According to the description, the work comes from the Surface team, i.e. Microsoft's hardware department. It can therefore be assumed that Rust drivers are already used for Surface devices or are at least planned.

Specifically, the projects are about Rust packages (crates), with which the usual driver models WDM and WDF can be implemented, i.e. also kernel and user mode drivers. System services (Win32) should also be possible with it. The Crates cover above all idiomatic API connections to the Windows Development Kit (WDK), which support Safe Rust. In addition FFI connections, macros as well as libraries come to the Panic treatment, to the memory allocation or to the building and linking of the drivers themselves.

Already in the spring of this year Microsoft announced to rely on Rust for some important system components up to the Windows kernel. This is primarily to facilitate maintenance and ultimately also to increase security by being able to rely on Rust's security guarantees. Language bindings for the classic Win32 API for Rust have also been available for more than two years.

However, Microsoft does not want to officially support the work for Rust drivers presented now, nor does it want to recommend them for commercial use. It is rather an experiment to involve the community. For those interested, the company provides a sample driver that was created with the new Rust drivers.

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,160

    Thanks for bringing this to the attention of the community.

    For those who are interested, here’s a link to the (one) KMDF rust sample driver:

    https://github.com/microsoft/Windows-rust-driver-samples

    The possibility of Windows supporting Rust as a language for kernel mode development is an exciting one. Having a fully idiomatic Rust interface to the native Windows or WDF APIs would be a wonderful thing (and something we, here at OSR, have been asking for for years).

    Sadly, what’s been released (so far at least) on GitHub isn’t too encouraging. It’s completely unsupported… but, I guess that’s fair for now. Much worse is that the sample driver directly calls the standard WDF APIs by wrapping those calls in “unsafe” blocks. Thus, we don’t have an idiomatic native Rust API for writing Windows drivers. Rather, this project demonstrates how to use Rust to build a Windows kernel-mode module, and call the existing WDF APIs from Rust. Yay?

    While it’s certainly nice to see the very similar work that was done done years ago by the community brought up to date, it doesn’t give us much that’s new or exciting. Sigh!

    What we need is a dedicated effort, by a skilled development team, to build and support a new, native, idiomatic, modern language interface for Windows kernel mode development. I don’t much care anymore if that interface is Modern C++ or Rust. Given the sad lack of Microsoft investment in all things not AI or Azure, I unfortunately don’t see that happening anytime soon. Or, anytime at all, really.

    Our loss. Windows loss.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,754

    yeah, windows is pretty much 'done'. It will move forward only to be further locked down and to support newer hardware. It was a fun ride though.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,160

    windows is pretty much 'done'

    This.

    As a good friend of mine at Microsoft said to me a few weeks back "When was the last really meaningful app developed for Windows Server?" -- That REALLY made me think.

    And, the sad thing (for me, at least) is that there's no viable OS that's positioned to replace it. I had high hopes for Fuchsia for a while... now, not so much.

    Sorry for the digression into depression :-)

    P

    Peter Viscarola
    OSR
    @OSRDrivers

  • Jamey_KirbyJamey_Kirby Member - All Emails Posts: 461
    via Email
    I've been using Linux for my servers for years now. I find zero value in
    running a Windows server. The last Windows server I ran would get hacked
    monthly for spamming. It was a royal PITA to get things fixed. Several
    times, I had to get a new IP address because the one I was using would get
    banned by Google and other mail servers.

    Windows makes a great desktop, and I have many Windows apps I would hate to
    relearn in Linux. But for serving, you couldn't pay me enough money to run
    Windows.
  • Dejan_MaksimovicDejan_Maksimovic Member - All Emails Posts: 636
    via Email
    That was the sentiment I had in 2011 and thought I have to move to a
    different niche next year... still here 12 years later :)

    Win Server? Yeah, that is... dead :)
  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,754

    The last thing I use server for is to provide an AD domain and its associated DNS/DHCP. As everything else in my homelab is running in containers on linux vms, it is only a matter of time before I ditch that as well. That said, the no gui versions of server are pretty easy to set up and configure, are sized correctly instead of being massively bloated, and the web based Windows Admin Center provides most of what I need to keep them running.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,836

    yeah, windows is pretty much 'done'.

    Yes, but isn't that a Good Thing? People don't buy an operating system in order to run the operating system. People buy an operating system in order to run the applications they need to be productive. That wasn't necessarily the case in the early years, but it's certainly true today. The operating system is irrelevant, and browsers have made it even more so. The fact that a large majority of home users and even most corporate users could be perfectly happy using a Chromebook that doesn't even EXPOSE an operating system should be an eye-opener.

    What is Microsoft's business case for making radical changes to Windows? It does what it needs to do. Thanks to Linux, operating systems now have net value of approximately $0. Almost nobody buys Windows any more. You get a license with your new laptop, and you get free upgrades from then on. Windows only makes up 12% of Microsoft's net income.

    You could argue that Excel drove sales of Windows in the early 90s, but no application developer today is going to exploit a cool Windows feature if it makes his application Windows-only. The world has changed.

    Tim Roberts, [email protected]
    Software Wizard Emeritus

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,160

    The last thing I use server for is to provide an AD domain

    You need to migrate to Azure AD. We even did that here at OSR, oh, some number of years ago (waaay before the pandemic).

    Thanks to Linux, operating systems now have net value of approximately $0. Almost nobody buys Windows any more.

    Well. Yes and no. From a "desktop and server" perspective, maybe. But there's a TON of Windows that's still being used in embedded environments, like medical equipment. And defense/intelligence related stuff. And, what mystifies me is that it seems like MSFT is doing all they can to annoy/prevent/disempower these exact uses of Windows.

    Also, even when the apps are actually running on Azure VMs, there's still SOME serious pull for people to run stuff under Windows Server. Thank goodness. I mean, we just did a sizeable, super complex, project for an FPGA vendor that had Linux support but also had major customers that needed Windows Server support.

    So... yeah... "it's not dead yet"... but certainly on its way out.

    P

    Peter Viscarola
    OSR
    @OSRDrivers

  • Gregory_G._DyessGregory_G._Dyess Member - All Emails Posts: 386
    via Email
    Peter,
    I will second your observation about the embedded Microsoft world.   The last version of a Windows Embedded product was in 2013, unless you count the aborted attempt at Windows 10 IoT.  With Windows 10, Microsoft went to their "Unified Architecture" for drivers which killed it in the embedded world.  It was way to heavy, especially with KMDF, UMDF, EIEIODF, dejourDF, etc.  Embedded systems need to be lightweight and deterministic (not necessarily fast).  The UA simply could not do that.  I used to make my living with Windows Embedded series, but not since several years ago.  I did some work in Windows Embedded NDIS drivers last year and regretted it immensely.  I'm entirely Linux now.

    Microsoft ceded the embedded world to Linux, just like they really ceded the entire supercomputing world to Linux. 

    What market are they really trying to target Windows to?  Enterprise servers and Enterprise desktops seem to be their only niche in the middle.

    Not to try to steer this back to the original topic, but the Linux kernel is getting some rusted components now.  I had hoped Torvalds would have held the line against this as he did for C++, but oh well.  Time for me to learn new tricks and how to mitigate the bloat/damage.

    Greg


    On Tue, 26 Sep 2023 19:29:15 +0000 (UTC), "Peter_Viscarola_(OSR)" wrote:

    OSR https://community.osr.com/

    Peter_Viscarola_(OSR) commented on Microsoft discloses Rust framework for Windows drivers

    > The last thing I use server for is to provide an AD domain

    You need to migrate to Azure AD. We even did that here at OSR, oh, some number of years ago (waaay before the pandemic).

    > Thanks to Linux, operating systems now have net value of approximately $0. Almost nobody buys Windows any more.

    Well. Yes and no. From a "desktop and server" perspective, maybe. But there's a TON of Windows that's still being used in embedded environments, like medical equipment. And defense/intelligence related stuff. And, what mystifies me is that it seems like MSFT is doing all they can to annoy/prevent/disempower these exact uses of Windows.

    Also, even when the apps are actually running on Azure VMs, there's still SOME serious pull for people to run stuff under Windows Server. Thank goodness. I mean, we just did a sizeable, super complex, project for an FPGA vendor that had Linux support but also had major customers that needed Windows Server support.

    So... yeah... "it's not dead yet"... but certainly on its way out.

    P
  • MBond2MBond2 Member Posts: 708

    IMHO Windows server is far from dead. Well written server applications can perform substantially better on Windows than on anything else. They are not the fancy shiny things that people go after, but they make money for business that rely on them.

    In terms of new development, what feature do you think they should add? That was the big idea with Windows 10 - that the OS is essentially complete, and only new service packages are needed. No fundamentally missing or incorrect features. The focus no longer being on the OS itself, but on what you do with it. So called AI programs (which are not intelligent), cloud applications, containers and a focus on small systems of every kind. The hardware guys are doing it too. When was the last new Xeon platinum processor released and what's on the roadmap in that area? On the other hand, 100Gb/s Ethernet is becoming common

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 9,160
    edited September 2023

    In terms of new development, what feature do you think they should add?

    Seriously? Where should I begin?

    How about fixing the storage stack, so that out-of-the-box performance doesn't suck. A modern storage stack would be, you know, sort of a nice thing to have.

    Next how about a bunch of updates to WDF to actually finish it properly. I mean, it's been what... 15+ years now? As much as I love WDF (and I do, I do, I really, really do) I'm sure nobody thinks it's fully fleshed-out and perfect. It could also use some perf improvements.

    Then we can move on to the topic of this thread: A modern interface for driver development... like Rust or Modern C++. That would be nice.

    Oh, and while we're hoping for the unattainable: How about a modern method of interprocess communication? Something that's just a BIT newer than COM, and not just one guy's clever idea that's only sort-of supported and gets effectively abandoned before anybody uses it. I do NOT understand how, in 2023, the only interface to ALPC (for example) is the venerable Microsoft RPC (oh, but I KNOW... it's OSF DCE/RPC compliant, because in 2023 that's a major thing). Never mind actually having a modern RPC that has modern security concepts and is agnostic regarding whether the client and server are co-located.

    I could go on... but doing so would just depress me even more.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • MBond2MBond2 Member Posts: 708

    Peter

    There certainly are some things that could be added to Windows, but the ones you highlight seem odd choices.

    Saying that COM is bad is easy until you think about what you might replace it with. The same is true with the storage stack - the only really obvious thing is the file system cache policy - which isn't even part of the stack proper. It would be nice if there was support for NVMEoFC because the vendors' drivers suck, but most vendor supplied driver suck

    But what about better support for NUMA and asymmetric multiprocessing (performance cores versus efficiency cores)?

    There is more too, but hankering after the new old thing if a fools errand. Rust and C++ fall into this category. C# on the other hand wouldn't IMHO

  • rob18767rob18767 Member Posts: 74
    edited October 2023

    @Tim_Roberts said: Thanks to Linux, operating systems now have net value of approximately $0.

    Yes and companies have to share their source code for kernel mode drivers under the GPL license. Sharing a binary is fine but source code?

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,836

    You seem to be implying that's a bad thing. Sharing the source puts more eyes on the code and reduces the errors. With some exceptions, the drivers are not where the intellectual property is.

    Tim Roberts, [email protected]
    Software Wizard Emeritus

  • rob18767rob18767 Member Posts: 74

    @Tim_Roberts said:
    You seem to be implying that's a bad thing. Sharing the source puts more eyes on the code and reduces the errors. With some exceptions, the drivers are not where the intellectual property is.

    On a personal level I could not agree more.

    However it is still the case that companies go to a lot of effort to hide as much of their product as possible from the eyes of competitors. This is a big selling point for Windows.

    For example:

    https://linux.slashdot.org/story/02/11/05/0051225/gpl-issues-surrounding-commercial-device-drivers

  • MBond2MBond2 Member Posts: 708

    I'm not sure that the conclusion that there is nothing worth copying in driver software is true. In the last 20 or so years since the bulk of the windows driver model has stabilized there have been multiple times when commercial advantage has been possible from better algorithms. Think about the MAC overloading that Intel Proset did, the first generation of MPIO and the pre-NVMe modules. The crashes caused by bad broadcom modules was an opposite case, but still important.

    Will there be something new again? Probably. But probably not RUST I think

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online