-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite it in Rust #1
Conversation
A note that the Let me know if you need me to change the |
There's an open PR to deduplicate this in It will only benefit us when |
|
Hm... yes, that's quite significant. For components that are as relatively simple as |
Switching to |
Working on cutting this down further... |
Both binaries are down to 1.1 MiB respectively. This was primarily achieved by disabling the And we're also being explicit with all feature flags now, i.e. |
I've noticed a problem from my testing:
|
crates/krun/src/net.rs
Outdated
|
||
// SAFETY: `child_fd` is an `OwnedFd` and consumed to prevent closing on drop. | ||
// See https://doc.rust-lang.org/std/io/index.html#io-safety | ||
let child = Command::new(passt_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to explicitly kill the (not possible to do)Child
: https://doc.rust-lang.org/std/process/struct.Child.html#method.kill
Also, it seems like krun
is exiting with -1
status code, perhaps because of sommelier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a problem...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a limitation of libkrun
(containers/libkrun#10). We need to implement a mechanism to relay signals to the main process in the VM and the exit code from it to the host. It's been open since a long time, but being a low priority issue we never got to implement it.
Thanks a lot for the work put on this PR. Merging it! |
Oops! I will send a follow-up PR. |
Replaces slp/krun.legacy#4
As discussed in slp/krun.legacy#1 (comment)
Bugs fixed:
Current implementation of
krun
incorrectly passes own arguments tokrun-guest
, e.g.Stop using hardcoded
/tmp/passt_1.socket
When forking
krun-guest
to rundhclient
in child process, stdin/stdout/stderr were illegally closed.See https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html#tag_16_67_07
File exists (os error 17)
when trying to create the temp directory forXDG_RUNTIME_DIR
after the first run.Use properly unique temp dir names for each run.
Dependency tree with
cargo tree -e normal --no-dedupe
(excludingbuild-dependencies
):Requires: