r/linux • • Apr 14 '21

Kernel [RFC] Rust support in the Linux kernel

https://lkml.org/lkml/2021/4/14/1023
608 Upvotes

316 comments sorted by

View all comments

Show parent comments

41

u/WindowsHate Apr 15 '21

The question was rhetorical; I was trying to get the guy above to answer it because he seems to think that Rust is somehow inherently more insecure than C (or alternatively, that adding Rust to the kernel would increase its attack surface compared to C), when in reality as you have correctly said, it's the other way around.

Thank you for the rundown though, I'm sure the comment will be useful to readers unfamiliar with the principles at play.

16

u/0x4A5753 Apr 15 '21

Ahh, whoosh. I missed that.

0

u/[deleted] Apr 15 '21

[deleted]

10

u/insanitybit Apr 15 '21

A bigger text section is not 'more attack surface' any more than a bigger monitor is more attack surface.

0

u/[deleted] Apr 15 '21

[deleted]

5

u/insanitybit Apr 15 '21

Except it isn't a law at all.

0

u/TheFeedingEight May 06 '21

While that is correct it's more about SLOC and not about the size of the text section. You're likely going to write less SLOC in Rust than in C and consequently have less opportunities to introduce bugs in your code. Not too mention that the Rust Compiler also does a fine job at preventing a lot of typical C errors.

11

u/WindowsHate Apr 15 '21

Immediately yes, but it's an investment into the safety of future development. Every single driver written into the kernel is an increase in the attack surface. If Rust reduces each of them by 50% (just pulling numbers out of ass, some studies argue up to 80% of vulnerabilities are root-caused by memory issues that are preventable with Rust) then in a few short years of new hardware support it will have been a good decision. Also, the base infrastructure, being comprised of common artifacts used for future development ostensibly by many organizations, will have many more eyes on it and much more rigorous testing than any individual driver modules written in C.

Rejecting the language based on the need to pull in some initial tooling to support it is shortsighted, IMO.

0

u/[deleted] Apr 15 '21

[deleted]

5

u/WindowsHate Apr 15 '21

I have the capacity to think further ahead than what's immediately in front of my face.