From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Dorjoy Chowdhury <dorjoychy111@gmail.com>
Cc: qemu-devel@nongnu.org, graf@amazon.com, agraf@csgraf.de,
stefanha@redhat.com, pbonzini@redhat.com, slp@redhat.com,
richard.henderson@linaro.org, eduardo@habkost.net,
mst@redhat.com, marcel.apfelbaum@gmail.com, philmd@linaro.org
Subject: Re: [PATCH v5 7/8] machine/nitro-enclave: New machine type for AWS Nitro Enclaves
Date: Wed, 28 Aug 2024 16:39:17 +0100 [thread overview]
Message-ID: <Zs9EpTY9N6kl1VNJ@redhat.com> (raw)
In-Reply-To: <20240822150849.21759-8-dorjoychy111@gmail.com>
On Thu, Aug 22, 2024 at 09:08:48PM +0600, Dorjoy Chowdhury wrote:
> AWS nitro enclaves[1] is an Amazon EC2[2] feature that allows creating
> isolated execution environments, called enclaves, from Amazon EC2
> instances which are used for processing highly sensitive data. Enclaves
> have no persistent storage and no external networking. The enclave VMs
> are based on the Firecracker microvm with a vhost-vsock device for
> communication with the parent EC2 instance that spawned it and a Nitro
> Secure Module (NSM) device for cryptographic attestation. The parent
> instance VM always has CID 3 while the enclave VM gets a dynamic CID.
>
> An EIF (Enclave Image Format)[3] file is used to boot an AWS nitro enclave
> virtual machine. This commit adds support for AWS nitro enclave emulation
> using a new machine type option '-M nitro-enclave'. This new machine type
> is based on the 'microvm' machine type, similar to how real nitro enclave
> VMs are based on Firecracker microvm. For nitro-enclave to boot from an
> EIF file, the kernel and ramdisk(s) are extracted into a temporary kernel
> and a temporary initrd file which are then hooked into the regular x86
> boot mechanism along with the extracted cmdline. The EIF file path should
> be provided using the '-kernel' QEMU option.
>
> In QEMU, the vsock emulation for nitro enclave is added using vhost-user-
> vsock as opposed to vhost-vsock. vhost-vsock doesn't support sibling VM
> communication which is needed for nitro enclaves. So for the vsock
> communication to CID 3 to work, another process that does the vsock
> emulation in userspace must be run, for example, vhost-device-vsock[4]
> from rust-vmm, with necessary vsock communication support in another
> guest VM with CID 3. Using vhost-user-vsock also enables the possibility
> to implement some proxying support in the vhost-user-vsock daemon that
> will forward all the packets to the host machine instead of CID 3 so
> that users of nitro-enclave can run the necessary applications in their
> host machine instead of running another whole VM with CID 3. The following
> mandatory nitro-enclave machine option has been added related to the
> vhost-user-vsock device.
> - 'vsock': The chardev id from the '-chardev' option for the
> vhost-user-vsock device.
>
> AWS Nitro Enclaves have built-in Nitro Secure Module (NSM) device which
> has been added using the virtio-nsm device added in a previous commit.
> In Nitro Enclaves, all the PCRs start in a known zero state and the first
> 16 PCRs are locked from boot and reserved. The PCR0, PCR1, PCR2 and PCR8
> contain the SHA384 hashes related to the EIF file used to boot the VM
> for validation. The following optional nitro-enclave machine options
> have been added related to the NSM device.
> - 'id': Enclave identifier, reflected in the module-id of the NSM
> device. If not provided, a default id will be set.
> - 'parent-role': Parent instance IAM role ARN, reflected in PCR3
> of the NSM device.
> - 'parent-id': Parent instance identifier, reflected in PCR4 of the
> NSM device.
>
> [1] https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html
> [2] https://aws.amazon.com/ec2/
> [3] https://github.com/aws/aws-nitro-enclaves-image-format
> [4] https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock
>
> Signed-off-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
> ---
> MAINTAINERS | 9 +
> backends/hostmem-memfd.c | 2 -
> configs/devices/i386-softmmu/default.mak | 1 +
> hw/core/machine.c | 71 ++---
> hw/core/meson.build | 3 +
> hw/i386/Kconfig | 6 +
> hw/i386/meson.build | 3 +
> hw/i386/microvm.c | 6 +-
> hw/i386/nitro_enclave.c | 355 +++++++++++++++++++++++
> include/hw/boards.h | 2 +
> include/hw/i386/microvm.h | 2 +
> include/hw/i386/nitro_enclave.h | 62 ++++
> include/sysemu/hostmem.h | 2 +
> 13 files changed, 488 insertions(+), 36 deletions(-)
> create mode 100644 hw/i386/nitro_enclave.c
> create mode 100644 include/hw/i386/nitro_enclave.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index da4f698137..aa7846107e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1877,6 +1877,15 @@ F: hw/i386/microvm.c
> F: include/hw/i386/microvm.h
> F: pc-bios/bios-microvm.bin
>
> +nitro-enclave
> +M: Alexander Graf <graf@amazon.com>
> +M: Dorjoy Chowdhury <dorjoychy111@gmail.com>
> +S: Maintained
> +F: hw/core/eif.c
> +F: hw/core/eif.h
The eif.c/h files were added in the prevuous patch, so upto this line
should be added in the previous patch.
> +F: hw/i386/nitro_enclave.c
> +F: include/hw/i386/nitro_enclave.h
These two lines can remain in this patch
> Machine core
> M: Eduardo Habkost <eduardo@habkost.net>
> M: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> diff --git a/hw/core/meson.build b/hw/core/meson.build
> index a3d9bab9f4..5437a94490 100644
> --- a/hw/core/meson.build
> +++ b/hw/core/meson.build
> @@ -24,6 +24,9 @@ system_ss.add(when: 'CONFIG_REGISTER', if_true: files('register.c'))
> system_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c'))
> system_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c'))
> system_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c'))
> +if libcbor.found() and gnutls.found()
> + system_ss.add(when: 'CONFIG_NITRO_ENCLAVE', if_true: [files('eif.c'), zlib, libcbor, gnutls])
> +endif
>
> system_ss.add(files(
> 'cpu-sysemu.c',
This change to meson.build should be in the previous patch, since
that's the one that introduces eif.c.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2024-08-28 15:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 15:08 [PATCH v5 0/8] AWS Nitro Enclave emulation support Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 1/8] crypto: Define macros for hash algorithm digest lengths Dorjoy Chowdhury
2024-08-28 15:33 ` Daniel P. Berrangé
2024-08-22 15:08 ` [PATCH v5 2/8] crypto: Support SHA384 hash when using glib Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 3/8] crypto: Introduce x509 utils Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 4/8] tests/lcitool: Update libvirt-ci and add libcbor dependency Dorjoy Chowdhury
2024-08-28 15:34 ` Daniel P. Berrangé
2024-08-22 15:08 ` [PATCH v5 5/8] device/virtio-nsm: Support for Nitro Secure Module device Dorjoy Chowdhury
2024-08-28 18:28 ` Michael S. Tsirkin
2024-08-28 19:04 ` Dorjoy Chowdhury
2024-08-28 19:11 ` Michael S. Tsirkin
2024-09-03 19:58 ` Dorjoy Chowdhury
2024-09-03 20:32 ` Michael S. Tsirkin
2024-09-03 20:47 ` Dorjoy Chowdhury
2024-09-04 18:30 ` Dorjoy Chowdhury
2024-09-04 20:27 ` Michael S. Tsirkin
2024-09-04 20:45 ` Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 6/8] hw/core: Add Enclave Image Format (EIF) related helpers Dorjoy Chowdhury
2024-08-28 15:42 ` Daniel P. Berrangé
2024-08-22 15:08 ` [PATCH v5 7/8] machine/nitro-enclave: New machine type for AWS Nitro Enclaves Dorjoy Chowdhury
2024-08-28 15:39 ` Daniel P. Berrangé [this message]
2024-08-28 15:50 ` Dorjoy Chowdhury
2024-08-29 8:14 ` Daniel P. Berrangé
2024-09-05 20:00 ` Dorjoy Chowdhury
2024-08-22 15:08 ` [PATCH v5 8/8] docs/nitro-enclave: Documentation for nitro-enclave machine type Dorjoy Chowdhury
2024-09-05 20:03 ` [PATCH v5 0/8] AWS Nitro Enclave emulation support Dorjoy Chowdhury
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zs9EpTY9N6kl1VNJ@redhat.com \
--to=berrange@redhat.com \
--cc=agraf@csgraf.de \
--cc=dorjoychy111@gmail.com \
--cc=eduardo@habkost.net \
--cc=graf@amazon.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=slp@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).