[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] hw/arm/virt: dt: add rng-seed property
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2] hw/arm/virt: dt: add rng-seed property |
Date: |
Mon, 4 Jul 2022 15:42:55 +0100 |
On Thu, 30 Jun 2022 at 11:39, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> In 60592cfed2 ("hw/arm/virt: dt: add kaslr-seed property"), the
> kaslr-seed property was added, but the equally as important rng-seed
> property was forgotten about, which has identical semantics for a
> similar purpose. This commit implements it in exactly the same way as
> kaslr-seed. It then changes the name of the disabling option to reflect
> that this has more to do with randomness vs determinism, rather than
> something particular about kaslr.
>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Thanks for this respin; I think this is the right way to go.
> ---
> docs/system/arm/virt.rst | 17 ++++++++++------
> hw/arm/virt.c | 44 ++++++++++++++++++++++++----------------
> include/hw/arm/virt.h | 2 +-
> 3 files changed, 39 insertions(+), 24 deletions(-)
>
> diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
> index 3d1058a80c..3b6ba69a9a 100644
> --- a/docs/system/arm/virt.rst
> +++ b/docs/system/arm/virt.rst
> @@ -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.
We should also add a section to docs/about/deprecated.rst
noting that the old name is deprecated in favour of the new one.
I'll fold that in when I add the patch to target-arm.next, to
save you doing a respin:
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -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.
+
> + 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");
I was going to suggest object_property_add_alias() but that
works at the object level, not the class level, so never mind.
This will work, and eventually we'll delete the code when it
hits the deprecation-to-removal horizon. So
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
and applied to target-arm.next.
thanks
-- PMM
- Re: [PATCH v2] hw/arm/virt: dt: add rng-seed property,
Peter Maydell <=