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