diff options
author | Laszlo Ersek <lersek@redhat.com> | 2015-10-16 19:52:24 +0000 |
---|---|---|
committer | lersek <lersek@Edk2> | 2015-10-16 19:52:24 +0000 |
commit | fcb636ea4244cb29d3f6a6d938dd9f7692ecfa7c (patch) | |
tree | 47edee84837f0496e5bfc1d28e497d74199e15c4 /OvmfPkg/VirtioBlkDxe/VirtioBlk.h | |
parent | fbc80813eeb0cff1c102666046a4483bf44b7414 (diff) | |
download | edk2-fcb636ea4244cb29d3f6a6d938dd9f7692ecfa7c.tar.gz edk2-fcb636ea4244cb29d3f6a6d938dd9f7692ecfa7c.tar.bz2 edk2-fcb636ea4244cb29d3f6a6d938dd9f7692ecfa7c.zip |
OvmfPkg: VirtioBlkDxe: reset device at ExitBootServices()
(1) VirtioLib allocates the virtio ring in EfiBootServicesData memory.
(This is intentional.) Code that executes after ExitBootServices() is
permitted to reuse such memory.
(2) The hypervisor is allowed to look at, and act upon, a live virtio ring
at any time, even without explicit virtio kicks from the guest.
Should boot loader code or kernel code, running between ExitBootServices()
and the kernel's own virtio drivers resetting the device, overwrite the
pages that used to contain the virtio ring before ExitBootServices(), QEMU
could theoretically interpret that unrelated data as garbage ring
contents, and abort the guest.
Although we have seen no such reports, better be prudent and reset the
device in an ExitBootServices() event handler. Among other things, this
causes QEMU to forget about the device's virtio ring.
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18624 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/VirtioBlkDxe/VirtioBlk.h')
-rw-r--r-- | OvmfPkg/VirtioBlkDxe/VirtioBlk.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.h b/OvmfPkg/VirtioBlkDxe/VirtioBlk.h index 789caf9a37..ca4b7a0ca6 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.h +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.h @@ -37,6 +37,7 @@ typedef struct { // --------------------- ------------------ ---------
UINT32 Signature; // DriverBindingStart 0
VIRTIO_DEVICE_PROTOCOL *VirtIo; // DriverBindingStart 0
+ EFI_EVENT ExitBoot; // DriverBindingStart 0
VRING Ring; // VirtioRingInit 2
EFI_BLOCK_IO_PROTOCOL BlockIo; // VirtioBlkInit 1
EFI_BLOCK_IO_MEDIA BlockIoMedia; // VirtioBlkInit 1
|