CommunityNews

CommunityNews

Linus Torvalds on Rust support in kernel

On Wed, Apr 14, 2021 at 11:46 AM ojeda@kernel.org wrote:

Some of you have noticed the past few weeks and months that
a serious attempt to bring a second language to the kernel was
being forged. We are finally here, with an RFC that adds support
for Rust to the Linux kernel.

So I replied with my reactions to a couple of the individual patches,
but on the whole I don’t hate it.

HOWEVER.

I do think that the “run-time failure panic” is a fundamental issue.

I may not understand the ramifications of when it can happen, so maybe
it’s less of an issue than I think it is, but very fundamentally I
think that if some Rust allocation can cause a panic, this is simply
fundamentally not acceptable.

Allocation failures in a driver or non-core code - and that is by
definition all of any new Rust code - can never EVER validly cause
panics. Same goes for “oh, some case I didn’t test used 128-bit
integers or floating point”.

So if the Rust compiler causes hidden allocations that cannot be
caught and returned as errors, then I seriously think that this whole
approach needs to be entirely NAK’ed, and the Rust infrastructure -
whether at the compiler level or in the kernel wrappers - needs more
work.

So if the panic was just some placeholder for things that can be
caught, then I think that catching code absolutely needs to be
written, and not left as a to-do.

And if the panic situation is some fundamental “this is what the Rust
compiler does for internal allocation failures”, then I think it needs
more than just kernel wrapper work - it needs the Rust compiler to be
fixed.

Because kernel code is different from random user-space system tools.
Running out of memory simply MUST NOT cause an abort. It needs to
just result in an error return.

I don’t know enough about how the out-of-memory situations would be
triggered and caught to actually know whether this is a fundamental
problem or not, so my reaction comes from ignorance, but basically the
rule has to be that there are absolutely zero run-time “panic()”
calls. Unsafe code has to either be caught at compile time, or it has
to be handled dynamically as just a regular error.

With the main point of Rust being safety, there is no way I will ever
accept “panic dynamically” (whether due to out-of-memory or due to
anything else - I also reacted to the “floating point use causes
dynamic panics”) as a feature in the Rust model.

       Linus

https://lkml.org/lkml/2021/4/14/1099

This thread was posted by one of our members via one of our news source trackers.

Where Next?

Popular Linux topics Top

First poster: bot
If you’re looking for a solid web-based Linux admin GUI, look no further than the tried and true Webmin. Jack Wallen shows you how to ins...
New
New
CommunityNews
Linux is the poster-child for the C language. But times change. The Rust language has been slowly gathering support for use as a system l...
New
First poster: bot
In our previous post, we announced that Android now supports the Rust programming language for developing the OS itself. Related to this,...
New
First poster: bot
Thirty years ago, Linus Torvalds was a 21 year old student at the University of Helsinki when he first released the Linux Kernel. His ann...
New
CommunityNews
As movement toward memory-safe languages, and Rust in particular, continues to grow, it is worth looking at one of the larger scale effor...
New
First poster: kokolegorille
Someone might need to check on Steve Ballmer. Microsoft has developed its own Linux distro, CBL-Mariner, and released it under the open s...
New
First poster: bot
This is a ‘Linux Swiss Army Knife’, offering maximum utility while still being able to fit in your pocket. Is it fast? No. Can it run a G...
New
First poster: AstonJ
I’ve had a busy week, so I didn’t have time until today to read this news about Red Hat locking down RHEL sources behind a Red Hat subscr...
New
Eiji
Hi, I have found a helpful video today. Discord is one of the most popular chat apps. However it’s updater on Linux actually causes more ...
New

Other popular topics Top

Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
AstonJ
Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New