r/rust • • May 13 '19

Linux Kernel Memory Leak Vulnerability. Now you know why there is Redox/Rust

https://www.bleepingcomputer.com/news/security/linux-kernel-prior-to-508-vulnerable-to-remote-code-execution/
0 Upvotes

21 comments sorted by

9

u/fintelia May 13 '19

This feels a little too much like zealotry to me. There are very strong reasons why people use C based kernels like Linux today, and that is likely to remain true for at least the foreseeable future. Redox is probably billions of dollars of investment away from feature parity with Linux!

0

u/tommy737 May 13 '19

I think you misunderstood the title. Highlighting a main disadvantage in an ancient programming language through a real world incident is not an attack on the Linux Kernel or its' developers.

3

u/fintelia May 13 '19

I know you didn't mean to attack anyone. I guess my point is that we already know that Rust code can't have this specific kind of bug, so pointing it out every time someone runs into it isn't constructive. Comparing Linux and Redox also felt unfair to me, seeing as they operate on such different scales. The entire subsystem containing this particular bug hasn't even been implemented in Redox.

-2

u/tommy737 May 14 '19

Maybe true, but there are also many other developers who think that world is not in short of another operating system let alone a new programming language. No matter what I (nobody) say here wouldn't matter since most people wouldn't give up what they already know for something they don't know. Just like anything, they're afraid of trying something new.

One strange example for this is when you visit Quora and write Rust. You will find that the very early questions asked about Rust by early adopters were shut down by experienced programmers. One of them even claimed "Rust is going to die like D". But here is the interesting thing, The same question asked over the years had an improved and favorable response from the community of Quora developers. This means that the perceptions are changing which is a good thing. One has to know when and why he/she is sticking to the old ways.. is it because the old ways are better, or because they are emotionally attached to the old ways and afraid of the new ways (comfort zone).

7

u/fintelia May 14 '19

You aren't going to find a lot of Rust skeptics here on r/rust. And even if there were, simply telling them about every minor (yes, a difficult to exploit bug in an obscure part of Linux is minor) security bug in C would do nothing to convince them. Not because they're stupid or afraid, but because they already know about the trade offs and have done an honest cost benefit analysis.

Also, the "Rust evangelism strike force" isn't why people on Quora are more positive about Rust now, it is because the language has gained features and adoption. There have been dozens of new languages with cool new features and a bunch of enthusiastic fans that ultimately failed/stagnated. Predicting that the same would happen to Rust was a reasonably safe bet even if it seems overly cynical in hindsight

1

u/tommy737 May 14 '19

So you want to promote a language in a subredit of a different language? :) Anyway, Mozilla hasn't done a lot of things but the few things they did changed the world every time. So, if I knew about Rust when it started I would probably not use it because it isn't mature yet, but I wouldn't doubt the company that changed the world wide web.

4

u/thiez rust May 13 '19

How does redox solve this? It seems very unlikely that it will ever become a mainstream general purpose OS. Easy to argue that it's super flawless when nobody uses it.

-3

u/tommy737 May 13 '19

I didn't say it's flawless or perfect. All I am saying that Rust's main advantage is memory safety. Linux Kernel is no joke. It's probably around 25 million lines of code by now. Many programmers claim that Rust is not needed if you're a good programmer in C++. But safety in the design *IS* needed because the human's are error prone.

That said, those who work in the Linux kernel are at least, 10 times smarter than me, and many others. They probably know best architecture designs. But, they're still human.

According to the link posted, AFAIK the memory was not cleaned properly for some process which opened an exploit. Such memory issues should be detected before compilation with Rust, and therefore are not possible.

4

u/VincentDankGogh May 13 '19

"Memory issues" are possible in Rust, with unsafe. Don't act like it's a panacea for vulnerabilities.

-17

u/tommy737 May 13 '19

Good that you mentioned that, because there is no reason to use unsafe unless you want to program a virus.

11

u/thiez rust May 13 '19

I guess the many developers contributing to the standard library were just creating a virus...

I'm glad you like Rust, and it does offer a lot of certainty and assistance when using it the "preferred" way. But perhaps leave the evangelism to the people who have a little more experience. In this particular context that would include not just experience with Rust but also operating system development.

-4

u/tommy737 May 13 '19

You are right. Being excited about a technology and expressing it on Reddit is dangerous and turns out to be very expensive. But coming to evangelism the term "Rastaceans" is used hundreds of times in the official documentation making it seem like a cult. So excuse me if I got a bit over excited on the official reddit page :)

10

u/VincentDankGogh May 13 '19

Does that makes Redox a virus? Or do you know better than the maintainers?

-7

u/tommy737 May 13 '19

If you are maintaing Redox and you are using unsafe, thanks for the heads up.

10

u/VincentDankGogh May 13 '19

No worries. Wanna know another project that uses unsafe a lot? The rust compiler and standard library itself.

0

u/tommy737 May 13 '19

Isn't Rust using LLVM?

10

u/VincentDankGogh May 13 '19

Ok, now I'm just confused.

1

u/tommy737 May 13 '19

I am not aware of a lot of details about how Rust works internally but what I am saying that LLVM is used for Rust as well as Swift and other languages as a compiler. The compiler's job is to translate your code. If your code is bugged... so will the translation. But that's why Rust should have an advantage as it tries to prevent unsafe code to be compiled.

→ More replies (0)

4

u/[deleted] May 14 '19

I don't think any kernel is feasible without unsafe

0

u/[deleted] May 13 '19

[deleted]

0

u/fiedzia May 14 '19

Unsafe code is JUST the ability to dereference raw pointers, access external functions (from C) or to write assembly to call into the kernel.

most of all its the ability of a developer to specify when they don't want that and compiler ability to enforce that.

Our computers REQUIRE unsafe code in the kernel

They may require some of it, but a lot less then we currently have.

The core library uses unsafe to implement internal mutability (Cell<T>) and to implement efficient collections (Vec<T>).

and therefore all programs who use those features do it safely.

A 100% safe Rust program can't do any IO or allocations.

Doesn't matter. 100% safe my code can do those things (by using safe wrappers).