qemu/hw
Dorjoy Chowdhury f1826463d2 machine/nitro-enclave: New machine type for AWS Nitro Enclaves
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>
Reviewed-by: Alexander Graf <graf@amazon.com>
Link: https://lore.kernel.org/r/20241008211727.49088-6-dorjoychy111@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-10-31 18:28:33 +01:00
..
9pfs 9p: remove 'proxy' filesystem backend driver 2024-10-03 19:33:25 +02:00
acpi acpi: ged: Add macro for acpi sleep control register 2024-10-16 15:56:42 +08:00
adc hw/adc: Remove MAX111X device 2024-10-15 15:16:17 +01:00
alpha
arm aspeed queue: 2024-10-25 13:35:22 +01:00
audio replace error_setg(&error_fatal, ...) with error_report() 2024-10-21 22:40:47 +03:00
avr
block hw/block/m25p80: Add SFDP table for w25q80bl flash 2024-10-24 07:57:47 +02:00
char hw/char/pl011: Use correct masks for IBRD and FBRD 2024-10-15 15:16:17 +01:00
core core/machine: Make create_default_memdev machine a virtual method 2024-10-31 18:28:33 +01:00
cpu
cxl hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
display ui: refactor using a common qemu_pixman_shareable 2024-10-14 17:34:09 +04:00
dma hw/dma: Remove omap_dma4 device 2024-10-01 14:58:07 +01:00
fsi hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
gpio hw/gpio/aspeed: Add AST2700 support 2024-10-24 07:57:47 +02:00
hppa hw/char: Extract serial-mm 2024-10-03 19:33:23 +02:00
hyperv hw/hyperv: remove return after g_assert_not_reached() 2024-09-24 13:53:35 +02:00
i2c hw/i2c/aspeed: Add support for 64 bit addresses 2024-09-16 17:44:08 +02:00
i386 machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
ide hw/ide: Remove DSCM-1XXXX microdrive device model 2024-10-15 15:16:17 +01:00
input hw/input: Remove lm832x device 2024-10-01 14:41:10 +01:00
intc hw/intc/openpic: Improve errors for out of bounds property values 2024-10-18 15:03:35 +02:00
ipack
ipmi
isa hw/char/serial.h: Extract serial-isa.h 2024-10-03 19:33:23 +02:00
loongarch hw/loongarch/fw_cfg: Build in common_ss[] 2024-10-16 16:06:07 +08:00
m68k hw/m68k: Use explicit big-endian LD/ST API 2024-10-07 11:33:20 +02:00
mem hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
microblaze hw/char: Extract serial-mm 2024-10-03 19:33:23 +02:00
mips hw/mips: Have mips_cpu_create_with_clock() take an endianness argument 2024-10-15 12:21:06 -03:00
misc hw/misc/aspeed_hace: Fix SG Accumulative hashing 2024-10-24 07:57:47 +02:00
net virtio-net: Avoid indirection_table_mask overflow 2024-10-29 15:53:29 +08:00
nubus hw/nubus/nubus-device: Range check 'slot' property 2024-09-08 11:49:49 +02:00
nvme hw/nvme: add atomic write support 2024-10-01 09:02:05 +02:00
nvram hw: Remove unused fw_cfg_init_io 2024-10-03 17:26:06 +03:00
openrisc hw/char: Extract serial-mm 2024-10-03 19:33:23 +02:00
pci hw/pci: Remove unused pcie_chassis_find_slot 2024-10-03 17:26:06 +03:00
pci-bridge hw/pci-bridge: Add a Kconfig switch for the normal PCI bridge 2024-10-21 13:25:12 +02:00
pci-host q35: Remove unused mch_mcfg_base 2024-10-03 17:26:05 +03:00
ppc hw/char: Extract serial-mm 2024-10-03 19:33:23 +02:00
remote remote: Remove unused remote_iohub_finalize 2024-10-03 17:26:06 +03:00
riscv * pc: Add a description for the i8042 property 2024-10-04 19:28:37 +01:00
rtc hw/rtc: Remove twl92230 device 2024-10-01 14:40:59 +01:00
rx
s390x s390x: Rebuild IPLB for SCSI device directly from DIAG308 2024-10-23 06:53:44 +02:00
scsi hw/vhost-scsi: fix -Werror=maybe-uninitialized 2024-10-02 16:14:29 +04:00
sd hw/sdhci: fix -Werror=maybe-uninitialized false-positive 2024-10-02 16:14:29 +04:00
sensor hw/sensor/tmp105: Lower 4 bit of limit registers are always 0 2024-09-13 20:11:13 +02:00
sh4 Revert "hw/sh4/r2d: Realize IDE controller before accessing it" 2024-10-21 16:40:11 +02:00
smbios smbios: make memory device size configurable per Machine 2024-07-22 20:15:41 -04:00
sparc hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
sparc64 hw/char: Extract serial-mm 2024-10-03 19:33:23 +02:00
ssi aspeed/smc: Fix write incorrect data into flash in user mode 2024-10-24 07:57:47 +02:00
timer hw/timer: Remove omap_synctimer 2024-10-01 14:56:27 +01:00
tpm hw/tpm: remove break after g_assert_not_reached() 2024-09-24 13:53:35 +02:00
tricore hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
ufs hw/ufs: minor bug fixes related to ufs-test 2024-09-06 18:04:16 +09:00
usb hw/usb: Remove MUSB USB host controller 2024-10-01 14:43:02 +01:00
vfio vfio/helpers: Align mmaps 2024-10-23 14:46:24 +02:00
virtio device/virtio-nsm: Support for Nitro Secure Module device 2024-10-31 18:28:32 +01:00
watchdog hw/watchdog: replace assert(0) with g_assert_not_reached() 2024-09-13 20:12:16 +02:00
xen hw/xen: Avoid use of uninitialized bufioreq_evtchn 2024-10-21 07:53:21 +02:00
xenpv
xtensa hw/xtensa/xtfpga: Remove TARGET_BIG_ENDIAN #ifdef'ry 2024-10-15 12:13:59 -03:00
Kconfig hw: Remove PCMCIA subsystem 2024-10-15 15:16:17 +01:00
meson.build hw: Remove PCMCIA subsystem 2024-10-15 15:16:17 +01:00