thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-display-cirrus-ignore-source-pitch-value-as-needed-i.patch

9ae3a8
From 23ae0a2bec72997626c3ba834f036b9a3626eedc Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Tue, 7 Feb 2017 10:07:48 +0100
9ae3a8
Subject: [PATCH 05/11] display: cirrus: ignore source pitch value as needed in
9ae3a8
 blit_is_unsafe
9ae3a8
9ae3a8
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Message-id: <1486462072-32174-4-git-send-email-kraxel@redhat.com>
9ae3a8
Patchwork-id: 73563
9ae3a8
O-Subject: [RHEL-7.4 qemu-kvm PATCH 3/7] display: cirrus: ignore source pitch value as needed in blit_is_unsafe
9ae3a8
Bugzilla: 1418233
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: Bruce Rogers <brogers@suse.com>
9ae3a8
9ae3a8
Commit 4299b90 added a check which is too broad, given that the source
9ae3a8
pitch value is not required to be initialized for solid fill operations.
9ae3a8
This patch refines the blit_is_unsafe() check to ignore source pitch in
9ae3a8
that case. After applying the above commit as a security patch, we
9ae3a8
noticed the SLES 11 SP4 guest gui failed to initialize properly.
9ae3a8
9ae3a8
Signed-off-by: Bruce Rogers <brogers@suse.com>
9ae3a8
Message-id: 20170109203520.5619-1-brogers@suse.com
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
(cherry picked from commit 913a87885f589d263e682c2eb6637c6e14538061)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/display/cirrus_vga.c | 11 +++++++----
9ae3a8
 1 file changed, 7 insertions(+), 4 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
9ae3a8
index dacfac6..c8f2f26 100644
9ae3a8
--- a/hw/display/cirrus_vga.c
9ae3a8
+++ b/hw/display/cirrus_vga.c
9ae3a8
@@ -289,7 +289,7 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
9ae3a8
     return false;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static bool blit_is_unsafe(struct CirrusVGAState *s)
9ae3a8
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
9ae3a8
 {
9ae3a8
     /* should be the case, see cirrus_bitblt_start */
9ae3a8
     assert(s->cirrus_blt_width > 0);
9ae3a8
@@ -303,6 +303,9 @@ static bool blit_is_unsafe(struct CirrusVGAState *s)
9ae3a8
                               s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
9ae3a8
         return true;
9ae3a8
     }
9ae3a8
+    if (dst_only) {
9ae3a8
+        return false;
9ae3a8
+    }
9ae3a8
     if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
9ae3a8
                               s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
9ae3a8
         return true;
9ae3a8
@@ -668,7 +671,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
9ae3a8
 
9ae3a8
     dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
9ae3a8
 
9ae3a8
-    if (blit_is_unsafe(s))
9ae3a8
+    if (blit_is_unsafe(s, false))
9ae3a8
         return 0;
9ae3a8
 
9ae3a8
     (*s->cirrus_rop) (s, dst, src,
9ae3a8
@@ -686,7 +689,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
9ae3a8
 {
9ae3a8
     cirrus_fill_t rop_func;
9ae3a8
 
9ae3a8
-    if (blit_is_unsafe(s)) {
9ae3a8
+    if (blit_is_unsafe(s, true)) {
9ae3a8
         return 0;
9ae3a8
     }
9ae3a8
     rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
9ae3a8
@@ -790,7 +793,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
9ae3a8
 
9ae3a8
 static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
9ae3a8
 {
9ae3a8
-    if (blit_is_unsafe(s))
9ae3a8
+    if (blit_is_unsafe(s, false))
9ae3a8
         return 0;
9ae3a8
 
9ae3a8
     return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8