e5fe00
From 1054c2ab4381145ddc9e937a40c109980f15cf69 Mon Sep 17 00:00:00 2001
e5fe00
Message-Id: <1054c2ab4381145ddc9e937a40c109980f15cf69@dist-git>
e5fe00
From: Jiri Denemark <jdenemar@redhat.com>
e5fe00
Date: Fri, 5 Apr 2019 11:33:32 +0200
e5fe00
Subject: [PATCH] cpu_x86: Do not cache microcode version
e5fe00
MIME-Version: 1.0
e5fe00
Content-Type: text/plain; charset=UTF-8
e5fe00
Content-Transfer-Encoding: 8bit
e5fe00
e5fe00
The microcode version checks are used to invalidate cached CPU data we
e5fe00
get from QEMU. To minimize /proc/cpuinfo parsing the microcode version
e5fe00
was only read when libvirtd started and cached for the daemon's
e5fe00
lifetime. However, the CPU microcode can change anytime (updating the
e5fe00
microcode package can automatically upload it to the CPU) and we need to
e5fe00
stop caching it to avoid using stale CPU model data.
e5fe00
e5fe00
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
e5fe00
Reviewed-by: Ján Tomko <jtomko@redhat.com>
e5fe00
(cherry picked from commit be46f613261d3b655a1f15afd635087e68a9c39b)
e5fe00
e5fe00
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130
e5fe00
e5fe00
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
e5fe00
---
e5fe00
 src/cpu/cpu_x86.c | 5 +----
e5fe00
 1 file changed, 1 insertion(+), 4 deletions(-)
e5fe00
e5fe00
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
e5fe00
index cf3d80eeb5..1acd8c4f49 100644
e5fe00
--- a/src/cpu/cpu_x86.c
e5fe00
+++ b/src/cpu/cpu_x86.c
e5fe00
@@ -155,7 +155,6 @@ struct _virCPUx86Map {
e5fe00
 };
e5fe00
 
e5fe00
 static virCPUx86MapPtr cpuMap;
e5fe00
-static unsigned int microcodeVersion;
e5fe00
 
e5fe00
 int virCPUx86DriverOnceInit(void);
e5fe00
 VIR_ONCE_GLOBAL_INIT(virCPUx86Driver);
e5fe00
@@ -1469,8 +1468,6 @@ virCPUx86DriverOnceInit(void)
e5fe00
     if (!(cpuMap = virCPUx86LoadMap()))
e5fe00
         return -1;
e5fe00
 
e5fe00
-    microcodeVersion = virHostCPUGetMicrocodeVersion();
e5fe00
-
e5fe00
     return 0;
e5fe00
 }
e5fe00
 
e5fe00
@@ -2553,7 +2550,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
e5fe00
         goto cleanup;
e5fe00
 
e5fe00
     ret = x86DecodeCPUData(cpu, cpuData, models);
e5fe00
-    cpu->microcodeVersion = microcodeVersion;
e5fe00
+    cpu->microcodeVersion = virHostCPUGetMicrocodeVersion();
e5fe00
 
e5fe00
  cleanup:
e5fe00
     virCPUx86DataFree(cpuData);
e5fe00
-- 
e5fe00
2.21.0
e5fe00