Skip to contentSkip to conversation

cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620)

GIT PULL Applied Gerd Hoffmann 2 participants 3 messages Feb 24, 2017

lore
Share & tools
lore
#0 lore raw

Hi,

v2, this time with qemu-stable Cc'ed.

please pull,
Gerd

The following changes since commit 10f25e4844cb9b3f02fb032f88051dd5b65b4206:

Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170222' into staging (2017-02-23 09:59:40 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-cve-2017-2620-20170224-1

for you to fetch changes up to 92f2b88cea48c6aeba8de568a45f2ed958f3c298:

cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620) (2017-02-24 14:35:50 +0100)

----------------------------------------------------------------
cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620)

----------------------------------------------------------------
Gerd Hoffmann (1):
cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620)

 hw/display/cirrus_vga.c | 8 ++++++++
 1 file changed, 8 insertions(+)
#1 lore raw

CIRRUS_BLTMODE_MEMSYSSRC blits do NOT check blit destination and blit width, at all. Oops. Fix it.

Security impact: high.

The missing blit destination check allows to write to host memory. Basically same as CVE-2014-8106 for the other blit variants.

---
 hw/display/cirrus_vga.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/display/cirrus_vga.c +8 -0
index 1deb520..b9e7cb1 100644
@@ -900,6 +900,10 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
 {
     int w;
 
+    if (blit_is_unsafe(s, true)) {
+        return 0;
+    }
+
     s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
     s->cirrus_srcptr = &s->cirrus_bltbuf[0];
     s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
@@ -925,6 +929,10 @@ static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
 	}
         s->cirrus_srccounter = s->cirrus_blt_srcpitch * s->cirrus_blt_height;
     }
+
+    /* the blit_is_unsafe call above should catch this */
+    assert(s->cirrus_blt_srcpitch <= CIRRUS_BLTBUFSIZE);
+
     s->cirrus_srcptr = s->cirrus_bltbuf;
     s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
     cirrus_update_memory_access(s);
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Gerd Hoffmann
Quoted 23 lines · Gerd Hoffmann

Hi,

v2, this time with qemu-stable Cc'ed.

please pull,
Gerd

The following changes since commit 10f25e4844cb9b3f02fb032f88051dd5b65b4206:

Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170222' into staging (2017-02-23 09:59:40 +0000)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-cve-2017-2620-20170224-1

for you to fetch changes up to 92f2b88cea48c6aeba8de568a45f2ed958f3c298:

cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620) (2017-02-24 14:35:50 +0100)

----------------------------------------------------------------
cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620)

Quoted 7 lines

----------------------------------------------------------------
Gerd Hoffmann (1):
cirrus: add blit_is_unsafe call to cirrus_bitblt_cputovideo (CVE-2017-2620)

 hw/display/cirrus_vga.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied, thanks.

-- PMM