Rewrite parts of firejail in Rust #4386
Replies: 8 comments 12 replies
-
FWIW I can definately see the interesting features of Rust for profile parsing. As to the con of a new dependency personally I wouldn't mind. Rust seems to be very well supported and rustup is a great way to add it to an OS that doesn't offer Rust via native package management tools. Then again, my opinion isn't worth much, I don't get to decide stuff like this and that's fine :-) |
Beta Was this translation helpful? Give feedback.
-
I 'm not a programmer but think it's certainly a good idea in order to produce safe code. There are some projects that help to convert C code to Rust: https://github.com/immunant/c2rust One question: does anybody have a clue which Firejail vulnerabilities in the past would have been prevented by Rust? |
Beta Was this translation helpful? Give feedback.
-
With #4656 this is becoming interesting again. Did you know that #![feature(c_size_t)]
use std::os::raw::*;
extern "C" {
fn write(fd: c_int, buf: *const c_void, count: c_size_t) -> c_ssize_t;
}
fn main() {
const HELLO_WORD: &[u8; 14] = b"Hello, World!\n";
unsafe {
write(1, HELLO_WORD as *const _ as *const c_void, HELLO_WORD.len());
}
}
|
Beta Was this translation helpful? Give feedback.
-
I like the idea, but feel like Rust ecosystem has often overboarding amounts of dependencies which makes code reusage hard.
How much parsing did you do in Rust so far?
+- frameworks do not support tracing a parse, because that requires macros on every function, which makes compilation time very big. (though last time I checked ca. 1 year ago)
Providing |
Beta Was this translation helpful? Give feedback.
-
Is anyone interested in doing this if sponsored? Either rewriting parts of it or creating a profile compatible reimplementation? |
Beta Was this translation helpful? Give feedback.
-
Related: |
Beta Was this translation helpful? Give feedback.
-
I don't like Rust. On gentoo linux, building rust is a pain in the ass because gentoo has to build packages without network access. If I had to build multiple rust components in firejail, I may not be able to build firejail on gentoo linux. Gentoo linux already downloads anki binary because anki depends on python rust wheels and npm for build. Don't make build process complex. If you are going to write some components in rust, build everything in one rust project, and produce a smaller binary with rust. If profile parsing was split into a rust binary, gentoo can still build firejail. If firejail has to build multiple rust binaries, gentoo may need to start downloading firejail binary. |
Beta Was this translation helpful? Give feedback.
-
@rusty-snake commented on Oct 11:
Some of the main appeals of firejail to me is that it is written in C, is Also (and this part more subjecitve I suppose), usually I can make sense of the Ultimately, the additional complexity and reduced portability seem like a high I think that compared to C, Rust targets a different kind of audience, in the So (maybe save for big and/or complex projects) it doesn't seem to make much In other words, it seems like it would make much more sense to create a As for using a helper/scripting language, I'll post that in a separate comment. Edit: Posted in a new discussion: |
Beta Was this translation helpful? Give feedback.
-
Rewrite parts of firejail (namely profile-parsing) in Rust.
Pros
whitelist
andblacklist
commands with better terms #3447, Support subpaths in macros (like ${PICTURES}/Screenshots) #2359 is much easier.Just compare
Cons
What do you think? Is this something we should follow?
Beta Was this translation helpful? Give feedback.
All reactions