Skip to content

Conversation

@tylerfanelli
Copy link
Member

No description provided.

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>
@tylerfanelli tylerfanelli changed the title nitro: Add networking support with passt, remove cached EIF nitro: Preliminary networking support with passt, remove cached EIF Dec 19, 2025
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>
@tylerfanelli
Copy link
Member Author

@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
jakecorrenti previously approved these changes Dec 19, 2025
Copy link
Member

@jakecorrenti jakecorrenti left a 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},
Copy link
Member

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.

Comment on lines +395 to +402
match device.lock().unwrap().backend() {
VirtioNetBackend::UnixstreamFd(_) | VirtioNetBackend::UnixstreamPath(_) => {
}
_ => {
error!("configured virtio-net backend must be unix stream");
return Err(-libc::EINVAL);
}
};
Copy link
Member

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);
}

self.write_exec(&mut stream)?;

Ok(cid)
match fork::fork().unwrap() {
Copy link
Member

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>
@tylerfanelli tylerfanelli merged commit a96f21a into containers:main Dec 19, 2025
11 checks passed
@tylerfanelli tylerfanelli deleted the nitro-net branch December 19, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants