Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
libvirt.10484
libvirt-util-introduce-virHostCPUGetMicrocodeVe...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libvirt-util-introduce-virHostCPUGetMicrocodeVersion.patch of Package libvirt.10484
From e1b4f285cc8c5e64bcbf5000095bac1e20ed1934 Mon Sep 17 00:00:00 2001 Message-Id: <e1b4f285cc8c5e64bcbf5000095bac1e20ed1934@dist-git> From: Paolo Bonzini <pbonzini@redhat.com> Date: Tue, 12 Dec 2017 16:23:41 +0100 Subject: [PATCH] util: introduce virHostCPUGetMicrocodeVersion This new API reads host's CPU microcode version from /proc/cpuinfo. Unfortunately, there is no other way of reading microcode version which would be usable from both system and session daemon. CVE-2017-5715 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Conflicts: src/libvirt_private.syms - all other virHostCPU* APIs were wrongly exported in nodeinfo.h section src/util/virhostcpu.c src/util/virhostcpu.h - several APIs are missing in 7.3 Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/libvirt_private.syms | 4 ++++ src/util/virhostcpu.c | 43 +++++++++++++++++++++++++++++++++++++++++++ src/util/virhostcpu.h | 2 ++ 3 files changed, 49 insertions(+) Index: libvirt-1.2.18.4/src/libvirt_private.syms =================================================================== --- libvirt-1.2.18.4.orig/src/libvirt_private.syms +++ libvirt-1.2.18.4/src/libvirt_private.syms @@ -1512,6 +1512,10 @@ virHookInitialize; virHookPresent; +# util/virhostcpu.h +virHostCPUGetMicrocodeVersion; + + # util/virhostdev.h virHostdevManagerGetDefault; virHostdevPCINodeDeviceDetach; Index: libvirt-1.2.18.4/src/nodeinfo.c =================================================================== --- libvirt-1.2.18.4.orig/src/nodeinfo.c +++ libvirt-1.2.18.4/src/nodeinfo.c @@ -2248,3 +2248,44 @@ nodeAllocPages(unsigned int npages, cleanup: return ret; } + + +#ifdef __linux__ + +unsigned int +virHostCPUGetMicrocodeVersion(void) +{ + char *outbuf = NULL; + char *cur; + unsigned int version = 0; + + if (virFileReadHeaderQuiet(CPUINFO_PATH, 4096, &outbuf) < 0) { + char ebuf[1024]; + return 0; + } + + /* Account for format 'microcode : XXXX'*/ + if (!(cur = strstr(outbuf, "microcode")) || + !(cur = strchr(cur, ':'))) + goto cleanup; + cur++; + + /* Linux places the microcode revision in a 32-bit integer, so + * ui is fine for us too. */ + if (virStrToLong_ui(cur, &cur, 0, &version) < 0) + goto cleanup; + + cleanup: + VIR_FREE(outbuf); + return version; +} + +#else + +unsigned int +virHostCPUGetMicrocodeVersion(void) +{ + return 0; +} + +#endif Index: libvirt-1.2.18.4/src/nodeinfo.h =================================================================== --- libvirt-1.2.18.4.orig/src/nodeinfo.h +++ libvirt-1.2.18.4/src/nodeinfo.h @@ -73,4 +73,6 @@ int nodeAllocPages(unsigned int npages, int startCell, unsigned int cellCount, bool add); +unsigned int virHostCPUGetMicrocodeVersion(void); + #endif /* __VIR_NODEINFO_H__*/
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor