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

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