Re: [TECH TOPIC] Rust for Linux

Miguel Ojeda
2021-07-07T17:02:05Z

On Wed, Jul 7, 2021 at 9:27 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> Where should the free have been? Will Rust help in this case? Will it
> result in a memory leak?

If the unsafe code is sound (which it should be -- otherwise we
consider it a bug), then we cannot have UB in Rust, so no crashes due
to memory corruption etc.

However, note that memory leaks are *not* UB -- you can definitely
leak memory in Rust.

Now, whether our abstractions should be thin and e.g. just call devres
primitives or instead write something else from scratch, is an open
question. The latter may lead to easier/faster code in the Rust side,
since it would give us more freedom. But, of course, we understand if
people prefer us to reuse as much C APIs as possible, like e.g. we did
with the red-black trees vs. using `alloc`'s `BTreeMap`.

Cheers,
Miguel