-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add support for running Confidential Workloads with AMD SEV #36
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the regular version of libkrun, the integrated VMM starts booting directly in 64 bits and into the kernel entry point, after setting up some initial data structures (page tables, e820, mptables...). With SEV, those data structures are problem, as they become part of the launch measurement. So, if targeting SEV, use qboot as firmware, loading it into the reset, and don't set those initial data structures (they'll be set by qboot after the VM is started). This commit also introduces the "amd-sev" feature to allow users to choose this flavor or the library. Signed-off-by: Sergio Lopez <slp@redhat.com>
Linux on SEV requires MTRR and PAT, so enable and configure the MSR for MTRRdefType. Signed-off-by: Sergio Lopez <slp@redhat.com>
Introduce initial plain SEV support. This sets the stage for adding remote attestation, SEV-ES and SEV-SNP in the future. This functionality is gated behind the "amd-sev" feature defined in the workspace's Cargo. In practice, this means now libkrun comes in two different flavors, regular libkrun (for container isolation) and SEV-enabled libkrun (for Confidential Computing). Signed-off-by: Sergio Lopez <slp@redhat.com>
Import virtio-block support from Firecraker, and use it to replace virtio-fs in the SEV flavor. Extend the API with the "krun_set_root_disk()" function to allow users to configure the disk image that contains the root filesystem. While there, disable also virtio-balloon when targeting libkrun-SEV. Signed-off-by: Sergio Lopez <slp@redhat.com>
With virtio-fs gone, we need a trusted place to put the "init" binary that sets up the environment in the guest for running the workload entry point and, in case of using LUKS, to unlock the root file system. The obvious replacement is using an initramfs. This change extends libkrun to load the initrd bundled in the SEV variant of libkrunfw. Signed-off-by: Sergio Lopez <slp@redhat.com>
If the KRUN_PASS environment variable is present, use cryptsetup to open a LUKS volume in "/dev/vda" and, if successful, mount it and switch to it as root file system. Signed-off-by: Sergio Lopez <slp@redhat.com>
Implement support for Remote Attestation using a simple custom protocol over HTTP, serializing and deserializing SEV-related data structures as JSON objects. This also adds the "krun_set_attestation_url()" function to the API (only for libkrun-SEV), to enable users set up the base URL for the attestation server. If missing, libkrun-SEV will still encrypt the guest's memory, but it's initial contents won't be attested. Signed-off-by: Sergio Lopez <slp@redhat.com>
Detect AMD CPU model (from the SEV supported range) and use it to download the ASK/ARK certificate. Signed-off-by: Sergio Lopez <slp@redhat.com>
Add the examples "sev-attest" and "sev-noattest" to test the SEV functionality. The first one ("sev-attest") enables SEV and does remote attestation, receiving the LUKS passphrase and the rest of the command line (which includes the workload entry point) from the remote attestation server in pre-encrypted form, so it can be safely injected into the guest memory by the VMM. The other ("sev-noattest") also enables SEV (and thus, memory encryption), but doesn't attempt to do a remote attestation, and as a consequence, both the LUKS passphrase and the command line are passed in plain text through the VMM. Signed-off-by: Sergio Lopez <slp@redhat.com>
Add the SEV flag to Makefile and examples/Makefile, to allow users to easily opt-in to build the SEV flavor of both libkrun and the examples by passing "SEV=1" to "make". Signed-off-by: Sergio Lopez <slp@redhat.com>
Increase the RAM of the SEV examples (sev-attest and sev-noattest) from 512 MiB to 2 GiB, so cryptsetup is able to open LUKS2 volumes. Signed-off-by: Sergio Lopez <slp@redhat.com>
kvm_bindings::CpuId API has changed slightly, update related code. Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Sergio Lopez <slp@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.