cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-Add-missing-brackets-to-CPUID-0x80000008-code.patch

c461a1
From 23e038b8eb586dc19f1d653cd98d0cae109f359b Mon Sep 17 00:00:00 2001
c461a1
From: Eduardo Habkost <ehabkost@redhat.com>
c461a1
Date: Thu, 10 Oct 2019 22:18:07 +0200
c461a1
Subject: [PATCH 4/4] Add missing brackets to CPUID[0x80000008] code
c461a1
c461a1
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
c461a1
Message-id: <20191010221807.2953-1-ehabkost@redhat.com>
c461a1
Patchwork-id: 91713
c461a1
O-Subject: [RHEL-7.8 qemu-kvm PATCH] Add missing brackets to CPUID[0x80000008] code
c461a1
Bugzilla: 1760607
c461a1
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
c461a1
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
c461a1
RH-Acked-by: John Snow <jsnow@redhat.com>
c461a1
c461a1
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1760607
c461a1
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23986041
c461a1
Upstream: not applicable
c461a1
c461a1
I've made a mistake at downstream-only commit ba222e201e07
c461a1
("i386: Don't copy host virtual address limit"): I forgot to add
c461a1
brackets to the existing if statement.  This expose an invalid
c461a1
physical address size to the guest if the host xlevel is less
c461a1
than 0x80000008.
c461a1
c461a1
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
c461a1
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
c461a1
---
c461a1
 target-i386/cpu.c | 3 ++-
c461a1
 1 file changed, 2 insertions(+), 1 deletion(-)
c461a1
c461a1
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
c461a1
index b4839df..9283902 100644
c461a1
--- a/target-i386/cpu.c
c461a1
+++ b/target-i386/cpu.c
c461a1
@@ -2978,7 +2978,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
c461a1
             if (kvm_enabled()) {
c461a1
                 uint32_t _eax;
c461a1
                 host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL);
c461a1
-                if (_eax >= 0x80000008)
c461a1
+                if (_eax >= 0x80000008) {
c461a1
                     host_cpuid(0x80000008, 0, &_eax, NULL, NULL, NULL);
c461a1
                     /*
c461a1
                      * Override physical size only, as RHEL-7 KVM only supports
c461a1
@@ -2986,6 +2986,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
c461a1
                      */
c461a1
                     *eax &= ~0xff;
c461a1
                     *eax |= _eax & 0xff;
c461a1
+                }
c461a1
             }
c461a1
         } else {
c461a1
             if (env->features[FEAT_1_EDX] & CPUID_PSE36) {
c461a1
-- 
c461a1
1.8.3.1
c461a1