@@ -225,6 +225,14 @@ Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead.
System emulator machines
------------------------
+Arm ``virt`` machine ``dtb-kaslr-seed`` property
+''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``dtb-kaslr-seed`` property on the ``virt`` board has been
+deprecated; use the new name ``dtb-randomness`` instead. The new name
+better reflects the way this property affects all random data within
+the device tree blob, not just the ``kaslr-seed`` node.
+
PPC 405 ``taihu`` machine (since 7.0)
'''''''''''''''''''''''''''''''''''''
@@ -126,13 +126,18 @@ ras
Set ``on``/``off`` to enable/disable reporting host memory errors to a guest
using ACPI and guest external abort exceptions. The default is off.
+dtb-randomness
+ Set ``on``/``off`` to pass random seeds via the guest DTB
+ rng-seed and kaslr-seed nodes (in both "/chosen" and
+ "/secure-chosen") to use for features like the random number
+ generator and address space randomisation. The default is
+ ``on``. You will want to disable it if your trusted boot chain
+ will verify the DTB it is passed, since this option causes the
+ DTB to be non-deterministic. It would be the responsibility of
+ the firmware to come up with a seed and pass it on if it wants to.
+
dtb-kaslr-seed
- Set ``on``/``off`` to pass a random seed via the guest dtb
- kaslr-seed node (in both "/chosen" and /secure-chosen) to use
- for features like address space randomisation. The default is
- ``on``. You will want to disable it if your trusted boot chain will
- verify the DTB it is passed. It would be the responsibility of the
- firmware to come up with a seed and pass it on if it wants to.
+ A deprecated synonym for dtb-randomness.
Linux guest kernel configuration
""""""""""""""""""""""""""""""""
@@ -152,7 +152,7 @@ struct VirtMachineState {
bool virt;
bool ras;
bool mte;
- bool dtb_kaslr_seed;
+ bool dtb_randomness;
OnOffAuto acpi;
VirtGICType gic_version;
VirtIOMMUType iommu;
@@ -221,14 +221,18 @@ static bool cpu_type_valid(const char *cpu)
return false;
}
-static void create_kaslr_seed(MachineState *ms, const char *node)
+static void create_randomness(MachineState *ms, const char *node)
{
- uint64_t seed;
+ struct {
+ uint64_t kaslr;
+ uint8_t rng[32];
+ } seed;
if (qemu_guest_getrandom(&seed, sizeof(seed), NULL)) {
return;
}
- qemu_fdt_setprop_u64(ms->fdt, node, "kaslr-seed", seed);
+ qemu_fdt_setprop_u64(ms->fdt, node, "kaslr-seed", seed.kaslr);
+ qemu_fdt_setprop(ms->fdt, node, "rng-seed", seed.rng, sizeof(seed.rng));
}
static void create_fdt(VirtMachineState *vms)
@@ -251,14 +255,14 @@ 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 (vms->dtb_kaslr_seed) {
- create_kaslr_seed(ms, "/chosen");
+ if (vms->dtb_randomness) {
+ create_randomness(ms, "/chosen");
}
if (vms->secure) {
qemu_fdt_add_subnode(fdt, "/secure-chosen");
- if (vms->dtb_kaslr_seed) {
- create_kaslr_seed(ms, "/secure-chosen");
+ if (vms->dtb_randomness) {
+ create_randomness(ms, "/secure-chosen");
}
}
@@ -2340,18 +2344,18 @@ static void virt_set_its(Object *obj, bool value, Error **errp)
vms->its = value;
}
-static bool virt_get_dtb_kaslr_seed(Object *obj, Error **errp)
+static bool virt_get_dtb_randomness(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
- return vms->dtb_kaslr_seed;
+ return vms->dtb_randomness;
}
-static void virt_set_dtb_kaslr_seed(Object *obj, bool value, Error **errp)
+static void virt_set_dtb_randomness(Object *obj, bool value, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
- vms->dtb_kaslr_seed = value;
+ vms->dtb_randomness = value;
}
static char *virt_get_oem_id(Object *obj, Error **errp)
@@ -2980,12 +2984,18 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
"Set on/off to enable/disable "
"ITS instantiation");
+ object_class_property_add_bool(oc, "dtb-randomness",
+ virt_get_dtb_randomness,
+ virt_set_dtb_randomness);
+ object_class_property_set_description(oc, "dtb-randomness",
+ "Set off to disable passing random or "
+ "non-deterministic dtb nodes to guest");
+
object_class_property_add_bool(oc, "dtb-kaslr-seed",
- virt_get_dtb_kaslr_seed,
- virt_set_dtb_kaslr_seed);
+ virt_get_dtb_randomness,
+ virt_set_dtb_randomness);
object_class_property_set_description(oc, "dtb-kaslr-seed",
- "Set off to disable passing of kaslr-seed "
- "dtb node to guest");
+ "Deprecated synonym of dtb-randomness");
object_class_property_add_str(oc, "x-oem-id",
virt_get_oem_id,
@@ -3053,8 +3063,8 @@ static void virt_instance_init(Object *obj)
/* MTE is disabled by default. */
vms->mte = false;
- /* Supply a kaslr-seed by default */
- vms->dtb_kaslr_seed = true;
+ /* Supply kaslr-seed and rng-seed by default */
+ vms->dtb_randomness = true;
vms->irqmap = a15irqmap;