Live data from Hacker News

Rust in the kernel is no longer experimental

lwn.net

431–440 of 853 posts

Re: Rust in the kernel is no longer experimental

#431

Earlier quoted context omitted.

Because someday the programming state of the art must advance beyond 1970, and someday we must stop introducing new memory safety bugs that cause horrific vulnerabilities, and for kernel code we don't have the luxury of recompiling everything with garbage collection turned on as a band-aid for C's incurable defects.

The Unix/C people wrote their own kernel in the 1970s instead of invading an existing one.

"invading"

I'm sure your choice of words helps the discussion.

Re: Rust in the kernel is no longer experimental

#433
post #344
post #175

After all the resistance to Rust in the Linux Kernel, it's finally official. Kudos to the Linux Rust team!

https://www.phoronix.com/news/Alex-Gaynor-Rust-Maintainer >

"Yay, we got Rust in the Kernel! ^_^ Ok, now it's your code! Bye!"

Re: Rust in the kernel is no longer experimental

#434
post #401

Earlier quoted context omitted.

> let's start by prefacing that 'production quality' C is 100% unsafe in Rust terms. I don't know what one should even make from that statement. > here's where we fundamentally disagree: you listed a couple dozen unsafe places in 1.5kLOC of code; let's be generous and say that's 10% It's more than 10%, you didn't even bother to look at the code but still presented it, what in reality is a toy driver example, as somet…

> I don't know what one should even make from that statement. it's just a fact. by definition of the Rust language unsafe Rust is approximately as safe as C (technically Rust is still safer than C in its unsafe blocks, but we can ignore that.) > you didn't even bother to look at the code but still presented of course I did, what I've seen were one-liner trait impls (the 'whole traits' from your own post) and sub-line…

So, unsafe block every 70 LoC in 1500 LoC toy example? Sure, it's a strong argument.

Re: Rust in the kernel is no longer experimental

#435

That is so good to hear. I feel Rust support came a long way in the past two years and you can do a functional Rust kernel module now with almost no boilerplate. Removing the "experimental" tag is certainly a milestone to celebrate. I'm looking forward to distros shipping a default kernel with Rust support enabled. That, to me, will be the real point of no return, where Rust is so prevalent that there will be no goin…

[flagged]

I believe Linus responded to this very question. I recommend that you read through his email.

Basically, technology evolves, and you or anyone else can't stop that just because you don't like it for whatever nonsense (non technical) reason.

Re: Rust in the kernel is no longer experimental

#437

Earlier quoted context omitted.

> I prefer debugging C I prefer not having to debug... I think most people would agree with that.

I prefer a billion dallars tax free, but here we are:(

If it wasn't clear, I have to debug Rust code waaaay less than C, for two reasons:

1. Memory safety - these can be some of the worst bugs to debug in C because they often break sane invariants that you use for debugging. Often they break the debugger entirely! A classic example is forgetting to return a value from a non-void function. That can trash your stack and end up causing all sorts of impossible behaviours in totally different parts of the code. Not fun to debug!

2. Stronger type system - you get an "if it compiles it works" kind of experience (as in Haskell). Obviously that isn't always the case, but I can sometimes write several hundred lines of Rust and once it's compiling it works first time. I've had to suppress my natural "oh I must have forgotten to save everything or maybe incremental builds are broken or something" instinct when this happens.

Net result is that I spend at least 10x less time in a debugger with Rust than I do with C.

Re: Rust in the kernel is no longer experimental

#438

Earlier quoted context omitted.

If rust didn’t provide value to the Linux kernel, there’s no way it would have made out of the experimental phase. Rust isn’t an invading tribe. It’s just a tool.

[flagged]

https://www.redox-os.org/

Re: Rust in the kernel is no longer experimental

#440

Earlier quoted context omitted.

Because someday the programming state of the art must advance beyond 1970, and someday we must stop introducing new memory safety bugs that cause horrific vulnerabilities, and for kernel code we don't have the luxury of recompiling everything with garbage collection turned on as a band-aid for C's incurable defects.

The Unix/C people wrote their own kernel in the 1970s instead of invading an existing one.

They wrote their own language (C) too. They invented a new language because the current crop of languages didn't suit their needs. Your argument ignores the parts of history that are inconvenient and highlights the ones that you think support it.
Post reply on HN