public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, kraxel@redhat.com,
	Pierre <pierre.gondois@arm.com>,
	 Leif Lindholm <quic_llindhol@quicinc.com>,
	Sami Mujawar <sami.mujawar@arm.com>
Cc: dougflick@microsoft.com, gaoliming <gaoliming@byosoft.com.cn>
Subject: Re: [edk2-devel] 回复: [edk2-devel] [PATCH v2 03/13] OvmfPkg:PlatformCI: Support virtio-rng-pci
Date: Mon, 13 May 2024 19:24:13 +0200	[thread overview]
Message-ID: <CAMj1kXF7XvBxmVLm2xu8mxNNMd1RkasUAhN7a-rWULXeahmH8w@mail.gmail.com> (raw)
In-Reply-To: <pmkxkhui7i5fp5zey5gpw6tdzsyxpppeddfcxllo4zuk7kuit3@yeygb4yh5xxv>

(cc some ARM folks)

On Mon, 13 May 2024 at 11:23, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Sat, May 11, 2024 at 10:40:23AM GMT, Ard Biesheuvel wrote:
> > As I pointed out before, on the ARM side there are a few intersecting
> > issues with these changes. (On x86, this is mostly avoided due to the
> > fact that RDRAND is universally supported)
>
> Well, it's not that easy on x86 either.
>
> Current state of affairs is that the time based LibRng is used, all
> OvmfPkg / ArmVirtPkg have this:
>
>   RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
>
> So, this is what will be used if something uses LibRng.
>
> On x64 RngDxe will just use call LibRng too.  So adding RngDxe will
> effectively make BaseRngLibTimerLib available via EFI_RNG_PROTOCOL.
>
> In case '-device virtio-rng-pci' is present we now have *two* drivers
> providing EFI_RNG_PROTOCOL.  What will happen in this case?  What we
> surely not want is RngDxe being used in case we have a virtio-rng
> device ...
>

On ARM, we can actually do better than this: I have taken Doug's v2
and applied some changes on top to make it work with ArmVirtQemu.

https://github.com/ardbiesheuvel/edk2/tree/doug-v2

The ARM version of RngLib can be backed by either RNDR or TRNG, and
exposes gEfiRngAlgorithmArmRndr, gEfiRngAlgorithmRaw, or both. If
neither are supported, RngDxe will not be dispatched.

Given that RNDR is implemented by the hardware, and TRNG by the
hypervisor, and neither depend on the UEFI driver model (like
virtio-rng), which is backed by the VMM, I think that in this case,
there is no issue with dispatching both, even if that results in two
implementations of the EFI_RNG_PROTOCOL, and no guarantees regarding
which one you get when you locate the protocol. (Confidential VMs may
want to avoid virtio-rng as it is provided by the host but let's
disregard that for the time being)

The upshot is that existing ARM deployments that do not use the 'max'
CPU in TCG mode, or are on a fairly old version of KVM will lose
network support unless they enable the virtio-rng-pci device. This is
a situation I can live with, but it does require the changes I am
proposing on the branch above.

On x86, we should avoid BaseRngLibTimerLib as well - it is a bit ugly
to expose two EFI_RNG_PROTOCOL instances, but we could at least ensure
that it doesn't matter which one you grab. I intend to look more
deeply into this in the future, and maybe compare notes with Pierre,
as this has been a rather complicated delivery IIRC. Perhaps it would
be better for RngDxe to consume a raw entropy source and implement the
DRBG directly rather than expose the raw protocol (which I think
should not have been introduced in the first place)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118872): https://edk2.groups.io/g/devel/message/118872
Mute This Topic: https://groups.io/mt/106013302/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-05-13 17:24 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09  5:56 [edk2-devel] [PATCH v2 00/13] NetworkPkg: CVE-2023-45236 and CVE-2023-45237 Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 01/13] EmulatorPkg: : Add RngDxe to EmulatorPkg Doug Flick via groups.io
2024-05-10  3:10   ` Ni, Ray
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 02/13] EmulatorPkg: : Add Hash2DxeCrypto " Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 03/13] OvmfPkg:PlatformCI: Support virtio-rng-pci Doug Flick via groups.io
2024-05-09  8:45   ` Ard Biesheuvel
2024-05-09  8:45     ` Ard Biesheuvel
2024-05-09 18:21     ` Doug Flick via groups.io
2024-05-10  0:54       ` 回复: " gaoliming via groups.io
2024-05-10 17:13         ` [edk2-devel] " Doug Flick via groups.io
2024-05-11  8:40           ` Ard Biesheuvel
2024-05-13  9:22             ` Gerd Hoffmann
2024-05-13 17:24               ` Ard Biesheuvel [this message]
2024-05-17  3:27                 ` Doug Flick via groups.io
2024-05-17  7:27                   ` Ard Biesheuvel
2024-05-17  9:48                     ` Gerd Hoffmann
2024-05-24  3:02                       ` 回复: " gaoliming via groups.io
2024-05-14 19:55               ` Pedro Falcato
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 04/13] OvmfPkg: : Add Hash2DxeCrypto to OvmfPkg Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 05/13] ArmVirtPkg:PlatformCI: Support virtio-rng-pci Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 06/13] ArmVirtPkg: : Add Hash2DxeCrypto to ArmVirtPkg Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 07/13] SecurityPkg: RngDxe: Remove incorrect limitation on GetRng Doug Flick via groups.io
2024-05-10 10:23   ` Yao, Jiewen
2024-05-10 21:12     ` Doug Flick via groups.io
2024-05-11  0:24       ` Yao, Jiewen
2024-05-13 15:53         ` PierreGondois
2024-05-11  8:26   ` Ard Biesheuvel
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 08/13] NetworkPkg:: SECURITY PATCH CVE-2023-45237 Doug Flick via groups.io
2024-05-13 14:30   ` Ard Biesheuvel
2024-05-15 19:14   ` Saloni Kasbekar
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 09/13] NetworkPkg: TcpDxe: SECURITY PATCH CVE-2023-45236 Doug Flick via groups.io
2024-05-15 21:38   ` Saloni Kasbekar
2024-05-21 19:28     ` Doug Flick via groups.io
2024-05-24  1:24       ` 回复: " gaoliming via groups.io
2024-05-24  4:23         ` Saloni Kasbekar
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 10/13] MdePkg: : Add MockUefiBootServicesTableLib Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 11/13] MdePkg: : Adds Protocol for MockRng Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 12/13] MdePkg: Add MockHash2 Protocol for testing Doug Flick via groups.io
2024-05-09  5:56 ` [edk2-devel] [PATCH v2 13/13] NetworkPkg: Update the PxeBcDhcp6GoogleTest due to underlying changes Doug Flick via groups.io
2024-05-24  4:24   ` Saloni Kasbekar
2024-05-09  9:40 ` 回复: [edk2-devel][edk2-stable202405] [PATCH v2 00/13] NetworkPkg: CVE-2023-45236 and CVE-2023-45237 gaoliming via groups.io
2024-05-09 18:26   ` [edk2-devel] " Doug Flick via groups.io
2024-05-15  0:41     ` 回复: " gaoliming via groups.io

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-list 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=CAMj1kXF7XvBxmVLm2xu8mxNNMd1RkasUAhN7a-rWULXeahmH8w@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /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