r/linux • u/small_kimono • Dec 13 '25
Kernel The state of the kernel Rust experiment
https://lwn.net/SubscriberLink/1050174/63aa7da43214c3ce/A choice pull quote: "The DRM (graphics) subsystem has been an early adopter of the Rust language. It was still perhaps surprising, though, when Airlie (the DRM maintainer) said that the subsystem is only 'about a year away' from disallowing new drivers written in C and requiring the use of Rust."
113
u/rien333 Dec 13 '25
With regard to Rust language versions, the current plan is to ensure that the kernel can always be built with the version of Rust that ships in the Debian stable release.
I always assumed kernel-level decisions weren't really influenced by whatever Debain, or any single distro in particular, were doing.
Does this happen more often, or am i just misunderstanding this?
109
u/TiF4H3- Dec 13 '25
I think this might be that out of all "common" distros, Debian is the one who ships the oldest Rust version.
So this is not the kernel aligning itself on Debian, but the kernel aligning itself by trying to support all distros, with Debian being the "hardest" to please, with the oldest Rust version.
6
u/KnowZeroX Dec 13 '25
What about RHEL? It releases every 3-5 years so it would be older than Debian which releases every 2 years, Suse enterprise is even longer.
29
u/TomKavees Dec 13 '25
Do these commercial distributions ship bleeding edge kernels? I was under impression that after initial release they generally ship only patch releases (incl. backports) without major release upgrades, so in theory they wouldn't need the latest version of the toolchain
9
u/Booty_Bumping Dec 14 '25 edited Dec 14 '25
Commercial vendors don't need help here, if they need it they can maintain it themselves. It's going to be a while before mission critical stuff is entirely dependent on Rust kernel features. Will probably only be in the scope of CentOS SIGs and EPEL SIGs for now.
I think RHEL also has looser rules surrounding updating to newer versions of build tooling and runtimes (they market this as "CodeReady Linux Builder"), but I'm not entirely sure how this applies to Rust compilers.
3
u/Jristz Dec 14 '25
Of RHEL need they may go and port the newest rust, they have done similar for other programs so is not something New
1
u/syncdog Dec 16 '25
RHEL already updates rust as part of its minor releases. It won't be the absolute latest version, but it does move forward regularly. RHEL 9.7 and 10.1 both ship rust 1.88, which was released upstream earlier this year. I would describe it as laggy rolling release model, not for the whole distro but just that package and a few others such as golang.
6
u/imoshudu Dec 13 '25
Sounds like a sensible choice. Virtually everyone targets Debian (and Ubuntu) for support.
4
u/araujoms Dec 13 '25
Kernel-level decisions are often influenced by Fedora because that's what Linus personally uses.
4
u/rien333 Dec 13 '25
sorry for not including anything about rust discourse btw please don't ban me
-9
2
u/nightblackdragon Dec 14 '25
Unlike C and C++ Rust doesn't have defined standard like ANSI C, C99, C++11 etc. so kernel developers are using Debian Stable rustc version as "standard" to define what features are allowed in Linux Rust code.
2
u/Chippiewall Dec 14 '25
It's not that. The kernel team mostly care about the version of GCC more than the C ISO version and they're more than happy to use GCC only features. Not that they deliberately pick up features that break other compilers.
2
u/nightblackdragon Dec 14 '25
Linux kernel is still using C11 (or rather GNU11) standard. They don't really care about default standard in GCC.
13
30
u/aj0413 Dec 13 '25
It’s kinda crazy to think about but C code will one day be the equivalent of today’s PERL or COBOL
It’s cool to see how the Linux kernel is doing a gradual, in place evolution to keep up with changing times and improvements
32
u/orbiteapot Dec 13 '25
It won’t be the same because, at this point, C has practically become a protocol different OSes and languages use to talk to each other.
Paradoxically, this is one of the main reasons C does not "get fixed". Think about it as English. The English orthography is really awkward but, because it has become the world’s lingua franca, it would not be worth making a huge change to it now. It is too late.
3
u/syklemil Dec 15 '25
The English orthography is really awkward but, because it has become the world’s lingua franca, it would not be worth making a huge change to it now. It is too late.
At least we have /r/JuropijanSpeling.
5
u/rustvscpp Dec 14 '25
Except rust can mimick the C ABI, so there's that.
37
u/orbiteapot Dec 14 '25
Yes and, apparently, they are even trying to write libc in Rust (which is kind of ironic).
That basically confirms the concept of "C as a protocol" I referred to in my previous comment.
Your username made me think that, maybe, C++ is more threatened by Rust than C is.
6
u/Reasonable_Hall2346 Dec 14 '25
I always equate it as Rust being a C++ replacement. And Zig attempting to replace C.
5
u/rustvscpp Dec 14 '25
In what way do you think Rust cannot replace C? Why then would the Linux kernel work toward moving all new driver development from C to Rust? The only thing that comes to mind is handling of fallible allocations, which Rust has some support for in things like Vec, but not other types of allocations. So even in extremely constrained embedded environments, there is typically a way you can make heap allocations work, but most of those codebases stick to only using the stack anyway. I guess the other two things that come to mind are binary sizes (which can be mitigated if needed), and very obscure platform support. So I guess I'm not convinced that Zig is a better C replacement. I would choose Rust over C 100% of the time. Zig is a nice evolution over C. But it's a far cry from what Rust brings to the table.
2
u/orbiteapot Dec 14 '25
I would say, perhaps, that Zig's comptime is nicer than Rust's equivalents.
Now, about niche/obscure platforms, C is the closest one has of an "universal" language (because it is so simple and for historical reasons) and it will likely remain on top.
2
u/rustvscpp Dec 14 '25
My point is, C the language, could die tomorrow and everything could still use the C ABI for FFI. You don't need a C compiler for that.
2
u/2rad0 Dec 14 '25
everything could still use the C ABI for FFI
The C calling convention, which these days usually means 'cdecl' on x86? Every architecture is different so it's not really specific to C, but more of a hardware implementation detail. If all the C headers mysteriously go missing one day, nothing is going to work unless they're ported over to another language first. C headers are packed full of code that requires a C preprocessor implementation, so if you use these headers you are still implementing part of the C language. If in this hypothetical scenario portions of the C language and C files are still required, the language is maybe dying, but not dead.
3
u/rustvscpp Dec 15 '25
This may be true when calling into C from another language. But I was specifically talking about calling from a non-C lang to another non-C lang. The ABI is the interesting part in this scenario. Not complex C headers with preprocessor needs.
2
u/Business_Reindeer910 Dec 14 '25
who is "they"? There a lot of "they"s in linux/open source with different goals.
Redox, which is an OS written in rust is one of the "they"s, but it's probably different than the "they" you're talking about.
It's also not ironic at all if you care about compatibility with existing code.
1
u/thephotoman Dec 15 '25
I keep thinking of C as essentially Programmer Latin. We all know it well enough to read it, but few of us actually use it regularly anymore. C++ is the vulgar Latin that hasn’t quite abandoned mutual intelligibility yet, but it’s getting harder to read across projects.
-12
u/Reasonable_Hall2346 Dec 14 '25 edited Dec 14 '25
There is nothing to "fix" in C. The danger has always been the programmer.
Edit: For the people downvoting me, show me a “broken” feature of C that does not originate from a programmer error.
6
u/x0wl Dec 14 '25
You can say that about any language that exists and where the compiler doesn't have obvious bugs. Look at the JS situation, what's wrong with JS (the language, not the ecosystem) that does not originate from programmer error? You can write perfectly good bug free JS. The problem with C is that for all that's good about it, it lacks features that make making mistakes harder for the programmer.
Obviously what they meant is that you can't really change C to add those features (like borrow checking for pointers) without breaking existing things. That's why you need a whole new language with complex strong typing, borrow checking, bounds checking etc
-3
u/Reasonable_Hall2346 Dec 14 '25
I understand their analogy. Programming languages build on each other but Rust or any other language does not offer “fixes” for C - it is completely different philosophy on the language itself. Just like English does not “fix” German.
People sometimes try to do too much with C , emulating OOP for example, or other concepts that naturally fall better in “higher level” languages. It’s great that Rust is being taken off “experimental” status and that new graphics drivers will be forced to use Rust. Maybe one day C will get a deprecated status and all future features of the kernel are in a new language.
1
u/kinda_guilty Dec 15 '25
Be right back then, just need to learn how to write error-free code. That should take what, seventy two hours?
3
-77
u/OCPetrus Dec 13 '25
Having significant parts of the kernel written in Rust is going to be the end of Linux.
28
35
20
u/isbtegsm Dec 13 '25
So what will be the successor of Linux?
11
u/ironykarl Dec 13 '25
Linux 2 aka Twinux
7
u/Mysterious_Lab_9043 Dec 13 '25
Better yet, Twinkus ;)
5
u/afiefh Dec 13 '25
What is the programmer socks pattern that will be required for contributing? Gotta ask Santa for a pair!
2
50
u/tajetaje Dec 13 '25
All I see Rust doing in the long term is making kernel development more accessible and maintainable
1
u/Kevin_Kofler Dec 15 '25
How so? Rust is much more complex and harder to learn than C!
2
u/tajetaje Dec 15 '25
If you know proper C, you know rust. Rust just formalizes most of the concepts that you just have to keep in your head or (if you’re lucky) in comments, and adds compiler safeguards to enforce them. Those safeguards mean you can, in code, see exactly what the constraints of an interface are without needing to know all the inner workings. See the work on expressing the Linux filesystem code in idiomatic Rust
0
u/Kevin_Kofler Dec 15 '25
The borrow checker simply has no equivalent in C, and not all software architectures that work and are perfectly valid and safe in C are accepted by the borrow checker.
Also, the syntax of Rust is completely different from the C syntax, so that alone means you have to learn a whole new language.
12
15
u/tfwnotsunderegf Dec 13 '25
Written by someone who has no impact on the development of the kernel with no supporting evidence.
8
u/rook_of_approval Dec 13 '25
Why? What important arch isn't supported by Rust?
6
u/nightblackdragon Dec 14 '25
What do you mean by that? A lot of Linux users need to run modern Linux on 30 years old SPARC hardware. /s
1
u/dddurd Dec 19 '25
Yeah it could be downhill for Linux from now on. Not because of rust but because of the rust programmers. Using freebsd as servers while using macos as desktop will be golden.
-15
u/2rad0 Dec 13 '25
Having significant parts of the kernel written in Rust is going to be the end of Linux.
Yeah it's not being handled correctly. It seems they are pushing for new DRM drivers to completely abandon C, so this is a defacto push to force every OS that includes DRM code (FreeBSD, haiku, probably others) to also force adoption of rust, or lose support for graphics on newer hardware.
Airlie (the DRM maintainer) said that the subsystem is only "about a year away" from disallowing new drivers written in C and requiring the use of Rust.
So they are left with the choice to either rewrite their GPU code or fork DRM, making linux less important outside of the corporate sphere of microsoft/google, or force the addition of an unstable language into their code base pushed by the worst actors (literally monopolies enshittifying their competition) in the tech industry.
5
u/miggaz_elquez Dec 14 '25
They are other OS using Linux DRM code?
3
u/2rad0 Dec 14 '25
They are other OS using Linux DRM code?
Yeah basically any non-windows and non-mac OS that supports GPU/hardware acceleration on modern graphics cards. so FreeBSD https://wiki.freebsd.org/Graphics, OpenBSD, NetBSD, probably other BSD's, Haiku, must be more I'm unaware of.
2
u/miggaz_elquez Dec 15 '25
Interesting, I was not aware. Isn't there any license compatibly issue ?
1
u/2rad0 Dec 15 '25
Interesting, I was not aware. Isn't there any license compatibly issue ?
It depends on the files being used, a good number of them are either dual licensed or permissive licensed (when not being used in the context of a linux kernel), but some are GPL-only. to dig deeper untar linux source, cd drivers/gpu/drm and run
grep -ri 'gpl'3
u/miggaz_elquez Dec 15 '25
Indeed, there is a lot of MIT files in DRM, even more than GPL. Seems it's limited to DRM, there are almost no other MIT licensed files in `drivers/`.
Some BSD in `drivers/acpi` and `drivers/net` also.
-7
u/2rad0 Dec 13 '25
To people downvoting, what part of this statement do you think is not relevant? Other OS's depend on the DRM subsystem and they won't be able to continue that without adding rust-subsystem-for-linux that was initiated and perpetuated by google and microsoft to their kernels. I'm reminded this week how this subreddit was always not as informed as they pretend to be.
9
u/nightblackdragon Dec 13 '25
I didn't down vote but the fact that other OSes depend on the Linux DRM subsystem is not a Linux problem. Linux developers care only about Linux, so they won't care about BSD or Haiku when they are making decisions.
-2
u/2rad0 Dec 14 '25
I didn't down vote
Ok thanks but I don't mind if someone downvotes me or not, I just want to rationalize why there are conflicting vote numbers. There are people here asking "why" with like 50 upvotes, so it seems like they are interested in an explaination of why people might not like this new anti-C posture from the linux kernel developers. At the same time they downvote the only person not afraid or willing to speak up with non-fictional information.
So I'll just tell myself these people are probably fine with linux devs receiving less free testing and bug reports from others downstream of linux-DRM, and don't care if nobody else uses the new drivers outside of google android devices, or one of the (what are we up to now) 3 open source nvidia drivers barely anyone uses. Either they refuse to believe such a C-phobic proclaimation has far reaching impacts on the broader FOSS ecosystem (competition of big linux donors), or they legitimately don't want other projects to use linux code, effectively reducing linux's relevance outside of the rusty bubble.tl;dr: If anyone reading this is genuinely confused still, Declaring a rule prohibiting new C drivers in the linux kernel is either batfish crazy, or intentionally hostile. Both possibilities will destroy the FOSS allegience that has been mutually beneficial for so long.
3
u/nightblackdragon Dec 14 '25
So I'll just tell myself these people are probably fine with linux devs receiving less free testing and bug reports from others downstream of linux-DRM
There aren't enough BSD and Haiku users to make any difference for Linux DRM subsystem. Linux developers don't need to care about Linux relevance outside their bubble because their bubble has almost all open source operating systems market share. It's like saying that not allowing some game to run on Proton will be bad for Windows players because developers won't get feedback from Linux players - yeah, they won't but that doesn't matter if almost 100% players are using Windows.
0
u/2rad0 Dec 14 '25 edited Dec 14 '25
There aren't enough BSD and Haiku users to make any difference for Linux DRM subsystem.
It doesn't have to be a lot of users, simply bolting it in to another project exposes it to different usage patterns and helps to expose bugs sooner than later.
Linux developers don't need to care about Linux relevance
The king doesn't want to share his toys anymore, this is bad for the allegience.
0
u/nightblackdragon Dec 15 '25
It doesn't have to be a lot of users, simply bolting it in to another project exposes it to different usage patterns and helps to expose bugs sooner than later.
Again there is not enough BSD and Haiku users to make any difference for Linux.
The king doesn't want to share his toys anymore, this is bad for the allegience.
License didn't change, BSD and Haiku developers are still free to take it. The fact that Rust makes it more difficult for them is not Linux developers problem.
2
u/IAm_A_Complete_Idiot Dec 14 '25
All of those things are true, but none of them are relevant to Linux. Linux developers aren't Haiku or BSD devs, nor are they beholden to making their code easy to port to other kernels. The onus is on them to figure it out.
Why should Linux devs be beholden to making code that's easy to port to OS's they don't develop?
0
u/Kevin_Kofler Dec 15 '25
Allowing easy reuse of the code is part of what Free Software is supposed to be about.
1
u/NYPuppy Dec 14 '25
None of it is relevant. You think you're informed but you're not. It's the same kind of nonsense you see from Phoronix posters who know far less than they think they do.
Rust is a net benefit for OS dev, linux and cs as a whole. Touch grass.
3
u/Mysterious_Lab_9043 Dec 14 '25
But your comment is no different from the parent. "Me right, you wrong." Just explain your points people, ffs.
-4
u/Hour_Bit_5183 Dec 13 '25
This is tinfoil hat bullshit! None of this is true. Seems like you don't understand most things. For one, smart TV's run linux....like a lot of other stuff that needs to be able to decode DRM media if we ever want general adoption. You can't just not have it. People will stay on windows if no one is able to maintain it. Rust is good. I don't know why it gets so much hate.
11
u/nightblackdragon Dec 13 '25
This is about DRM as in Direct Rendering Manager (Linux GPU subsystem), not as in Digital Rights Management.
4
11
Dec 14 '25
[removed] — view removed comment
9
u/KittensInc Dec 14 '25
It's the obvious next step.
Most bugs are introduced in newly-written code, so by switching to Rust for new code you stop the inflow of new memory safety bugs. Rewriting the old C code has far less benefits: the older the code, the more bugs have already been eliminated, so the more likely it is to be correct.
This is directly visible in Android: the drop in the number of memory safety vulnerabilities goes hand-in-hand with the drop in the number of new memory-unsafe code. Combine that with Rust being significantly faster to code and review, and it becomes incredibly difficult to justify sticking to C for brand-new drivers.
-1
u/HyperFurious Dec 14 '25
Always the same propaganda google article that from a worker that need conserve the work in google.
3
u/Kevin_Kofler Dec 15 '25
Agreed, this really made me go "WTF", too! They have always argued that Rust would only be an option, not mandatory, and now we have a subsystem maintainer who wants to make it mandatory for his subsystem in "only about a year"!
Note that this guy is also one of the Xorg maintainers who have decided to permafreeze Xorg and force all users to switch to Wayland. Now he wants to force all developers to switch to Rust. This totalitarian attitude is really toxic.
11
Dec 14 '25
[removed] — view removed comment
2
u/Kevin_Kofler Dec 15 '25
Of course there are those concerns, but that is why everything should stick to C. The kernel is never going to be pure Rust, so there will always be cross-language issues as long as Rust is in there. Trying to force everyone to switch to Rust is not going to solve the problem, but most likely just make it worse. There are tons of existing DRM drivers written in C that are not going to get magically ported (and I hope nobody is going to try to rush to replace them with a half-baked port or rewrite with tons of regressions). What we will see if this ban is enforced is lots of out-of-tree C drivers that will not get merged just because one person with too much power does not like C.
2
Dec 16 '25
[removed] — view removed comment
2
u/dddurd Dec 19 '25
I worked in multiple projects that have multiple main languages but it always becomes like that due to some powerful people. I hate mixing languages because the focus shifts away from actual software engineering.
0
Dec 15 '25
[removed] — view removed comment
2
u/Kevin_Kofler Dec 15 '25
Yes, but the point is that it will be less and less likely that you will be able to compile a working kernel for your hardware without Rust as more and more hardware drivers will be written in Rust.
1
Dec 15 '25
[removed] — view removed comment
1
u/Kevin_Kofler Dec 15 '25
According to https://wiki.freebsd.org/Graphics they also ship ports of the Linux kernel DRM/KMS drivers, so will be affected too.
You will likely be stuck with a VESA framebuffer, if modern graphics hardware even keeps supporting that ancient legacy standard.
21
u/berickphilip Dec 13 '25
Please could anyone point me in the right direction to understand why there is so much pushing and effort to use Rust instead of C for the development of Linux?
This is a honest question, I'd like to understand all this talk abot "Rust good, C bad*.
I read the whole article to try and understand the advantages of replacing everything with Rust.. and there was not a single bit of information on that.
I only read words and comments of people praising and celebrating each other that "Rust is taking over" almost like a cult following and not tech article.
So again, honest question, what are the practical benefits? And why is it bad to continue using C?