Re: [TECH TOPIC] Rust for Linux

Linus Walleij
2021-07-08T19:49:28Z

On Thu, Jul 8, 2021 at 8:51 PM Greg KH <greg@kroah.com> wrote:

> But if you didn't like the previous examples (nvme block driver, i2c
> driver, gpio driver), how about looking at the drivers used by your
> current desktop and picking something that you use today that actually
> talks to hardware?

With my GPIO maintainer hat on I'd say a GPIO driver would be quite
interesting to look at. We are two GPIO maintainers and Bartosz is
doing the heavy lifting for the moment so I'm connecting Bartosz to this
discussion. (Now he has to read through the whole backlog,
sorry Bart!)

This is not to say I promise we will merge it or so, but I just generically
like new approaches to old problems so I like this whole thing
overall, despite being critical to some details.

I am also trying to learn Rust. Baby steps.

I also Cced Viresh Kumar who I think is thinking about Rust these
days, using it for one end of a virtio pipe (IIUC) and Andy also brought
up virtio, but now on the other side, in the kernel.

My concern is still whether this really brings Rust closer to the actual
problems we have and that Rust can solve. If the problem is really
about real world security issues, I would ask Kees where the actual
attack surface of the kernel is. He knows.

It kind of matters. EternalBlue (WannaCry) was a horrific Windows
exploit in that it shows us pretty well what kind of cyberweapons the
intelligence agencies of the world have been constructing and
stockpiling, and probably also used. We need to put countermeasures
where such exploits are likely to hit, yesterday. Intuitively I would
say any in-kernel network daemons, anything complex that
responds directly to network traffic, is a good thing to fix. I do not
know why people are so hung up on device drivers. I would
look at something like fs/nfsd or what else is there that act like
this? ksmbd is out-of-tree. Maybe contribute ksmbd in the form
of Rust and show how nicely this implementation of SMB avoid
all the dangers exposed in WannaCry for Windows? That kind of
stuff would build real trust.
KSMBD in C is there:
https://github.com/namjaejeon/ksmbd

If the problem is security in the sense of being secure from random
crashes and general instability, drivers is an as good place to start as
any.

Yours,
Linus Walleij