-
Notifications
You must be signed in to change notification settings - Fork 132
nitro: Preliminary networking support with passt, remove cached EIF #491
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
Conversation
Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
Add an optional boolean argument to enable networking with passt. Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
In order to re-use the existing APIs, copy the network builder from the VM resources into the object used for building nitro enclaves. Before copying the Net object over, ensure it is a UNIX stream socket, as nitro enclaves will require stream sockets for networking. Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
Instead of defining VMADDR_CID_PARENT and connecting to the heartbeat vsock through that value, connect to the host directly with VMADDR_CID_HOST within the enclave. Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
c9fc43e to
fafd987
Compare
fafd987 to
41671b7
Compare
The only usable communication interface within enclaves is vsock. As such, networking "within" an enclave will rely on the host providing a networking proxy with traffic forwarded to/from a vsock communciation with the enclave. Initialize a TAP device within the enclave and facilitate TAP/passt communication via vsock. Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
Due to the large size of EIF files, it is untenable to cache it (even compressed) within the nitro/src directory. Instead, cache the file on the system and specify the path of it with the KRUN_NITRO_EIF_PATH environment variable. If this environment variable is not specified, default to /usr/share/krun-nitro.eif as the location of the cached EIF file. Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
41671b7 to
c8c8cf9
Compare
|
@jakecorrenti This offers the preliminary support for you to rebase on top of. I'll revisit with a second patch series removing the unwraps and adding general cleanups after your PR is merged. The next changes will include both the application output and networking. If you approve, we can merge this series, rebase yours on top, and merge that as well. |
jakecorrenti
left a comment
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.
I stopped giving comments mid-way through after our meeting, but I didn't see anything in particular that would block from merging as long as we go back in with another PR like you said.
| ffi::{CString, OsStr}, | ||
| fs, | ||
| io::{self, ErrorKind, Read, Write}, | ||
| io::{self, Read, Write}, |
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.
In a separate PR we should probably add a Clippy CI check for the nitro feature so that we can catch these things at review.
| match device.lock().unwrap().backend() { | ||
| VirtioNetBackend::UnixstreamFd(_) | VirtioNetBackend::UnixstreamPath(_) => { | ||
| } | ||
| _ => { | ||
| error!("configured virtio-net backend must be unix stream"); | ||
| return Err(-libc::EINVAL); | ||
| } | ||
| }; |
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.
Might look a little cleaner, but up to you :)
if !matches!(
device.lock().unwrap().backend(),
VirtioNetBackend::UnixstreamFd(_) | VirtioNetBackend::UnixstreamPath(_)
) {
error!("configured virtio-net backend must be unix stream");
return Err(-libc::EINVAL);
}
src/nitro/src/enclaves.rs
Outdated
| self.write_exec(&mut stream)?; | ||
|
|
||
| Ok(cid) | ||
| match fork::fork().unwrap() { |
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.
Why do we need a new crate to do this? Can't we just use libc::fork()?
Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
No description provided.