|
|
Log in / Subscribe / Register

Banning unsafe in Rust for Linux device drivers

Banning unsafe in Rust for Linux device drivers

Posted Aug 15, 2024 14:29 UTC (Thu) by farnz (subscriber, #17727)
In reply to: Safe embedded code is state of the art by DanilaBerezin
Parent article: Standards for use of unsafe Rust in the kernel

I don't see a ban on unsafe as being something imposed - there will not be a decree saying that "unsafe in drivers is not allowed", or a #[deny(unsafe_code)] equivalent enforced on drivers. Rather, the decree will be "don't use unsafe when there's a suitable safe abstraction you can use at no performance cost", and in the long run, this will be equivalent to a complete ban on unsafe code, since there will always be a safe abstraction you can use.


to post comments

Banning unsafe in Rust for Linux device drivers

Posted Aug 15, 2024 15:05 UTC (Thu) by corbet (editor, #1) [Link] (10 responses)

The plan has always been to make it possible to write drivers without the need for unsafe. Surely there will be exceptions, but I expect things will get to the point where its use will be something that will stand out in review.

Banning unsafe in Rust for Linux device drivers

Posted Aug 15, 2024 16:51 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link] (9 responses)

> The plan has always been to make it possible to write drivers with the need for unsafe.

"With" or "without"?

Banning unsafe in Rust for Linux device drivers

Posted Aug 15, 2024 16:52 UTC (Thu) by corbet (editor, #1) [Link] (8 responses)

Yes, without; I'll fix the comment.

Banning unsafe in Rust for Linux device drivers

Posted Aug 16, 2024 10:01 UTC (Fri) by intelfx (subscriber, #130118) [Link] (7 responses)

> I'll fix the comment

We all want this superpower! :-)

Banning unsafe in Rust for Linux device drivers

Posted Aug 16, 2024 11:37 UTC (Fri) by daroc (editor, #160859) [Link] (6 responses)

Come write articles for us. I think the problem is that while the vast majority of people would use the power for good, letting people edit their comments makes moderation harder for us, since people could say something that goes against the rules and then change it before we saw it to cause confusion. Ideally, this would be solved by improving the moderation interface (and the database schema), but it isn't a trivial change. I've been mulling over potential changes.

Banning unsafe in Rust for Linux device drivers

Posted Aug 16, 2024 11:41 UTC (Fri) by mb (subscriber, #50428) [Link] (2 responses)

I like the github-style approach to that where you can edit at any time, but the edit history and the old versions are visible as well. (Can you delete history on github? I'm not sure right now. But LWN could disallow history deletion).

Banning unsafe in Rust for Linux device drivers

Posted Aug 16, 2024 22:07 UTC (Fri) by rc00 (guest, #164740) [Link]

> Can you delete history on github?

Yes.

Banning unsafe in Rust for Linux device drivers

Posted Aug 18, 2024 1:41 UTC (Sun) by KJ7RRV (subscriber, #153595) [Link]

This gave me an idea: would it be feasible to actually store article and comment content in a Git repository? That way, the site could just expose an interface to get a comment file's history.

Banning unsafe in Rust for Linux device drivers

Posted Aug 16, 2024 23:10 UTC (Fri) by Wol (subscriber, #4433) [Link] (2 responses)

I don't really make much use of its power at work, but aiui, Slack allows edits for a *short* time.

So you might have a bit of a pain with moderation, but if you only allowed editing within, say, five minutes of the original post, then it balances your need to moderate with a poster's desire to correct something. After all, I expect most people spot their mistakes as they click "post" :-)

Cheers,
Wol

Banning unsafe in Rust for Linux device drivers

Posted Aug 21, 2024 20:25 UTC (Wed) by riking (subscriber, #95706) [Link]

You need to pair this with delaying email notifications until just after the edit period has expired.

Banning unsafe in Rust for Linux device drivers

Posted Aug 31, 2024 11:22 UTC (Sat) by sammythesnake (guest, #17693) [Link]

Reddit has a handy relative of this (though I don't think history is visible(?)) Edits are noted with something like "last edited at [time]" unless made within some small grace period after the initial post, because:

> most people spot their mistakes as they click "post" :-)

This is *absolutely* the case for the overwhelming majority of edits I'd like to make to *my* posts/comments :-/


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds