News for hackers. Stuff that matters.
Re:Testing the memory safe Rust implementation of Sudo/Su by jeffbee on Wednesday June 28, 2023 @11:15AM (#36507699)
You might be overestimating the popularity of Go within Google.

That said, a tool like sudo should be written almost entirely in a very high-level language that is easy to use and review. C, C++, or even Rust should be reserved for places where the system interface requires it, if there are any such points of interface.

Re:Testing the memory safe Rust implementation of Sudo/Su by Chabsff on Wednesday June 28, 2023 @11:20AM (#36507786)
On the flip side, languages like C,C++ and Rust have the major benefit of having next to no runtime component to it, allowing trace-driven fuzz testing to achieve a much higher level of confidence in its test coverage. For a tool like sudo, this can matter a lot.
Re:Testing the memory safe Rust implementation of Sudo/Su by nullc on Wednesday June 28, 2023 @02:19PM (#36510413)
I think this is really important and it's a big part of what makes it unrealistic to write critical software in Python or Java: It's too slow to get extremely deep testing, even with fancy tricks like snapshotting the execution state to avoid startup costs.

But, that said, Rust code compiled in debug mode which required to get integer overflow detection is slow enough that it severely degrades the ability to use fuzz testing on many codebases, FWIW. I believe the reason is that debug mode always disables numerous optimizations that are required to make rust performant at all because of all the boilerplate emitted by earlier stages of compilation.

AFAIK there isn't a way to get the equivalent of GCC's "-fsanitize=undefined" (or -ftrapv) for checking for unexpected overflows at a performance cost similar to "-fsanitize=undefined" performance cost on C code.

It's still a much better situation than python or java, I think-- but an area that could use improvement which won't be improved if rust is above criticism.

Re:Testing the memory safe Rust implementation of Sudo/Su by steveklabnik on Wednesday June 28, 2023 @02:36PM (#36510623)
You can pretty trivially turn on overflow checks yet compile with all of the other release options as normal. It's one line in cargo.toml or one flag to rustc.
Re:Testing the memory safe Rust implementation of Sudo/Su by nullc on Wednesday June 28, 2023 @02:46PM (#36510758)
What is the one line? (I shall benchmark!)
Re:Testing the memory safe Rust implementation of Sudo/Su by steveklabnik on Wednesday June 28, 2023 @02:58PM (#36510929)
iirc it's `-C overflow-checks=y` to rustc or

  [profile.release]
  overflow-checks = false
in cargo.toml.

I would probably use the flags with RUSTFLAGS to make sure that it goes to all dependencies and not just the crate you're building, if what you're building has dependencies.

Re:Testing the memory safe Rust implementation of Sudo/Su by nullc on Wednesday June 28, 2023 @05:04PM (#36512576)
Thanks!
Re:Testing the memory safe Rust implementation of Sudo/Su by steveklabnik on Thursday June 29, 2023 @11:33PM (#36530214)
… I just realized that second should have been true not false. Lol. Hope I didn’t lead you astray.
Re:Testing the memory safe Rust implementation of Sudo/Su by c_crank on Wednesday June 28, 2023 @11:17AM (#36507725)
A job for Common Lisp!