Skip to contentSkip to conversation

Vga 20200302 patches

GIT PULL Applied Gerd Hoffmann 3 participants 5 messages Mar 2, 2020 – Mar 5, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit e0175b71638cf4398903c0d25f93fe62e0606389:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200228' into staging (2020-02-28 16:39:27 +0000)

are available in the Git repository at:

git://git.kraxel.org/qemu tags/vga-20200302-pull-request

for you to fetch changes up to 44b5c1ebfa5db337714180e9d4a8d525da5595d6:

qxl: map rom r/o (2020-03-02 08:24:36 +0100)

----------------------------------------------------------------
vga: bugfixes for qxl and edid generator.

----------------------------------------------------------------

Anton V. Boyarshinov (1):
Arithmetic error in EDID generation fixed

Gerd Hoffmann (1):
qxl: map rom r/o

 hw/display/edid-generate.c | 4 ++--
 hw/display/qxl.c           | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.18.2
#1 lore raw

[PULL 2/2] qxl: map rom r/o

Map qxl rom read-only into the guest, so the guest can't tamper with the content. qxl has a shadow copy of the rom to deal with that, but the shadow doesn't cover the mode list. A privilidged user in the guest can manipulate the mode list and that to trick qemu into oob reads, leading to a DoS via segfault if that read access happens to hit unmapped memory.

Message-id: [email protected]

---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/qxl.c +1 -1
index 21a43a1d5ec2..227da69a50d9 100644
@@ -2136,7 +2136,7 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
     pci_set_byte(&config[PCI_INTERRUPT_PIN], 1);
 
     qxl->rom_size = qxl_rom_size();
-    memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom",
+    memory_region_init_rom(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom",
                            qxl->rom_size, &error_fatal);
     init_qxl_rom(qxl);
     init_qxl_ram(qxl);
Signature · 1 line
2.18.2
#2 lore raw

[PULL 1/2] Arithmetic error in EDID generation fixed

In reply to Gerd Hoffmann

From: "Anton V. Boyarshinov" <[email protected]>

To calculate screen size in centimeters we should calculate:
pixels/dpi*2.54
but not
pixels*dpi/2540

Using wrong formula we actually get 65 DPI and very small fonts.

Message-id: [email protected]

---
 hw/display/edid-generate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/edid-generate.c +2 -2
index 75c945a94813..e58472fde501 100644
@@ -360,8 +360,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
     edid[20] = 0xa5;
 
     /* screen size: undefined */
-    edid[21] = info->prefx * info->dpi / 2540;
-    edid[22] = info->prefy * info->dpi / 2540;
+    edid[21] = info->prefx * 254 / 100 / info->dpi;
+    edid[22] = info->prefy * 254 / 100 / info->dpi;
 
     /* display gamma: 2.2 */
     edid[23] = 220 - 100;
Signature · 1 line
2.18.2
#3 lore raw

Re: [PULL 1/2] Arithmetic error in EDID generation fixed

Am 02.03.20 um 10:18 schrieb Gerd Hoffmann:

Quoted 21 lines

From: "Anton V. Boyarshinov" <[email protected]>

To calculate screen size in centimeters we should calculate:
pixels/dpi*2.54
but not
pixels*dpi/2540

Using wrong formula we actually get 65 DPI and very small fonts.

Message-id: [email protected]

---
 hw/display/edid-generate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/display/edid-generate.c +0 -0
index 75c945a94813..e58472fde501 100644

hw/display/edid-generate.c void qemu_edid_generate(uint8_t *edid, size_t size, · line 364

Quoted 7 lines
hw/display/edid-generate.c +2 -2
@@ -360,8 +360,8 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
     edid[20] = 0xa5;
 
     /* screen size: undefined */
-    edid[21] = info->prefx * info->dpi / 2540;
-    edid[22] = info->prefy * info->dpi / 2540;
+    edid[21] = info->prefx * 254 / 100 / info->dpi;
+    edid[22] = info->prefy * 254 / 100 / info->dpi;

Gerd, the required rounding (see my previous e-mail) for both values is still missing.

Cheers,

Stefan

#4 lore raw
In reply to Gerd Hoffmann
Quoted 9 lines · Gerd Hoffmann

The following changes since commit e0175b71638cf4398903c0d25f93fe62e0606389:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200228' into staging (2020-02-28 16:39:27 +0000)

are available in the Git repository at:

git://git.kraxel.org/qemu tags/vga-20200302-pull-request

Quoted 8 lines

for you to fetch changes up to 44b5c1ebfa5db337714180e9d4a8d525da5595d6:

qxl: map rom r/o (2020-03-02 08:24:36 +0100)

----------------------------------------------------------------
vga: bugfixes for qxl and edid generator.

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.

-- PMM