-
Notifications
You must be signed in to change notification settings - Fork 102
Preliminary support for AWS Nitro Enclaves #325
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
cc @slp |
e202171
to
299f3f9
Compare
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.
Great work! I haven't tested the code yet, but so far things are looking good. I added a couple nits here and there.
In general, I would prefer if the commits were ordered such that changes in src/ come first, then include/, then finally examples/. My thought process behind this is it prevents the use of the API before the functionality is fully baked. Then, once we have the "backend" code, we can add the UAPI, then finally the example when everything's in a state where a working solution is possible. I think that would be a pretty invasive change here so I'm not asking you to do that, but I'm not sure how others feel about commit ordering in that sense.
I would say this is up to personal preference. You could include the However, this is not true if you make a change that would break a caller's use of an API. In that scenario, the changes to the caller must be also included (in |
dd698c8
to
00be2da
Compare
@@ -13,6 +13,7 @@ efi = ["blk", "net"] | |||
gpu = ["rutabaga_gfx", "thiserror", "zerocopy", "zerocopy-derive"] | |||
snd = ["pw", "thiserror"] | |||
virgl_resource_map2 = [] | |||
nitro = [] |
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.
question: do we want to follow some sort of naming convention with the TEE features? We currently have amd-sev
which is prefixed by the manufacturer, intel-tdx
which will follow that style as well. We also have nitro
and in the future cca
.
Should we come to some sort of consensus with regards to a manufacturer prefix or not? Does it matter?
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 could. I prefer sev
and tdx rather than amd-sev
and intel-tdx
FWIW.
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.
Code LGTM
@slp Can you review when you have the chance? |
3d92cb6
to
a66470d
Compare
3fd01b4
to
c1615f6
Compare
@jakecorrenti @slp After rebasing, I'm seeing a weird issue. Each test is failing with the following:
I didn't change any of the |
upstream kvm-bindings wrapped |
Yes, but I never updated those dependencies? Regardless, it seems that #348 fixed it. Thanks! |
The nitro flavor introduces support for libkrun acting as a "driver" and manager for AWS Nitro Enclaves. Signed-off-by: Tyler Fanelli <[email protected]>
Nitro enclaves' memory regions are defined by enclave image files. Introduce a libkrun API to set an enclave's image from a file path as well as the type of enclave image it is. Currently, only Enclave Image Format (EIF) files are supported for nitro enclaves. Signed-off-by: Tyler Fanelli <[email protected]>
The guest/libkrun process will initiate the communication of vsock data from a nitro enclave. Signed-off-by: Tyler Fanelli <[email protected]>
You changed src/utils/Cargo.toml to use kvm-bindings >= 0.10 instead of 0.11 which probably triggered the update if I had to guess |
Yea, that must've been a mistake. Removed that change. |
The nitro module/crate will serve as the main management layer for nitro enclaves. Collecting enclave resources from a krun context will allow us to re-use the existing libkrun APIs for nitro enclaves. Signed-off-by: Tyler Fanelli <[email protected]>
The nitro example will run a nitro enclave in debug mode and print the vsock data from the enclave to the console. Signed-off-by: Tyler Fanelli <[email protected]>
Uses the nitro-enclaves crate to create and run an enclave in debug mode. Signed-off-by: Tyler Fanelli <[email protected]>
To give more control to the user, allow for the krun_add_vsock_port API to forward enclave data to/from and IPC socket set up by a consumer of the library. Signed-off-by: Tyler Fanelli <[email protected]>
Signed-off-by: Tyler Fanelli <[email protected]>
The nitro workspace member is not supported on macOS and has Linux-exclusive dependencies. Exclude the crate when running clippy on macOS. Signed-off-by: Tyler Fanelli <[email protected]>
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.
LGTM
This PR adds a new flavor,
libkrun-nitro
. The nitro flavor is expected to be run on AWS EC2 instances that support AWS Nitro Enclaves.AWS Nitro Enclaves are fully isolated and highly constrained virtual machines that run on the Nitro hypervisor. CPUs and memory of an enclave are completely isolated from a parent instance and other users of a system, significantly reducing the attack surface and helping to prevent the stealing/tampering of data.
Try for yourself
To demo on an AWS EC2 instance with Nitro Enclaves enabled:
nitro
branchlibkrun-nitro
flavornitro
exampleexamples/test_data
This will run the enclave in debug mode, where you can examine debug output from the nitro enclave.
This will include Linux kernel logs:
As well as a hello message from the enclave: