qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: mark ROMs read-only
@ 2017-01-19 21:00 Michael S. Tsirkin
  2017-01-23 19:07 ` Marcel Apfelbaum
  2017-01-24 16:12 ` Laurent Vivier
  0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2017-01-19 21:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marcel Apfelbaum

Looks like we didn't mark PCI ROMs as RO allowing
mischief such as guests writing there.
Further, e.g. vhost gets confused trying to allocate
enough space to log writes there. Fix it up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 637d545..eaac185 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2199,7 +2199,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
         snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(pdev)));
     }
     pdev->has_rom = true;
-    memory_region_init_ram(&pdev->rom, OBJECT(pdev), name, size, &error_fatal);
+    memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, size, &error_fatal);
     vmstate_register_ram(&pdev->rom, &pdev->qdev);
     ptr = memory_region_get_ram_ptr(&pdev->rom);
     load_image(path, ptr);
-- 
MST

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

end of thread, other threads:[~2017-01-24 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-19 21:00 [Qemu-devel] [PATCH] pci: mark ROMs read-only Michael S. Tsirkin
2017-01-23 19:07 ` Marcel Apfelbaum
2017-01-24 16:12 ` Laurent Vivier

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).