Skip to main content
Topic: Rust in the Kernel (Read 885 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Rust in the Kernel

So apparently Rust will be an acceptable language to use for driver module submissions in the kernel soon. It doesn't seem to be BS, https://docs.kernel.org/rust/index.html. From what I gather it's a push by Google, Amazon and Microsoft. That's a huge change.

I think that if Firefox, the birth project of Rust bugs out into oblivion within a week of being open and still hasn't been fixed, it's mind blowing that it should even be considered. It doesn't have gcc support, no open standards, no expansive ecosystem like C++ and it doesn't play well with other languages, so lacking everywhere. If it has any good features, port them to C we don't need new toolchains. Though on the other hand I do C and have little experience with Rust. At least allow C++ driver modules if you are to allow Rust ones, that ecosystem surely has something to offer.

What do you guys think?



Re: Rust in the Kernel

Reply #3
Any particular opinions on it's inclusion in the kernel?

Me?  I've got nothing that could add value that hasn't already been said.  The proposal came up ~July 2020, so Rust's inclusion has been pretty well thought over since then.  A lot of work has happened to get here and a ton of future work yet to do.

Re: Rust in the Kernel

Reply #4
One really important thing people have to understand: Rust kernel programming is not the same as Rust userspace programming

According to this page from Redox OS, You cannot write a kernel without unsafes.

Now I don't exactly know if this applies to kernel modules, but since that stuff also counts as low level, I'm guessing it does.

Rust loses some of its safety features when using unsafe so that you can gain some additional capabilities to write low level code: https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

 

Re: Rust in the Kernel

Reply #5
One really important thing people have to understand: Rust kernel programming is not the same as Rust userspace programming

According to this page from Redox OS, You cannot write a kernel without unsafes.

Now I don't exactly know if this applies to kernel modules, but since that stuff also counts as low level, I'm guessing it does.

Rust loses some of its safety features when using unsafe so that you can gain some additional capabilities to write low level code.
Yeah apparently the NVME driver they wrote in Rust to prove you can write Rust drivers comparable to C used unsafe  in all the tricky parts.