mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
vfio/pci: Fix information leak in vfio_rom_read()
vfio_rom_read() can leak uninitialized stack data to the guest when a read occurs at the end boundary of the ROM BAR. Fix this by initializing the val union to 0xff, matching the ROM initialization pattern used in vfio_pci_load_rom(). Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com> Reviewed-by: Mario Casquero <mcasquer@redhat.com> Link: https://lore.kernel.org/qemu-devel/20260602074446.1206892-1-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
@@ -1143,7 +1143,7 @@ static uint64_t vfio_rom_read(void *opaque, hwaddr addr, unsigned size)
|
||||
uint16_t word;
|
||||
uint32_t dword;
|
||||
uint64_t qword;
|
||||
} val;
|
||||
} val = { .qword = ~0ULL };
|
||||
uint64_t data = 0;
|
||||
|
||||
/* Load the ROM lazily when the guest tries to read it */
|
||||
|
||||
Reference in New Issue
Block a user