Thread (42 messages) 42 messages, 7 authors, 2023-10-17

Re: [PATCH net-next v4 1/4] rust: core abstractions for network PHY drivers

From: Miguel Ojeda <hidden>
Date: 2023-10-17 15:04:10
Also in: rust-for-linux

On Tue, Oct 17, 2023 at 4:21 PM Greg KH [off-list ref] wrote:
Again, no, deal with what we have today, kernel code is NOT
future-proof, that's not how we write this stuff.
That would make the abstractions "unsound", i.e. UB could be
introduced from safe Rust code, which is what Rust aims to prevent.

It is not so much that we care about "unwritten code" (or out-of-tree
code), but rather that it prevents having UB in users of the
abstractions.

Put another way, there may be no code today that triggers UB, but
there could be, tomorrow, with a new driver. Or when somebody modifies
a module. The goal is to simply not allow broken users to compile to
begin with.

So if we allow unsound abstractions to be merged, then we are
essentially losing that "layer" of protection that Rust gives, and
thus one of its key advantages. Instead, if we manage to keep the
abstractions sound, then we can review Rust modules that do not use
`unsafe` and statically know that they are not introducing UB.

Cheers,
Miguel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help