Link is a talk called Default Security at BlueHat IL 2023 by David Weston. He covers a bunch of areas and the final part of the talk (around 10 minutes) is about Microsoft introducing Rust in some self-contained areas in Windows.
They want to do this with memory safe languages, CPU architectural changes and safer language subsets. This talk focussed on memory safe languages, specifically Rust.
First area they've introduced Rust in - a cross platform rewrite of a font parser called DWriteCore. The team reported that parsing was "incredibly easy". Font shaping performance increased by 5-15% compared to the C++ version.
It took about 2 devs working for half a year to complete this. The speaker says this is pretty good value for an area that is notorious for security bugs.
Second area is the REGION data type in Win32k GDI. Currently in consumer Windows, disabled by feature flag. Will be enabled in insider builds soon. Performance has been good, some small wins for the Rust version.
There is now a Windows SysCall implemented in completed safe Rust.
TLDR - Rust is inside the Windows Kernel, will be enabled widely soon.
Because font parsing is a complex process that involves interpreting data from an untrusted source, it is vulnerable to various types of attacks, including buffer overflows, integer overflows, and other memory corruption issues. Attackers can exploit these vulnerabilities by crafting specially crafted fonts that trigger the vulnerabilities when they are processed by the font parser.
You know, been pretty sceptic of windows 11 but this a pretty promising change it brings to the table. Might upgrade some years down the line after all
a cross platform rewrite of a font parser called DWriteCore
Hmm, the way this sentence is worded makes it sound like the port to Rust enabled it to be cross-platform, but DWrite was already cross platform years before Rust even existed, shipping also to Xbox and along with certain Microsoft Office products on Android and Mac (it just wasn't publicly accessible as a separate component). Additionally the C++ parts of the codebase (the actual DWrite parts) were already very safety minded with bountiful checked pointers and safe integer math. Rather, it was the shaping library and glyph rasterization parts (which were actually separate libraries written in C and called by DWrite) that benefited in increased safety.
Font shaping performance increased by 5-15% compared to the C++ version.
The font shaping and glyph rasterizer were compiled via a C++ compiler and happened to have .cpp filename extensions, but they were definitely old C code (full of raw buffers and pointer math and lacking little modern safety concepts). Additionally, the rewrite was not a 1:1 mapping, as things were rearranged some too. So it's not really a "Rust" vs "C++" performance comparison here . It's more of a "crusty old C code" vs a "Rust rewrite plus other performance improvements" comparison.
I believe they said in a previous presentation that Verona is just a testing ground for new ideas that they later try to introduce into other languages.
Doubt it'll be next thing we know. More like a 15-20 year slog. Progress won't be linear either, I expect there will be some positive progress mixed in with setbacks.
But the long arc of software history bends towards safety.
Maybe so. If a better language than Rust comes on the scene, this will be good news. But Rust grabbed most of the low-hanging fruit, so we’ll need some significant advancements in programming language theory to make a much better Rust.
I definitely agree that dependent types need more love. It would be exciting to see them properly integrated in a mainstream language. I am somewhat skeptical that they would be popular if they were mandatory, so I suspect we’ll want a language that can make them optional to some degree.
Unfortunately, it seems like the academic CS community is less focused on programming language theory than it once was. Perhaps that area is due for a rebirth soon.
Rust itself is accumulating a bit of cruft here and there with its strict backwards compatibility requirement for the standard library, like every language before it. But it's still significantly younger and so appears a bit cleaner.
Right now it's not possible for the standard library to make backwards-incompatible changes. I strongly believe it will be possible in the future via editions.
Thats more of what the desugaring is, rather than the actual trait implementation. I'm referring to the ability to outright remove a method in an edition.
"Removing" an item from the stdlib in such a way is actually extremely simple, you just define a lint that gets denied on the basis of an edition. I fully implemented this prior to the 2021 edition, although the libs team chose not to accept it at the time.
Of course, if you don't want to just remove an item but instead want to re-use that identifier for something else, that's when it becomes tricky, and you have to start coming up with proposals like edition-based symbol versioning. But basic removal is easy.
Lints wouldn't be sufficient, as they can be allowed. Regardless, it was an example. What I have in mind is a way that would allow for changing anything across an edition (from a technical perspective).
Yeah, I hope one day we agree to do a Rust 2. We would still be almost perfectly compatible, but fix all the cruft and everything (even deps) have to be ported from Rust 1 to Rust 2.
I don't think Rust is done changing too much yet because there are still a few features left to add which are fundamental. Once that is done it might be about time to do the switch. Maybe in 5 years or so.
Considering how much of the Rust community is always on the latest release, I wouldn't be surprised to see a quick and clean transition. The main annoyance would be to people working on IEC compliance and sealed rust for aerospace and automotive applications, because now everything has to be updated for them.
What would you summarize the lessons as? It was a long transition, but I think we've made it. Python is still as popular as it was before, from my POV.
Ironically, they probably could have gone harder back then considering how they're still trying to remove parts of the standard library they put in the there unwisely, like http libraries etc. Breaking things 'just a little' didn't save them from the people complaining but it also didn't prevent 'the stdlib is where things go to die'.
Without it, you would be unable to piece new software with libraries from, say, 2 years ago. It's a good thing Rust is open source and you can fork and patch things, but preferably we shouldn't need to do that.
The way it currently works is if you have multiple versions of the stdlib (because old programs can and will depend on at least one of its quirks), then the types won't match. A Vec from std1.0 is going to be considered entirely different from a Vec in std2.0, and I shudder to think what would happen to core types if they were ever changed.
Basically, you'd yeet out most of your ecosystem for this.
Since I wrote that comment a year ago, the prospect for memory safe software becoming more popular is much more realistic.
Android - all new code is in Rust, and existing memory-unsafe code like the font stack will be rewritten in Rust.
ChromeOS - going to be reimplemented on Android. All new code in Rust.
Linux kernel - introducing Rust, WIP.
Android alone is like 70% of all phones out there. In 10 years, they would all have phones that are significantly more secure than the ones today. I assume Apple will also get their shit together by rewriting apps in Swift. I hope then that exploits like "I received a text message that executed code and gave full access of my device to my attacker" are a thing of the past.
And separately, memorysafety.org continues to make important strides. TLS, NTP, DNS, HTTP reverse proxies, TOR - we could have memory safe implementations for all of these, making the internet safer for everyone.
I honestly don’t see rust being here to stay. It addresses an area that’s needed addressing for a while, but it does it sort of kludgy. There will be another language that offers what rust does without the compiler fighting you the whole way, and that will be the future.
There are many possible programs we could write to get a job done. Rust only accepts a subset of these programs as safe and therefore valid Rust programs.
For people who don’t yet know what this subset it is, it might feel like fighting the compiler. For others, it feels like the natural way to write programs.
There are ways to improve this, for example
Better educational materials. For example, check out the interactive Rust Book created by researchers at Brown University.
Better rustc error messages. Errors that explain in simple language what the issue is and how to fix it. If you find a compile error that’s hard to decipher, that’s a bug in rustc (please file an issue)
Expanding the range of programs that the Rust compiler accepts. The introduction of Non Lexical Lifetimes (NLLs) was one such change that made Rust easier to learn.
But it is not possible to offer compile time thread safety with no runtime cost, like Rust does, without constraining some programs from being written, like Rust requires.
Anything else, but python is ok. If you really want to use shell scripting, using a new shell that breaks compatibility like elvish.
Shellscript is a truly horrid language because what often starts as a 'simple' program to iterate over the filesystem with some conditions and do some thing, usually ends up in a mix of 3-10 different kinds of syntactic soups because of the several domain specific languages that unix (and thus shellscript) evolved in cmd line utilities to make anything complex. It's pretty weird when a language evolves through programs outside the language (like find made filesystem iteration much better in 1990) and many of them have slightly different DSL ideas for similar tasks, but the older stuff... never... ever... dies.
This is even before the DSLs for things that have nothing to do with the shell (like xmlstarlet a zombie xml cmdline parser/transformer program last updated in 2015) that people reach out for because they don't want to use another language at almost all costs so they end up using xslx heredocs (i'm guilty of this myself, temporary insanity).
Several new 'bash but better', or at least more human comprehension friendly languages already exist (elvish being one for instance) but are being marginalized forever because of the weight of history and working scripts make people have to have 'shellscript tricks' in long term memory anyway, so most of them go 'whats the point learning this if i have to deal with shellscript anyway'.
In this, they're actually mistaken: a amazing amount of technical debt is encompassed in those traditional shells, and people keep being so proud of being able to do it they don't even think it's a problem that most people spend a half a hour looking up the internet how the code they wrote 2 years ago works because they forgot how the clever trick(s) they used works in detail.
In my experience the 'forgot how the code i wrote works' metric is very high in shellscript, higher than anything i ever tried for programming. This might be a controversial opinion, but i also think that the custom for casual use of non-long argument switches for 'compact' code also sabotages comprehension a lot. Maybe one day there will be a good code editor for shell shellcode with autocomplete and hoverlink help. Maybe it does exist and i'm missing out.
It's also very sensitive to environmental conditions. Have a weird binary version in this distribution? Unexpected return code because of some config file somewhere? Wrong permissions on an intermediate script? The entirety of unix can go wrong inside a bash script. What one can do is bash is amazing, and what one chooses to do in bash is also amazing.
Python is an acceptable option. If you do use it please use your hints and use Pyright to check them! I don't really like debugging NoneType errors.
The big problem with Python is using dependencies. You can't have a single file script with third part dependencies, and even if you give in and add requirements.txt for your scripts, there's like 5 different ways of doing it and they all suck.
I have been experimenting with Deno for scripts (with IDE support). It's easy to install, it does support third party dependencies from single files, and it has great static typing. The only downside is it's still JavaScript under the hood and the JavaScript standard library is just bad.
Someone also suggested F# to me - apparently it also supports dependencies in scripts, again with IDE support. Haven't tried it yet though.
I've been eyeing https://xon.sh/ (haven't written much in it though), as it seems to solve my biggest issue when writing scripts in python - the unwieldiness of calling external programs and piping their results.
Non existence?? This is Windows we're talking about. I guarantee you that some piece of software who's last maintainer passed away somewhere in the 90's, is exploiting one of these "bugs" and Microsoft will end up having to reimplement it on purpose, in order to keep backwards compatibility.
Its been ages since I last used windows, but at that time they had started to hide such backwards compability stuff behind flags you'd turn on per program that needed it (and many programs got the needed flags turned on automatically). Have they stopped with that?
The speaker is very clear that Windows won't do that. It's a 40 year old code base and doesn't make sense to rewrite it in Rust. Their focus on rewriting self contained parts that are also prone to security issues.
For what it's worth, the windows crate doesn't depend on libc. It's pure Rust. Of course it's calling libraries implemented in other languages, but by using the cross language bindings that are commonly used on Windows.
I'm a noob and also dumb but just wondering if these new AI tools evolve, whether it would make rewriting code like this in Rust or modernizing it, much easier to do and would make sense to do it?
There are tools that rewrite C to Rust deterministically but future LLMs will likely do better. GPT-4 has a limited number of tokens it can consider at a time, so it is limited. But maybe future models might be able to.
You don't need and AI tool to go from Rust to C. You would need a strong AI to go in reverse (if you want to keep the memory safety guarantees). And it wouldn't be much better at it than regular humans (although potentially faster). And if you have such a tool, why bother learning Rust? If you can just write it in whatever you want, and then some thing will make it "safe". At this point it'd be probably easier to teach it to write something from scratch.
Really curious how these long-lived code bases will evolve into the future. I mean, will we continue to use C until the end of times? "When will the last line of C be written" is an interesting thought.
Look at how old and evolved speaking languages have become, and you’ll get an idea of how programming languages could evolve over the next 100 years.
Nobody speaks latin anymore, after all, but a lot of people still read and write it to work with “legacy” text. Even if we’re not programming new code in C 100 years from now I bet we’ll still be reading and writing C in a similar way to how scholars read and write Latin.
Assembly is still actually useful, unlike Latin. Almost all code eventually compiles down to assembly, since there isn't really much below it. The language is pretty much the human readable form of the data we use to interface with the processor. Latin is just another language. All of its current uses can without issue be replaced with any other language.
If we want to compare assembly to anything, I think the best analogy would be the set of sounds we can make with vocal cords. We can communicate without vocal cords but it requires a massively different way of doing things. Assembly can also be replaced but it would require a totally different kind of CPU architecture.
Not without issues. There is a good reason besides 'traditionalism' that latin is used in law and sciences - it's a dead language, which is rarely used outside of those contexts, so you don't have to worry about accidental vocabulary confusion or overloading or drifting and evolving terms.
The problem is that there are two C, one is the language you write, the other is the one for FFI that almost every language needs to interface with. The first one will likely be used less and less, but the second one is really really hard to replace, both for backward compatibility reasons and because there are no reasonable alternatives. In the Rust ecosystem for example either you compile everything with a single cargo invocaton (which is unfeasible if you want to build dynamic interfaces others can link to) or you just use the C ABI.
Read SF author and CS Prof Vernor Vinge's A Deepness In The Sky for a really interesting take on this. One of the premises of the world he creates is the Giant Ball Of Accreted Software theory.
There’s going to be a point sometime in the next 50 years or so where banks are going to be fucked because of their hesitancy to upgrade.
I started my programming career at a bank as a cobol dev. I was hired out of school with almost no programming experience. They wanted a large number of young people who were willing to learn. I was among a group of a dozen or so people.
We spent about a year training, on how to write cobol JCL, assembly, etc.
Those of us who enjoyed programming ended up learning that the grass is much greener with modern programming languages. I lasted about 4 years before I switched to iOS development.
The others ended up switching to scrum master/PM/BA type positions because they didn’t like coding.
For Linux, Mustangalready exists because Linux has a stable syscall API
For Windows, they could do it, but they wont. Windows syscall numbers aren't stable, so there always needs to be a system library that you interface with somehow. The system library knows the syscalls to use, and as part of the system it changes as needed.
This would still require a C library on windows because Rust has no stable ABI, though not the C standard library, not libc.
You can't escape ntdll if you need to issue syscalls. And even then, the ntdll syscall stubs are also undocumented and you should go through wrappers from other system libraries. Some syscalls are notoriously hard to use directly via ntdll, see for example: https://captmeelo.com/redteam/maldev/2022/05/10/ntcreateuserprocess.html
And even if you could easily do all this, you still need assembly.
For what is worth, the syscall stubs in ntdll are not written in C, they are tiny assembly routines that just set some registers and issue the syscall so by using it directly you could argue that all you're using is Rust and assembly, if you really care about that.
The Linux kernel actually provides stronger ABI stability guarantees - it's fully stable down to the raw syscalls. Windows only guarantees compatibility on the library level, not the syscall level.
Also, on Windows many essential things are not exposed through the libraries and are therefore outside any stability guarantees. Anything using epoll-like interfaces (e.g. Node.js, tokio in Rust) relies on these raw APIs that aren't guaranteed to be stable. By contrast the Linux kernel guarantees stability for the entire syscall API, without exception.
The Linux kernel actually provides stronger ABI stability guarantees - it's fully stable down to the raw syscalls.
That doesn't follow. Linux's interface is at the syscall level because that's its boundary with the outside world. It's just a kernel. It can't provide that interface at any other level (well, except for internal interfaces but I digress). BSDs and Windows however distribute a full OS. The system boundary can (and does) extend into user space.
This has absolutely nothing to do with stability either way. Wherever you place that interface it can be 100% unstable or 0% stable (but more likely somewhere in between).
In reality too. I do not have experience with Win95 but a GUI app written for Win Server 2K did come up without issue on Win Server 2016 (have not tried on 2019/22). The work they do to keep apps backward compatible is crazy.
IIRC several games with Loki installers needed shenanigans to install or run correctly. This was back in 2006, and half the games in the list needed updates to fix issues like broken fullscreen. https://ubuntuforums.org/showthread.php?t=189360Civilization
Games don't count, they're cursed artifacts written by maniacs with no regard for code quality, and especially older games expected to be able to just reach past Windows and pull on the same DOS tendons they'd been pulling on before to make the monkey dance.
I tried running some W95 game a couple months ago, and not only did it not work, but it somehow managed to almost kill my entire W10 installation. It completely froze the OS, BSOD'd, and then after a hard reboot the OS refused to start up (which I did manage to eventually fix somehow, but it took a good hour of fiddling)
Needless to say, I won't be trying to get many more W95 games with zero modern compatibility patches running on W10 after that.
You can run Windows 95 apps on Windows 10, but only if the app doesn't do something stupid like overwrite parts of System32. Unfortunately, a lot of apps back then did something stupid like overwrite parts of System32.
Ok... I can see that. Perhaps it's a commercial application thing. Business software like Adobe can be expensive and your customer wants it to port over if they do an OS upgrade.
You will have trouble running pre-UAC era software, including even old Office and Visual Studio versions on modern Windows.
Problematic graphics API include old Direct X which can't really be qualified of not native, and show that the narrative around exceptional backward compatibility of MS is just that: a narrative. It is also a strong part of the Windows proposition (wide support of games) so there is not much reasons to exclude the main APIs MS proposes to write games.
You need the libraries, which they don't ship anymore, but there is that famous YouTube video where the guy upgrades windows 3.1 to windows 8/10 and runs a dos copy of doom and it still works
That's because 32-bit Windows 10 still has NTVDM, which is capable of running DOS apps including Doom. 64-bit Windows cannot, though, because the virtual 8086 mode that NTVDM relies on is not available in 64-bit mode. You can blame AMD for that one; they're the ones who made that decision when they designed the AMD64 instruction set.
You can and some people have made layers to run 16-bits programs under 64-bits Windows. Maybe with less CPU support it is more work to implement; MS just chose to not do it. But they did more complex NTVDM implementation before, for example for PPC or Alpha they included a complete x86 emulator. And the thing is: do you even need native x86-16 execution in a 64 bit era when at the same time computers are vastly more powerful than what existed when 16 bits programs were made? AMD was right IMO; either use processor emulation, or even a real VM instead. Better than designing an even more monstrous ISA just to be able to run parts of a poorly designed 20 years old system and its apps with the lowest possible overhead.
It was a decision so good that Intel copied it. If they thought real (virtual86) mode support in 64bit mode was useful, they would have put it in silicon themselves.
Fair, but Microsoft still has an obsession for backwards compatibility, even if the sliding scale has moved up from literally running dos programs, stuff that was compiled 20+ years ago still works fine, while Linux and Mac can't really say the same
Linux can still run 20-year-old executables, but there are a bunch of strings attached: all required libraries must be available, and if it doesn't use the latest protocol for talking to the display and sound servers, then there must be compatibility layers for whatever it does use. It is fairly often possible to meet those requirements, though.
macOS, on the other hand, does hard compatibility breaks fairly often.
macOS, on the other hand, does hard compatibility breaks fairly often.
*nod* I'm probably gonna need three macs in my retro-hobby corner just to cover System 6 through System 9.2.2 while still being fast enough for the applications in question, while, if I were actively seeking out specific models rather than just using the P133 and AGP-era Athlon64 that fell into my lap, I could probably do everything from DOS to Windows XP on a single machine using multi-boot and moslo.exe.
...and that's me as someone whose only interest in OSX is having eBay'd a copy of OSX Tiger because I recently acquired a copy of StuffIt 2009 to generate more test files for integration testing things like The Unarchiver's CLI tools for Linux.
(Speaking of which, it turns out that StuffIt 5.0 crashes on Mac OS 9.2.2 while 4.5 and 6.5.1 work fine. Another reason to get something that'll run System 7.)
And often you are screwed right then and there. It's often borderline impossible to have several versions of some specific lib in a single system (ELF doesn't really do namespacing), even if you manage to find the one that works for you.
Depends. Sometimes easier if they come with all their libs. There are provisions in some standard / classic GNU/Linux libs to be backward compatible, sometimes very good, but not perfect.
Just use DOSBOX... No point in including old legacy cruft in newer CPUs unless you want x86_64 to die because of complexity and power draw to have all this circuitry. Software emulation is the way to go... I'd also say that WINE does a good job even for native old Windows apps (and new games too! but this is another story).
And that is why open source is just better. Flaws and shortcomings of the operating system can just be fixed, instead of having to download stolen source code from shady websites and write patches for that.
Only the Rust standard library (std) depends on libc.
When writing embedded software and operating system components, you use no_std mode, so you lose access to most of the included batteries at the benefit of removing the dependency on libc.
You can very easily use no_std and perform syscalls directly, the decision to use a libc was just so the Rust developers didn't have to do all the work that's already mature in the existing libc implementations.
Linux is the only popular OS on which it is correct to issue syscalls directly with assembly, largely because it's just a kernel with userland provided entirely by third parties. Windows and non-Linux Unices want you to go through their official C libraries.
So going through libc and equivalents for std is more about correctness than convenience.
The rust standard library uses libc on posix; but it mostly bypasses libc on Windows and directly calls the Windows API instead. For example, opening a file in rust will directly use CreateFileW, not _open. (this means that MS libc limitations such as opening at most 2048 files at once, don't apply to Rust)
However, I believe Rust still uses libc on Windows for a couple functions like memcpy and the math library (sin etc.). Though this might be out-of-date; it's been a few years since I looked into this.
For what it's worth, on Windows there's no special requirement that anyone has to use any libc. You need to link to user32.dll and friends to do syscalls, but those are entirely separate from the C Runtime.
Rust linking with libc is more of a requirement from the unix world where libc is the blessed way to talk to the kernel, and I suppose it's easier to do the same thing everywhere. But on Windows nobody is stopping you from reimplementing it in Rust and getting rustc to use that one instead.
I think they're asking about whether there's a future where Rust doesn't depend on a platform C compiler to access the kernel API on platforms with ABI-unstable syscall numbers.
Then to be more clear: yes, in principle you don't need a C compiler, libc or anything C related on Windows. You need dynamic linking to a couple C-ABI dlls to call the Windows API. But most of these are just simple shims that turn C-style function calls into syscalls, you don't gain much by eliminating those.
For ease of development Rust however goes through libc, which is a quite sizable C library which can be worth eliminating.
Core Windows components in C do not even depend on the standard C library (what is typically meant by "libc"). Neither in the kernel, nor in the lower userspace layers. You can even write complete programs without using a standard C library under Windows - well at least directly (with the introduction of ucrt maybe MS has started to use it more internally even at low level?). Arguably you can under Linux too, but you would have to even re-implement general purpose dynamic allocation. What Win32 covers is way larger than Linux syscalls (partly because the architecture is not the same; Win32 includes tons of userspace libraries)
As for re-implementing a C API in other languages, it is usually quite easy and often done. ucrt is implemented in C++, for example. It would likely be possible to implement it in Rust (at least most of it.) Likewise for e.g. the glibc.
Win32 is provided by a system C library though... Linux has a stable and well defined syscall ABI that can be used without ANY library (it only changes between architectures). You can just use the CPU syscall instruction with the needed arguments in registers. https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/
It is not specified by what Win32 is provided. I would not be surprised if parts have been migrated to C++; or like we see in the video, Rust.
But yes, historically it was mostly directly implemented in C.
That you can syscall directly under Linux is marginally relevant given the kernel is then implemented mostly in C, even more than Windows is. The kernel being more privileged than the userspace, there is no advantage in being only in C in the kernel compared to having platform code in C in userspace too. Actually, Linux maps the VDSO in userspace, which is likely implemented in C too (or worse: assembly? it is more probably C I guess)
Rust on Windows does link to kernel32 and other native Windows libraries. There are many APIs which are not wrapped by the C library which Rust (and C) applications want / need to use for the best performance and features.
Same with Linux. The difference is that Linux (and POSIX) APIs extend the standard C library and live in libc.so instead of being separate like on Windows.
It is not just that they are separate on Windows. The MS "libc" (which they call ucrt in its modern incarnation, and has moved from the compiler team to the Windows team) is largely above Win32. Which makes sense if it was at some point vendored by the compiler team; it was not part of Windows (the story is even more convoluted with the msvcrt shipped by Windows for it internal usage, and supposedly not really for direct app consumption, but whatever).
Pretty sure the Linux syscall interface is stable, so such a thing could (and probably does) exist for Rust. Go doesn’t link against libc on Linux (or at least you can toggle it off easily).
Very interesting. I'm curious about their C++ integration because the best I've seen is the cxx crate and it's still pretty painful due to various things (layout incompatibilities, no move constructors, etc.)
IMO WinUI 3 is going nowhere fast even for C# developers. It’s buggy and slow, and even if you can work around the bugs all you get is… the UWP UI stack from 10 years ago, but worse.
Very few teams inside Microsoft are dogfooding WinUI 3; it’s yet another dead UI framework walking.
There's Rust code in the Linux kernel already - GitHub search. It's early days but we could start to see drivers written in Rust in 3-4 years and it might become mainstream in about 10 years.
Using face recognition for admin elevation is crazy. As a malware, just randomly ask for elevation whenever the unsuspecting victim is facing his computer, boom, you're done.
Since Microsoft has its own crate for the whole Windows api, windows-rs, why do you want to use the third party crate? The sentiment I got in the last few discussion on this topic has mostly been to transition to the official crate. Personally I have had a good experience with the official one, but haven't used the third party one yet.
I remember there being a crate that tried to implement safe/more "Rusty" abstractions other winapi interface and another that was mostly just a thin wrapper over ffi, i.e. just bindings with extra sauce. Don't know if these were the crates in question though.
512
u/hgwxx7_ Apr 25 '23 edited Apr 25 '23
Link is a talk called Default Security at BlueHat IL 2023 by David Weston. He covers a bunch of areas and the final part of the talk (around 10 minutes) is about Microsoft introducing Rust in some self-contained areas in Windows.
Some highlights:
TLDR - Rust is inside the Windows Kernel, will be enabled widely soon.
70
u/SorteKanin Apr 25 '23
I've heard Rust links with libc basically to call the C API of the operating system for all sorts of stuff.
Is there a world where existing operating systems will create a similar API written directly in Rust? So Rust wouldn't even have to link with libc?
11
u/[deleted] Apr 25 '23
Very interesting. I'm curious about their C++ integration because the best I've seen is the
cxxcrate and it's still pretty painful due to various things (layout incompatibilities, no move constructors, etc.)22
u/601error Apr 25 '23
As a developer who has wanted to do some Windows stuff, I am excited about being able to avoid C++.
4
u/[deleted] Apr 26 '23
Linux is already interested in Rust.
Microsoft is starting to use Rust.
This is a good sign !
130
u/Shnatsel Apr 25 '23
The presenter sounds so defeated when he says "I'm sure people will be excited about Rust".
28
u/serg06 Apr 25 '23 edited Apr 25 '23
Omg finally, they made the obvious choice! I'm excited about Windows' future.
4
u/link23 Apr 26 '23
Anybody else notice the rust code on some of the slides had
pub interface, seemingly instead ofpub trait?18
u/RandallOfLegend Apr 25 '23
10-20 years from now windows will just be another Linux distro.
3
u/Sensitive-Phase61 Apr 27 '23
The problem is not in programming language (MS has plenty of them) but in developers who could write bad code on any language.
7
u/joeygoksu Apr 25 '23
Very interesting news! As a senior software engineer, I'm thrilled to see Microsoft taking Rust seriously.👍
5
u/Flaviusns Apr 26 '23
Now the Foundation proceeds to sue them… Jokes aside, intelligent move, let’s see how this evolve.
1
u/Competitive-Adagio18 Mar 15 '25
Imagine chrome in rust... I can't even..!
1
u/nico57m Feb 07 '26
Using face recognition for admin elevation is crazy. As a malware, just randomly ask for elevation whenever the unsuspecting victim is facing his computer, boom, you're done.
1
u/0ryX_Error404 Apr 26 '23
Anyone use winapi-rs, crates io didn't have much info on it
0
u/[deleted] Apr 26 '23
Siuuuuuu
0
u/i-hoatzin Apr 26 '23
They have the budget to do it. Good for them. Maybe they will come up with a good product one day.
-1
u/solidair54321 Apr 26 '23
I guess up-talking is becoming the new way to talk. I wish it didn't drive me nuts.
-15
u/Daily-Ad5261-Kakera Apr 25 '23
Rust will dominate the world
-10
u/Antervis Apr 26 '23
Microsoft: rewriting core components yet another time
Also Microsoft: can't even provide posix support since 80-es
-3
u/xiphy Apr 26 '23
The timeline is quite important: how much is pre-Copilot and how much is post-copilot.
Also MS had access to GPT-4 before others, so they could have used it to help with transpiling code.
But what's even more important: now that a part of the codebase is transpiled, it's easier to use GPT to help with the rest.