qemu/cvm-bug-fix-for-disable-DTB-randomness-for-confident.patch
liupingwei bad58948c0 QEMU update to version 6.2.0-95
- cvm: bug-fix for disable DTB randomness for confidential VMs

Signed-off-by: liupingwei <liupingwei0317@outlook.com>
2024-06-21 09:48:48 +08:00

41 lines
1.3 KiB
Diff

From 892657386e36e72395c23cec61457dfa0e1bb8f4 Mon Sep 17 00:00:00 2001
From: liupingwei <liupingwei0317@outlook.com>
Date: Wed, 19 Jun 2024 17:43:35 +0800
Subject: [PATCH] cvm: bug-fix for disable DTB randomness for confidential VMs
The previous condition relied on virtcca_cvm_enabled,which was not
initialized in time.
Now,we directly check the KVM type and disable DTB randomness if the
type is "cvm".
Fixes:2830db7bec600915e88bb22847a66d99b047a308("hw/arm/virt:Disable DTB
randomness for confidential VMs")
Signed-off-by: liupingwei <liupingwei0317@outlook.com>
---
hw/arm/virt.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e0de08e2c1..dc119732f0 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -261,7 +261,13 @@ static void create_fdt(VirtMachineState *vms)
/* /chosen must exist for load_dtb to fill in necessary properties later */
qemu_fdt_add_subnode(fdt, "/chosen");
- if (!virtcca_cvm_enabled()) {
+
+ g_autofree char *kvm_type = NULL;
+ if (object_property_find(OBJECT(current_machine), "kvm-type")) {
+ kvm_type = object_property_get_str(OBJECT(current_machine),
+ "kvm-type", &error_abort);
+ }
+ if (!(kvm_type && !strcmp(kvm_type, "cvm"))) {
create_kaslr_seed(ms, "/chosen");
}
--
2.31.1.windows.1