|
|
9ae3a8 |
From abfd9c2acaf70c60ec70807ba4d021ade69c7b79 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 10 Feb 2017 08:30:14 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 2/3] Revert "cirrus: allow zero source pitch in pattern fill
|
|
|
9ae3a8 |
rops"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1486715415-3462-3-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 73774
|
|
|
9ae3a8 |
O-Subject: [virt-devel] [RHEL-7.4 qemu-kvm PATCH 2/3] Revert "cirrus: allow zero source pitch in pattern fill rops"
|
|
|
9ae3a8 |
Bugzilla: 1420492
|
|
|
9ae3a8 |
CVE: CVE-2017-2620/20170221
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This reverts commit 5858dd1801883309bdd208d72ddb81c4e9fee30c.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
|
|
9ae3a8 |
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Upstream: WIP (https://patchwork.ozlabs.org/patch/726074/)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/display/cirrus_vga.c | 26 ++++++++------------------
|
|
|
9ae3a8 |
1 file changed, 8 insertions(+), 18 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
index fff9bf0..9a9501f 100644
|
|
|
9ae3a8 |
--- a/hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
+++ b/hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
@@ -267,6 +267,9 @@ static void cirrus_update_memory_access(CirrusVGAState *s);
|
|
|
9ae3a8 |
static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
|
|
9ae3a8 |
int32_t pitch, int32_t addr)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ if (!pitch) {
|
|
|
9ae3a8 |
+ return true;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
if (pitch < 0) {
|
|
|
9ae3a8 |
int64_t min = addr
|
|
|
9ae3a8 |
+ ((int64_t)s->cirrus_blt_height - 1) * pitch
|
|
|
9ae3a8 |
@@ -285,11 +288,8 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
|
|
|
9ae3a8 |
return false;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
|
|
9ae3a8 |
- bool zero_src_pitch_ok)
|
|
|
9ae3a8 |
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- int32_t check_pitch;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
/* should be the case, see cirrus_bitblt_start */
|
|
|
9ae3a8 |
assert(s->cirrus_blt_width > 0);
|
|
|
9ae3a8 |
assert(s->cirrus_blt_height > 0);
|
|
|
9ae3a8 |
@@ -298,10 +298,6 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
|
|
9ae3a8 |
return true;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (!s->cirrus_blt_dstpitch) {
|
|
|
9ae3a8 |
- return true;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
|
|
|
9ae3a8 |
s->cirrus_blt_dstaddr)) {
|
|
|
9ae3a8 |
return true;
|
|
|
9ae3a8 |
@@ -309,13 +305,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
|
|
|
9ae3a8 |
if (dst_only) {
|
|
|
9ae3a8 |
return false;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- check_pitch = s->cirrus_blt_srcpitch;
|
|
|
9ae3a8 |
- if (!zero_src_pitch_ok && !check_pitch) {
|
|
|
9ae3a8 |
- check_pitch = s->cirrus_blt_width;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- if (blit_region_is_unsafe(s, check_pitch,
|
|
|
9ae3a8 |
+ if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
|
|
|
9ae3a8 |
s->cirrus_blt_srcaddr)) {
|
|
|
9ae3a8 |
return true;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -710,7 +700,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
|
|
|
9ae3a8 |
src = s->cirrus_bltbuf;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (blit_is_unsafe(s, true, true)) {
|
|
|
9ae3a8 |
+ if (blit_is_unsafe(s, true)) {
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -729,7 +719,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, true, true)) {
|
|
|
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 |
@@ -829,7 +819,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, false, false))
|
|
|
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 |
|