Skip to content

RFC Implement entropy leak reporting for virtio-rng

Babis Chalios qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1virtio-rng: implement entropy leak featurehw/virtio/virtio-rng.c include/hw/virtio/virtio-rng.h include/standard-headers/linux/virtio_rng.h+179 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] Implement entropy leak reporting for virtio-rng

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/[email protected]/msg09016.html
[2] https://lore.kernel.org/lkml/[email protected]/

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(-)
Signature · 1 line
2.39.2