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.

First Post!

bot

bot

Corresponding tweet for this thread:

Share link for this tweet.

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
First poster: AstonJ
In a few weeks, Fedora 34 will be released, and alongside it - you will get to use Gnome 40, the next version of this namesake desktop en...
New
First poster: bot
This thread was posted by one of our members via one of our news source trackers.
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
First poster: bot
Linux Sucks 2021 - The End of Linux is Nigh. Welcome to the 2021 edition of Linux Sucks! View video here: This thread was posted by...
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: bot
Introduction Linux from scratch (LFS) is a step-by-step tutorial for building your own Linux distribution. Using the LFS approach, you st...
New
First poster: bot
Jack Wallen has a bone to pick with cloud services run by Google, Microsoft and Apple. The cloud is run by Linux and open-source. Ther...
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

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
New
AstonJ
Just done a fresh install of macOS Big Sur and on installing Erlang I am getting: asdf install erlang 23.1.2 Configure failed. checking ...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1132 25307 748
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New