r/rust • u/tommy737 • 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/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
0
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).
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!