qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Implement entropy leak reporting for virtio-rng
@ 2023-04-03 10:52 Babis Chalios
  2023-04-03 10:52 ` [RFC PATCH 1/1] virtio-rng: implement entropy leak feature Babis Chalios
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Babis Chalios @ 2023-04-03 10:52 UTC (permalink / raw)
  To: Michael S. Tsirkin, Laurent Vivier, Amit Shah, qemu-devel
  Cc: bchalios, sgarzare, graf, Jason, xmarcalx

This patchset implements the entropy leak reporting feature proposal [1]
for virtio-rng devices.

Entropy leaking (as defined in the specification proposal) typically
happens when we take a snapshot of a VM or while we resume a VM from a
snapshot. In these cases, we want to let the guest know so that it can
reset state that needs to be uniqueue, for example.

This feature is offering functionality similar to what VMGENID does.
However, it allows to build mechanisms on the guest side to notify
user-space applications, like VMGENID for userspace and additionally for
kernel.

The new specification describes two request types that the guest might
place in the queues for the device to perform, a fill-on-leak request
where the device needs to fill with random bytes a buffer and a
copy-on-leak request where the device needs to perform a copy between
two guest-provided buffers. We currently trigger the handling of guest
requests when saving the VM state and when loading a VM from a snapshot
file.

This is an RFC, since the corresponding specification changes have not
yet been merged. It also aims to allow testing a respective patch-set
implementing the feature in the Linux front-end driver[2].

However, I would like to ask the community's opinion regarding the
handling of the fill-on-leak requests. Essentially, these requests are
very similar to the normal virtio-rng entropy requests, with the catch
that we should complete these requests before resuming the VM, so that
we avoid race-conditions in notifying the guest about entropy leak
events. This means that we cannot rely on the RngBackend's API, which is
asynchronous. At the moment, I have handled that using getrandom(), but
I would like a solution which doesn't work only with (relatively new)
Linux hosts. I am inclined to solve that by extending the RngBackend API
with a synchronous call to request for random bytes and I'd like to hear
opinion's on this approach.

[1] https://www.mail-archive.com/virtio-dev@lists.oasis-open.org/msg09016.html
[2] https://lore.kernel.org/lkml/20230131145543.86369-1-bchalios@amazon.es/

Babis Chalios (1):
  virtio-rng: implement entropy leak feature

 hw/virtio/virtio-rng.c                      | 170 +++++++++++++++++++-
 include/hw/virtio/virtio-rng.h              |   9 +-
 include/standard-headers/linux/virtio_rng.h |   3 +
 3 files changed, 179 insertions(+), 3 deletions(-)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-14 12:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 10:52 [RFC PATCH 0/1] Implement entropy leak reporting for virtio-rng Babis Chalios
2023-04-03 10:52 ` [RFC PATCH 1/1] virtio-rng: implement entropy leak feature Babis Chalios
2023-04-03 14:15 ` [RFC PATCH 0/1] Implement entropy leak reporting for virtio-rng Jason A. Donenfeld
2023-04-03 14:16   ` Jason A. Donenfeld
2023-04-03 14:27     ` bchalios
2023-04-11 16:19 ` Amit Shah
2023-04-11 16:20   ` Jason A. Donenfeld
2023-04-13 13:36     ` Babis Chalios
2023-04-14 12:02       ` Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).