News for hackers. Stuff that matters.
Re:So You Want to Rust the Linux Kernel? by Shared404 on Monday October 11, 2021 @01:23PM (#28830669)
To be honest, I don't think Linux being the "One True Kernel" is really worthwhile, and the benefits of adding Rust to the kernel outweigh the downsides.

There are plenty of other kernels available for embedded work, and my understanding of Rust in the Linux kernel is that it's mostly drivers, which seems like it would be optional for your use case.

That said, I've not done much embedded, I may be misunderstanding something.

Re:So You Want to Rust the Linux Kernel? by SavantIdiot on Monday October 11, 2021 @01:38PM (#28830817)
Rust is a language that forces you to do things in a way that makes code more robust at the cost of a little upfront thought and inconvenience.

The parent comment is complaining that Rust will make kernel dev too hard? Are they joking? It is already complicated.

I would rather see a more formally constructed language used for the kernel than risk adding more C-related bugs.

Re:So You Want to Rust the Linux Kernel? by gameswithgo on Monday October 11, 2021 @02:21PM (#28831253)
The OP might be ok with a Kernel that was just in Rust, but having a kernel witha mix of Rust and C adds complexity, both in having to master two languages to understand it well, and a more complex build system.
Re:So You Want to Rust the Linux Kernel? by b20000 on Monday October 11, 2021 @06:44PM (#28833950)
exactly
Re:So You Want to Rust the Linux Kernel? by pdimitar on Wednesday October 13, 2021 @06:09PM (#28858266)
What's so bad in having to know two languages for developing drivers? Especially when knowing the second one will rid you of all memory safety bugs just because your code compiles.

And to call Rust's build system is laughable. Issuing `cargo build` could not be simpler (and it includes automatic downloading of dependencies, too).

Re:So You Want to Rust the Linux Kernel? by shadowgovt on Monday October 11, 2021 @02:16PM (#28831208)
> It is already complicated

And specifically, one of the ways in which it is complicated is that it's mostly done in a language that doesn't natively enforce memory-safe constructs, forcing developers to walk a best-practices and tooling tightrope to avoid writing code that breaks.

Re:So You Want to Rust the Linux Kernel? by SavantIdiot on Monday October 11, 2021 @05:49PM (#28833497)
Why the heck is this comment grey?! At least reply and explain where they are wrong?
Re:So You Want to Rust the Linux Kernel? by b20000 on Monday October 11, 2021 @06:45PM (#28833961)
you know what they say - something about nature creating a better fool
Re:So You Want to Rust the Linux Kernel? by SavantIdiot on Monday October 11, 2021 @10:35PM (#28835475)
You mean like not incorporating formal verification theories? Yeah: fools, all of 'em.
Re:So You Want to Rust the Linux Kernel? by b20000 on Tuesday October 12, 2021 @03:16AM (#28836958)
the kernel and linux is about many important issues, not about chasing the latest language fad
Re:So You Want to Rust the Linux Kernel? by pdimitar on Wednesday October 13, 2021 @06:10PM (#28858275)
That's your misconception: you believe Rust is a fad. And there's also nothing "latest" about it; it's 10 years old.
Re:So You Want to Rust the Linux Kernel? by b20000 on Monday October 11, 2021 @06:42PM (#28833931)
it is already complicated. so i don’t want to learn another language. i want to become BETTER at using what is there, not have a language forced onto me. i want to make my tool set smaller, not learn more tools.

also, being able to use linux in an embedded system as a resource constrained developer is hugely important today. adding more tools means more dev cost.

Re:So You Want to Rust the Linux Kernel? by SavantIdiot on Monday October 11, 2021 @10:34PM (#28835471)
> i want to make my tool set smaller, not learn more tools.

Ouch. Good luck with that.

Re:So You Want to Rust the Linux Kernel? by pdimitar on Wednesday October 13, 2021 @06:10PM (#28858280)
Sounds like it's time to exit programming, buddy, because the world has some very bad news for you. Yeah, you'll have to keep learning tools. It's included in the big paycheck.
Re:So You Want to Rust the Linux Kernel? by cogman10 on Monday October 11, 2021 @02:26PM (#28831298)
There is also so much to rust that makes it nearly ideal for the prospect of writing a driver.

For example, how many bytes are in an `int`? What is the endianess of your 32bit `int`?

Rust puts up front a lot of the information crucial for cross platform development of hardware drivers.

Rust has few undefined edges which is exactly where C gets into trouble. C, by design, has a bunch of undefined edges.

Honestly, the biggest downside to Rust in the kernel is that Rust is backed by the LLVM, which doesn't have as many supported targets as GCC does. (And, AFAIK, GCC is generally the preferred compiler for the kernel).

Re:So You Want to Rust the Linux Kernel? by littlestymaar on Monday October 11, 2021 @05:12PM (#28833155)
> Honestly, the biggest downside to Rust in the kernel is that Rust is backed by the LLVM, which doesn't have as many supported targets as GCC does. (And, AFAIK, GCC is generally the preferred compiler for the kernel).

Fortunately, there are now two competing approach to make GCC a viable compiler to Rust[1], and it's moving really fast. I think the LLVM-only situation won't get in the way more than a few more years.

[1]: https://lwn.net/SubscriberLink/871283/c437c1364397e70e/

Re:So You Want to Rust the Linux Kernel? by tialaramex on Monday October 11, 2021 @06:41PM (#28833914)
> For example, how many bytes are in an `int`?

Rust and Linux both have the same name for say the 32-bit unsigned integer type, they both call that u32. This is of course a coincidence, and not an unlikely one, but it probably doesn't hurt for Linux people getting familiar with Rust.