Compare commits
132 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa34176617 | |||
| c5bb34b10f | |||
| ee6c35ff11 | |||
| dfeabf11e5 | |||
| 5828ec5da6 | |||
| adaeee1c2c | |||
| 200f2942a9 | |||
| cbf07f0551 | |||
| eb9ceebe38 | |||
| 507eb37491 | |||
| 3e211fa0f6 | |||
| d4bb64489a | |||
| 6d908194bf | |||
| 2333a80c1a | |||
| f4fd6d7df6 | |||
| c1a3411c3b | |||
| 619904f37a | |||
| 044c5b0665 | |||
| 50aba9b5a0 | |||
| c98b586e70 | |||
| 987430ba8b | |||
| 58043b20fb | |||
| f1888958a6 | |||
| 6c3d79e65d | |||
| dc9be9b9a7 | |||
| 5e0d67787a | |||
| 662f0e2ba4 | |||
| 66060fa395 | |||
| 83def04a25 | |||
| 535bbcdd91 | |||
| 417e4c9cf7 | |||
| 24d349fa37 | |||
| 9f3b22fec4 | |||
| 7285a57f5c | |||
| 9944fa190c | |||
| 1a44dca7d4 | |||
| 0c2262d602 | |||
| da598118cf | |||
| da34e517db | |||
| 7b17ccd035 | |||
| 908a2f2a46 | |||
| acf19787de | |||
| c269619b9a | |||
| 3f6336f446 | |||
| a552a10ec8 | |||
| bfb8157052 | |||
| edb5200d83 | |||
| fe3f90dedd | |||
| 437df85540 | |||
| 2d6cbe6672 | |||
| 97a323d7c2 | |||
| cb839d3dfc | |||
| dc6b512f3c | |||
| ac122f4525 | |||
| 7744acbb6b | |||
| 3807f07c15 | |||
| e484fdc92b | |||
| 6752fe8c9e | |||
| 15f52369ae | |||
| 65a0e26138 | |||
| 497e096592 | |||
| 03a98aaf59 | |||
| 5845f1efec | |||
| a8d01eb9d7 | |||
| 6d76ba5956 | |||
| a11202d9e2 | |||
| bbfa59c8da | |||
| b97ad8956c | |||
| f9639a0012 | |||
| c71e60c76c | |||
| 9764121247 | |||
| a18ed3c492 | |||
| 9e2eeb32e3 | |||
| 8bf91f5d22 | |||
| 91d8eff569 | |||
| a761ea338f | |||
| 7eef88add4 | |||
| 0c88a64234 | |||
| c2f3be1f4d | |||
| 18b1c9d77e | |||
| 4528832026 | |||
| 037cd36ba2 | |||
| b94fb6a393 | |||
| b0c05ac2ae | |||
| 15c305caf3 | |||
| bc1b3e59a7 | |||
| 3c4492c415 | |||
| fecc0295a2 | |||
| 325dc837c6 | |||
| 5a45cb7f0d | |||
| 21269530e8 | |||
| fc18e983e7 | |||
| 4a7cc743a9 | |||
| 4398397311 | |||
| 401f9087bc | |||
| dd3698988e | |||
| 3df49002c2 | |||
| 1bf0aedb9f | |||
| 79accd5a6e | |||
| 422d548fce | |||
| 20ec6e955c | |||
| 406a235cbc | |||
| 4d15e56a38 | |||
| 8693111790 | |||
| 8461a521f2 | |||
| 511e2c5124 | |||
| 749dc3d3cb | |||
| 73c9e38f2c | |||
| afe8184d3f | |||
| 7d77bf76aa | |||
| 7f0f1b831e | |||
| d964be0097 | |||
| a2479f539e | |||
| c2c89ec6a3 | |||
| d61e2404ba | |||
| a2be167dfe | |||
| 15ca09e1da | |||
| 2cc07e6366 | |||
| 4dd4fe78a4 | |||
| 0bc22fb6f7 | |||
| 76097a6961 | |||
| 98cbf39fd3 | |||
| d670e246d0 | |||
| 50e7b9a91d | |||
| 5cbc0451ce | |||
| b420054636 | |||
| 143fedee46 | |||
| 88887cac0f | |||
| 579afc99f2 | |||
| 7f5808b9d0 | |||
| 4df5f77071 | |||
| 1bdd527daf |
@@ -0,0 +1,31 @@
|
||||
[suppress_function]
|
||||
symbol_version_regexp = LIBVIRT_PRIVATE.*
|
||||
soname_regexp = libvirt\\.so.*
|
||||
|
||||
[suppress_function]
|
||||
symbol_version_regexp = LIBVIRT_ADMIN_PRIVATE.*
|
||||
soname_regexp = libvirt-admin\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = LIBVIRT_PRIVATE.*
|
||||
soname_regexp = libvirt\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = LIBVIRT_ADMIN_PRIVATE.*
|
||||
soname_regexp = libvirt-admin\\.so.*
|
||||
|
||||
[suppress_function]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_storage_.*\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_storage_.*\\.so.*
|
||||
|
||||
[suppress_function]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_driver_.*\\.so.*
|
||||
|
||||
[suppress_variable]
|
||||
symbol_version_regexp = .*
|
||||
soname_regexp = libvirt_driver_.*\\.so.*
|
||||
@@ -0,0 +1,40 @@
|
||||
From 76cdc7adf55723ff8da146bd3c15c64d0afd5d93 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Kletzander <mkletzan@redhat.com>
|
||||
Date: Tue, 27 Feb 2024 16:20:12 +0100
|
||||
Subject: [PATCH] Fix off-by-one error in udevListInterfacesByStatus
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Ever since this function was introduced in 2012 it could've tried
|
||||
filling in an extra interface name. That was made worse in 2019 when
|
||||
the caller functions started accepting NULL arrays of size 0.
|
||||
|
||||
This is assigned CVE-2024-1441.
|
||||
|
||||
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
Reported-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
|
||||
Fixes: 5a33366f5c0b18c93d161bd144f9f079de4ac8ca
|
||||
Fixes: d6064e2759a24e0802f363e3a810dc5a7d7ebb15
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit c664015fe3a7bf59db26686e9ed69af011c6ebb8)
|
||||
---
|
||||
src/interface/interface_backend_udev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
|
||||
index fb6799ed94..4091483060 100644
|
||||
--- a/src/interface/interface_backend_udev.c
|
||||
+++ b/src/interface/interface_backend_udev.c
|
||||
@@ -222,7 +222,7 @@ udevListInterfacesByStatus(virConnectPtr conn,
|
||||
g_autoptr(virInterfaceDef) def = NULL;
|
||||
|
||||
/* Ensure we won't exceed the size of our array */
|
||||
- if (count > names_len)
|
||||
+ if (count >= names_len)
|
||||
break;
|
||||
|
||||
path = udev_list_entry_get_name(dev_entry);
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 3499354e12a1c1832bf4030693a64e03ceb79d05 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 5 Jun 2024 11:16:21 +0100
|
||||
Subject: [PATCH] interface: fix udev reference leak with invalid flags
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The udevInterfaceGetXMLDesc method takes a reference on the udev
|
||||
driver as its first action. If the virCheckFlags() condition
|
||||
fails, however, this reference is never released.
|
||||
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
src/interface/interface_backend_udev.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
|
||||
index fdf11a8318..e1a50389c9 100644
|
||||
--- a/src/interface/interface_backend_udev.c
|
||||
+++ b/src/interface/interface_backend_udev.c
|
||||
@@ -1027,12 +1027,14 @@ static char *
|
||||
udevInterfaceGetXMLDesc(virInterfacePtr ifinfo,
|
||||
unsigned int flags)
|
||||
{
|
||||
- struct udev *udev = udev_ref(driver->udev);
|
||||
+ struct udev *udev = NULL;
|
||||
g_autoptr(virInterfaceDef) ifacedef = NULL;
|
||||
char *xmlstr = NULL;
|
||||
|
||||
virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);
|
||||
|
||||
+ udev = udev_ref(driver->udev);
|
||||
+
|
||||
/* Recursively build up the interface XML based on the requested
|
||||
* interface name
|
||||
*/
|
||||
--
|
||||
2.45.1
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
From c120b31f826cd51127d28f8beaa61ac0d5f03048 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Frolov <frolov@swemel.ru>
|
||||
Date: Tue, 12 Sep 2023 15:56:47 +0300
|
||||
Subject: [PATCH] interface: fix udev_device_get_sysattr_value return value
|
||||
check
|
||||
|
||||
Reviewing the code I found that return value of function
|
||||
udev_device_get_sysattr_value() is dereferenced without a check.
|
||||
udev_device_get_sysattr_value() may return NULL by number of reasons.
|
||||
|
||||
v2: VIR_DEBUG added, replaced STREQ(NULLSTR()) with STREQ_NULLABLE()
|
||||
v3: More checks added, to skip earlier. More verbose VIR_DEBUG.
|
||||
|
||||
Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
|
||||
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
||||
(cherry picked from commit 2ca94317ac642a70921947150ced8acc674ccdc8)
|
||||
---
|
||||
src/interface/interface_backend_udev.c | 26 +++++++++++++++++++-------
|
||||
1 file changed, 19 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
|
||||
index a0485ddd21..fb6799ed94 100644
|
||||
--- a/src/interface/interface_backend_udev.c
|
||||
+++ b/src/interface/interface_backend_udev.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <dirent.h>
|
||||
#include <libudev.h>
|
||||
|
||||
+#include "virlog.h"
|
||||
#include "virerror.h"
|
||||
#include "virfile.h"
|
||||
#include "datatypes.h"
|
||||
@@ -40,6 +41,8 @@
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_INTERFACE
|
||||
|
||||
+VIR_LOG_INIT("interface.interface_backend_udev");
|
||||
+
|
||||
struct udev_iface_driver {
|
||||
struct udev *udev;
|
||||
/* pid file FD, ensures two copies of the driver can't use the same root */
|
||||
@@ -354,11 +357,20 @@ udevConnectListAllInterfaces(virConnectPtr conn,
|
||||
const char *macaddr;
|
||||
g_autoptr(virInterfaceDef) def = NULL;
|
||||
|
||||
- path = udev_list_entry_get_name(dev_entry);
|
||||
- dev = udev_device_new_from_syspath(udev, path);
|
||||
- name = udev_device_get_sysname(dev);
|
||||
+ if (!(path = udev_list_entry_get_name(dev_entry))) {
|
||||
+ VIR_DEBUG("Skipping interface, path == NULL");
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!(dev = udev_device_new_from_syspath(udev, path))) {
|
||||
+ VIR_DEBUG("Skipping interface '%s', dev == NULL", path);
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!(name = udev_device_get_sysname(dev))) {
|
||||
+ VIR_DEBUG("Skipping interface '%s', name == NULL", path);
|
||||
+ continue;
|
||||
+ }
|
||||
macaddr = udev_device_get_sysattr_value(dev, "address");
|
||||
- status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
|
||||
+ status = STREQ_NULLABLE(udev_device_get_sysattr_value(dev, "operstate"), "up");
|
||||
|
||||
def = udevGetMinimalDefForDevice(dev);
|
||||
if (!virConnectListAllInterfacesCheckACL(conn, def)) {
|
||||
@@ -964,9 +976,9 @@ udevGetIfaceDef(struct udev *udev, const char *name)
|
||||
|
||||
/* MTU */
|
||||
mtu_str = udev_device_get_sysattr_value(dev, "mtu");
|
||||
- if (virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
|
||||
+ if (!mtu_str || virStrToLong_ui(mtu_str, NULL, 10, &mtu) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("Could not parse MTU value '%1$s'"), mtu_str);
|
||||
+ _("Could not parse MTU value '%1$s'"), NULLSTR(mtu_str));
|
||||
goto error;
|
||||
}
|
||||
ifacedef->mtu = mtu;
|
||||
@@ -1089,7 +1101,7 @@ udevInterfaceIsActive(virInterfacePtr ifinfo)
|
||||
goto cleanup;
|
||||
|
||||
/* Check if it's active or not */
|
||||
- status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
|
||||
+ status = STREQ_NULLABLE(udev_device_get_sysattr_value(dev, "operstate"), "up");
|
||||
|
||||
udev_device_unref(dev);
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
From: Andrea Bolognani <abologna@redhat.com>
|
||||
Date: Wed, 27 Feb 2019 18:41:35 +0100
|
||||
Subject: [PATCH] qemu: Allow creating ppc64 guests with graphics and no USB
|
||||
mouse
|
||||
|
||||
The existing behavior for ppc64 guests is to always add a USB
|
||||
keyboard and mouse combo if graphics are present; unfortunately,
|
||||
this means any attempt to use a USB tablet will cause both pointing
|
||||
devices to show up in the guest, which in turn will result in poor
|
||||
user experience.
|
||||
|
||||
We can't just stop adding the USB mouse or start adding a USB tablet
|
||||
instead, because existing applications and users might rely on the
|
||||
current behavior; however, we can avoid adding the USB mouse if a USB
|
||||
tablet is already present, thus allowing users and applications to
|
||||
create guests that contain a single pointing device.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1683681
|
||||
|
||||
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reviewed-by: Cole Robinson <crobinso@redhat.com>
|
||||
(cherry picked from commit 186bb479d0f409dc75175bea48a760838c479a6c)
|
||||
---
|
||||
src/qemu/qemu_domain.c | 20 ++++++++
|
||||
.../ppc64-pseries-graphics.ppc64-latest.args | 47 +++++++++++++++++++
|
||||
2 files changed, 67 insertions(+)
|
||||
create mode 100644 tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index f161cf6c84..764ffacb2e 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -3384,6 +3384,26 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
def->memballoon = memballoon;
|
||||
}
|
||||
|
||||
+ if (addDefaultUSBMouse) {
|
||||
+ bool hasUSBTablet = false;
|
||||
+ size_t j;
|
||||
+
|
||||
+ for (j = 0; j < def->ninputs; j++) {
|
||||
+ if (def->inputs[j]->type == VIR_DOMAIN_INPUT_TYPE_TABLET &&
|
||||
+ def->inputs[j]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
|
||||
+ hasUSBTablet = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Historically, we have automatically added USB keyboard and
|
||||
+ * mouse to some guests. While the former device is generally
|
||||
+ * safe to have, adding the latter is undesiderable if a USB
|
||||
+ * tablet is already present in the guest */
|
||||
+ if (hasUSBTablet)
|
||||
+ addDefaultUSBMouse = false;
|
||||
+ }
|
||||
+
|
||||
if (addDefaultUSBKBD &&
|
||||
def->ngraphics > 0 &&
|
||||
virDomainDefMaybeAddInput(def,
|
||||
diff --git a/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args b/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
|
||||
new file mode 100644
|
||||
index 0000000000..b81648f078
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/ppc64-pseries-graphics.ppc64-latest.args
|
||||
@@ -0,0 +1,47 @@
|
||||
+LC_ALL=C \
|
||||
+PATH=/bin \
|
||||
+HOME=/home/test \
|
||||
+USER=test \
|
||||
+LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-ppc64 \
|
||||
+-name guest=guest,debug-threads=on \
|
||||
+-S \
|
||||
+-object secret,id=masterKey0,format=raw,\
|
||||
+file=/tmp/lib/domain--1-guest/master-key.aes \
|
||||
+-machine pseries,accel=tcg,usb=off,dump-guest-core=off \
|
||||
+-m 4096 \
|
||||
+-realtime mlock=off \
|
||||
+-smp 4,sockets=4,cores=1,threads=1 \
|
||||
+-uuid b35969f7-e7cf-4d90-a9a0-4dd9000f9824 \
|
||||
+-no-user-config \
|
||||
+-nodefaults \
|
||||
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
+-rtc base=utc \
|
||||
+-no-shutdown \
|
||||
+-boot strict=on \
|
||||
+-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.0,addr=0x2 \
|
||||
+-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \
|
||||
+-drive file=/var/lib/libvirt/images/guest.qcow2,format=qcow2,if=none,\
|
||||
+id=drive-virtio-disk0 \
|
||||
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
|
||||
+id=virtio-disk0,bootindex=1 \
|
||||
+-netdev user,id=hostnet0 \
|
||||
+-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:a2:44:92,bus=pci.0,\
|
||||
+addr=0x1 \
|
||||
+-chardev pty,id=charserial0 \
|
||||
+-device spapr-vty,chardev=charserial0,id=serial0,reg=0x30000000 \
|
||||
+-chardev socket,id=charchannel0,fd=1729,server,nowait \
|
||||
+-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\
|
||||
+id=channel0,name=org.qemu.guest_agent.0 \
|
||||
+-device usb-tablet,id=input0,bus=usb.0,port=1 \
|
||||
+-device usb-kbd,id=input1,bus=usb.0,port=2 \
|
||||
+-vnc 127.0.0.1:0 \
|
||||
+-device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x7 \
|
||||
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \
|
||||
+-object rng-random,id=objrng0,filename=/dev/urandom \
|
||||
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x6 \
|
||||
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||
+resourcecontrol=deny \
|
||||
+-msg timestamp=on
|
||||
@@ -0,0 +1,49 @@
|
||||
From 98f1cf88fa7e0f992d93f376418fbfb3996a9690 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 17 May 2024 14:55:24 +0100
|
||||
Subject: [PATCH] rpc: avoid leak of GSource in use for interrupting main loop
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We never release the reference on the GSource created for
|
||||
interrupting the main loop, nor do we remove it from the
|
||||
main context if our thread is woken up prior to the wakeup
|
||||
callback firing.
|
||||
|
||||
This can result in a leak of GSource objects, along with an
|
||||
ever growing list of GSources attached to the main context,
|
||||
which will gradually slow down execution of the loop, as
|
||||
several operations are O(N) for the number of attached GSource
|
||||
objects.
|
||||
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
src/rpc/virnetclient.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
|
||||
index 147b0d661a..6d424eb599 100644
|
||||
--- a/src/rpc/virnetclient.c
|
||||
+++ b/src/rpc/virnetclient.c
|
||||
@@ -1946,7 +1946,7 @@ static int virNetClientIO(virNetClient *client,
|
||||
/* Check to see if another thread is dispatching */
|
||||
if (client->haveTheBuck) {
|
||||
/* Force other thread to wakeup from poll */
|
||||
- GSource *wakeup = g_idle_source_new();
|
||||
+ g_autoptr(GSource) wakeup = g_idle_source_new();
|
||||
g_source_set_callback(wakeup, virNetClientIOWakeup, client->eventLoop, NULL);
|
||||
g_source_attach(wakeup, client->eventCtx);
|
||||
|
||||
@@ -1968,6 +1968,7 @@ static int virNetClientIO(virNetClient *client,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ g_source_destroy(wakeup);
|
||||
VIR_DEBUG("Woken up from sleep head=%p call=%p",
|
||||
client->waitDispatch, thiscall);
|
||||
/* Three reasons we can be woken up
|
||||
--
|
||||
2.45.1
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
From 8074d64dc2eca846d6a61efe1a9b7428a0ce1dd1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 30 Apr 2024 11:51:15 +0100
|
||||
Subject: [PATCH] rpc: ensure temporary GSource is removed from client event
|
||||
loop
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Users are seeing periodic segfaults from libvirt client apps,
|
||||
especially thread heavy ones like virt-manager. A typical
|
||||
stack trace would end up in the virNetClientIOEventFD method,
|
||||
with illegal access to stale stack data. eg
|
||||
|
||||
==238721==ERROR: AddressSanitizer: stack-use-after-return on address 0x75cd18709788 at pc 0x75cd3111f907 bp 0x75cd181ff550 sp 0x75cd181ff548
|
||||
WRITE of size 4 at 0x75cd18709788 thread T11
|
||||
#0 0x75cd3111f906 in virNetClientIOEventFD /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1634:15
|
||||
#1 0x75cd3210d198 (/usr/lib/libglib-2.0.so.0+0x5a198) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
|
||||
#2 0x75cd3216c3be (/usr/lib/libglib-2.0.so.0+0xb93be) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
|
||||
#3 0x75cd3210ddc6 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x5adc6) (BuildId: 0a2311dfbbc6c215dc36f4b6bdd2b4b6fbae55a2)
|
||||
#4 0x75cd3111a47c in virNetClientIOEventLoop /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:1722:9
|
||||
#5 0x75cd3111a47c in virNetClientIO /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2002:10
|
||||
#6 0x75cd3111a47c in virNetClientSendInternal /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2170:11
|
||||
#7 0x75cd311198a8 in virNetClientSendWithReply /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclient.c:2198:11
|
||||
#8 0x75cd31111653 in virNetClientProgramCall /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/rpc/virnetclientprogram.c:318:9
|
||||
#9 0x75cd31241c8f in callFull /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6054:10
|
||||
#10 0x75cd31241c8f in call /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/remote/remote_driver.c:6076:12
|
||||
#11 0x75cd31241c8f in remoteNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/src/remote/remote_client_bodies.h:5959:9
|
||||
#12 0x75cd31410ff7 in virNetworkGetXMLDesc /usr/src/debug/libvirt/libvirt-10.2.0/build/../src/libvirt-network.c:952:15
|
||||
|
||||
The root cause is a bad assumption in the virNetClientIOEventLoop
|
||||
method. This method is run by whichever thread currently owns the
|
||||
buck, and is responsible for handling I/O. Inside a for(;;) loop,
|
||||
this method creates a temporary GSource, adds it to the event loop
|
||||
and runs g_main_loop_run(). When I/O is ready, the GSource callback
|
||||
(virNetClientIOEventFD) will fire and call g_main_loop_quit(), and
|
||||
return G_SOURCE_REMOVE which results in the temporary GSource being
|
||||
destroyed. A g_autoptr() will then remove the last reference.
|
||||
|
||||
What was overlooked, is that a second thread can come along and
|
||||
while it can't enter virNetClientIOEventLoop, it will register an
|
||||
idle source that uses virNetClientIOWakeup to interrupt the
|
||||
original thread's 'g_main_loop_run' call. When this happens the
|
||||
virNetClientIOEventFD callback never runs, and so the temporary
|
||||
GSource is not destroyed. The g_autoptr() will remove a reference,
|
||||
but by virtue of still being attached to the event context, there
|
||||
is an extra reference held causing GSource to be leaked. The
|
||||
next time 'g_main_loop_run' is called, the original GSource will
|
||||
trigger its callback, and access data that was allocated on the
|
||||
stack by the previous thread, and likely SEGV.
|
||||
|
||||
To solve this, the thread calling 'g_main_loop_run' must call
|
||||
g_source_destroy, immediately upon return, to guarantee that
|
||||
the temporary GSource is removed.
|
||||
|
||||
CVE-2024-4418
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reported-by: Martin Shirokov <shirokovmartin@gmail.com>
|
||||
Tested-by: Martin Shirokov <shirokovmartin@gmail.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
src/rpc/virnetclient.c | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
|
||||
index 68098b1c8d..147b0d661a 100644
|
||||
--- a/src/rpc/virnetclient.c
|
||||
+++ b/src/rpc/virnetclient.c
|
||||
@@ -1657,7 +1657,7 @@ static int virNetClientIOEventLoop(virNetClient *client,
|
||||
#endif /* !WIN32 */
|
||||
int timeout = -1;
|
||||
virNetMessage *msg = NULL;
|
||||
- g_autoptr(GSource) G_GNUC_UNUSED source = NULL;
|
||||
+ g_autoptr(GSource) source = NULL;
|
||||
GIOCondition ev = 0;
|
||||
struct virNetClientIOEventData data = {
|
||||
.client = client,
|
||||
@@ -1721,6 +1721,18 @@ static int virNetClientIOEventLoop(virNetClient *client,
|
||||
|
||||
g_main_loop_run(client->eventLoop);
|
||||
|
||||
+ /*
|
||||
+ * If virNetClientIOEventFD ran, this GSource will already be
|
||||
+ * destroyed due to G_SOURCE_REMOVE. It is harmless to re-destroy
|
||||
+ * it, since we still own a reference.
|
||||
+ *
|
||||
+ * If virNetClientIOWakeup ran, it will have interrupted the
|
||||
+ * g_main_loop_run call, before virNetClientIOEventFD could
|
||||
+ * run, and thus the GSource is still registered, and we need
|
||||
+ * to destroy it since it is referencing stack memory for 'data'
|
||||
+ */
|
||||
+ g_source_destroy(source);
|
||||
+
|
||||
#ifndef WIN32
|
||||
ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
|
||||
#endif /* !WIN32 */
|
||||
--
|
||||
2.45.1
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
From 7cb03e6a28e465c49f0cabe8fe2e7d21edb5aadf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Mon, 18 Dec 2023 12:17:18 +0000
|
||||
Subject: [PATCH] rpc: fix race in waking up client event loop
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The first thread to issue a client RPC request will own the event
|
||||
loop execution, sitting in the virNetClientIOEventLoop function.
|
||||
|
||||
It releases the client lock while running:
|
||||
|
||||
virNetClientUnlock()
|
||||
g_main_loop_run()
|
||||
virNetClientLock()
|
||||
|
||||
If a second thread arrives with an RPC request, it will queue it
|
||||
for the first thread to process. To inform the first thread that
|
||||
there's a new request it calls g_main_loop_quit() to break it out
|
||||
of the main loop.
|
||||
|
||||
This works if the first thread is in g_main_loop_run() at that
|
||||
time. There is a small window of opportunity, however, where
|
||||
the first thread has released the client lock, but not yet got
|
||||
into g_main_loop_run(). If that happens, the wakeup from the
|
||||
second thread is lost.
|
||||
|
||||
This patch deals with that by changing the way the wakeup is
|
||||
performed. Instead of directly calling g_main_loop_quit(), the
|
||||
second thread creates an idle source to run the quit function
|
||||
from within the first thread. This guarantees that the first
|
||||
thread will see the wakeup.
|
||||
|
||||
Tested by: Fima Shevrin <efim.shevrin@virtuozzo.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Denis V. Lunev <den@openvz.org>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
src/rpc/virnetclient.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
|
||||
index 4ab8af68c5..68098b1c8d 100644
|
||||
--- a/src/rpc/virnetclient.c
|
||||
+++ b/src/rpc/virnetclient.c
|
||||
@@ -1848,6 +1848,15 @@ static void virNetClientIOUpdateCallback(virNetClient *client,
|
||||
}
|
||||
|
||||
|
||||
+static gboolean virNetClientIOWakeup(gpointer opaque)
|
||||
+{
|
||||
+ GMainLoop *loop = opaque;
|
||||
+
|
||||
+ g_main_loop_quit(loop);
|
||||
+
|
||||
+ return G_SOURCE_REMOVE;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* This function sends a message to remote server and awaits a reply
|
||||
*
|
||||
@@ -1925,7 +1934,9 @@ static int virNetClientIO(virNetClient *client,
|
||||
/* Check to see if another thread is dispatching */
|
||||
if (client->haveTheBuck) {
|
||||
/* Force other thread to wakeup from poll */
|
||||
- g_main_loop_quit(client->eventLoop);
|
||||
+ GSource *wakeup = g_idle_source_new();
|
||||
+ g_source_set_callback(wakeup, virNetClientIOWakeup, client->eventLoop, NULL);
|
||||
+ g_source_attach(wakeup, client->eventCtx);
|
||||
|
||||
/* If we are non-blocking, detach the thread and keep the call in the
|
||||
* queue. */
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Fri, 7 Sep 2018 16:01:27 -0400
|
||||
Subject: [PATCH] qemu: Remove duplicated qemuAgentCheckError
|
||||
|
||||
Commit 5b3492fadb moved qemuAgentCheckError calls into
|
||||
qemuAgentCommand for various reasons; however, subsequent
|
||||
commit 0977b8aa0 adding a new command made call again
|
||||
So let's just remove the duplicitous call from
|
||||
qemuAgentGetInterfaces.
|
||||
|
||||
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
||||
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 9ed175fbc2deecfdaeabca7bc77c7e7ae33a3377)
|
||||
---
|
||||
src/qemu/qemu_agent.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
|
||||
index bf08871f18..d235c058a5 100644
|
||||
--- a/src/qemu/qemu_agent.c
|
||||
+++ b/src/qemu/qemu_agent.c
|
||||
@@ -1987,10 +1987,9 @@ qemuAgentGetInterfaces(qemuAgentPtr mon,
|
||||
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
|
||||
goto cleanup;
|
||||
|
||||
- if (qemuAgentCommand(mon, cmd, &reply, false, VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0 ||
|
||||
- qemuAgentCheckError(cmd, reply) < 0) {
|
||||
+ if (qemuAgentCommand(mon, cmd, &reply, false,
|
||||
+ VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
|
||||
goto cleanup;
|
||||
- }
|
||||
|
||||
if (!(ret_array = virJSONValueObjectGet(reply, "return"))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@@ -1,40 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 4 Jan 2019 10:17:46 +0100
|
||||
Subject: [PATCH] qemu: require reply from guest agent in
|
||||
qemuAgentGetInterfaces
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since its introduction in commit 0977b8aa071 (released in v1.2.14)
|
||||
qemuAgentGetInterfaces calls qemuAgentCommand with needReply=false,
|
||||
which allows qemuAgentCommand to return 0 even when it did not get
|
||||
any reply from the agent.
|
||||
|
||||
Set needReply to true, since we dereference it right after.
|
||||
|
||||
This can be hit if libvirt is waiting for an event from the agent
|
||||
(e.g. shutdown) and the agent cannot reply in time (e.g. due to
|
||||
the guest being shut down), as reported in:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1663051
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 7cfd1fbb1332ae5df678b9f41a62156cb2e88c73)
|
||||
---
|
||||
src/qemu/qemu_agent.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
|
||||
index d235c058a5..af0c054f99 100644
|
||||
--- a/src/qemu/qemu_agent.c
|
||||
+++ b/src/qemu/qemu_agent.c
|
||||
@@ -1987,7 +1987,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon,
|
||||
if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
|
||||
goto cleanup;
|
||||
|
||||
- if (qemuAgentCommand(mon, cmd, &reply, false,
|
||||
+ if (qemuAgentCommand(mon, cmd, &reply, true,
|
||||
VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK) < 0)
|
||||
goto cleanup;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 5 Apr 2019 11:33:32 +0200
|
||||
Subject: [PATCH] cpu_x86: Do not cache microcode version
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The microcode version checks are used to invalidate cached CPU data we
|
||||
get from QEMU. To minimize /proc/cpuinfo parsing the microcode version
|
||||
was only read when libvirtd started and cached for the daemon's
|
||||
lifetime. However, the CPU microcode can change anytime (updating the
|
||||
microcode package can automatically upload it to the CPU) and we need to
|
||||
stop caching it to avoid using stale CPU model data.
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit be46f613261d3b655a1f15afd635087e68a9c39b)
|
||||
---
|
||||
src/cpu/cpu_x86.c | 5 +----
|
||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
||||
index cb27550025..ce48ca6867 100644
|
||||
--- a/src/cpu/cpu_x86.c
|
||||
+++ b/src/cpu/cpu_x86.c
|
||||
@@ -163,7 +163,6 @@ struct _virCPUx86Map {
|
||||
};
|
||||
|
||||
static virCPUx86MapPtr cpuMap;
|
||||
-static unsigned int microcodeVersion;
|
||||
|
||||
int virCPUx86DriverOnceInit(void);
|
||||
VIR_ONCE_GLOBAL_INIT(virCPUx86Driver);
|
||||
@@ -1331,8 +1330,6 @@ virCPUx86DriverOnceInit(void)
|
||||
if (!(cpuMap = virCPUx86LoadMap()))
|
||||
return -1;
|
||||
|
||||
- microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2372,7 +2369,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
|
||||
goto cleanup;
|
||||
|
||||
ret = x86DecodeCPUData(cpu, cpuData, models);
|
||||
- cpu->microcodeVersion = microcodeVersion;
|
||||
+ cpu->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||
|
||||
cleanup:
|
||||
virCPUx86DataFree(cpuData);
|
||||
@@ -1,147 +0,0 @@
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 12 Apr 2019 21:21:05 +0200
|
||||
Subject: [PATCH] qemu: Don't cache microcode version
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
My earlier commit be46f61326 was incomplete. It removed caching of
|
||||
microcode version in the CPU driver, which means the capabilities XML
|
||||
will see the correct microcode version. But it is also cached in the
|
||||
QEMU capabilities cache where it is used to detect whether we need to
|
||||
reprobe QEMU. By missing the second place, the original commit
|
||||
be46f61326 made the situation even worse since libvirt would report
|
||||
correct microcode version while still using the old host CPU model
|
||||
(visible in domain capabilities XML).
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 673c62a3b7855a0685d8f116e227c402720b9ee9)
|
||||
|
||||
Conflicts:
|
||||
src/qemu/qemu_capabilities.c
|
||||
- virQEMUCapsCacheLookupByArch refactoring (commits
|
||||
7948ad4129a and 1a3de67001c) are missing
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 12 ++++++++----
|
||||
src/qemu/qemu_capabilities.h | 3 +--
|
||||
src/qemu/qemu_driver.c | 9 +--------
|
||||
tests/testutilsqemu.c | 2 +-
|
||||
4 files changed, 11 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index a075677421..eaf369f5b1 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -4700,7 +4700,7 @@ virQEMUCapsNewData(const char *binary,
|
||||
priv->libDir,
|
||||
priv->runUid,
|
||||
priv->runGid,
|
||||
- priv->microcodeVersion,
|
||||
+ virHostCPUGetMicrocodeVersion(),
|
||||
priv->kernelVersion);
|
||||
}
|
||||
|
||||
@@ -4783,8 +4783,7 @@ virFileCachePtr
|
||||
virQEMUCapsCacheNew(const char *libDir,
|
||||
const char *cacheDir,
|
||||
uid_t runUid,
|
||||
- gid_t runGid,
|
||||
- unsigned int microcodeVersion)
|
||||
+ gid_t runGid)
|
||||
{
|
||||
char *capsCacheDir = NULL;
|
||||
virFileCachePtr cache = NULL;
|
||||
@@ -4808,7 +4807,6 @@ virQEMUCapsCacheNew(const char *libDir,
|
||||
|
||||
priv->runUid = runUid;
|
||||
priv->runGid = runGid;
|
||||
- priv->microcodeVersion = microcodeVersion;
|
||||
|
||||
if (uname(&uts) == 0 &&
|
||||
virAsprintf(&priv->kernelVersion, "%s %s", uts.release, uts.version) < 0)
|
||||
@@ -4829,8 +4827,11 @@ virQEMUCapsPtr
|
||||
virQEMUCapsCacheLookup(virFileCachePtr cache,
|
||||
const char *binary)
|
||||
{
|
||||
+ virQEMUCapsCachePrivPtr priv = virFileCacheGetPriv(cache);
|
||||
virQEMUCapsPtr ret = NULL;
|
||||
|
||||
+ priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||
+
|
||||
ret = virFileCacheLookup(cache, binary);
|
||||
|
||||
VIR_DEBUG("Returning caps %p for %s", ret, binary);
|
||||
@@ -4876,10 +4877,13 @@ virQEMUCapsPtr
|
||||
virQEMUCapsCacheLookupByArch(virFileCachePtr cache,
|
||||
virArch arch)
|
||||
{
|
||||
+ virQEMUCapsCachePrivPtr priv = virFileCacheGetPriv(cache);
|
||||
virQEMUCapsPtr ret = NULL;
|
||||
virArch target;
|
||||
struct virQEMUCapsSearchData data = { .arch = arch };
|
||||
|
||||
+ priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
|
||||
+
|
||||
ret = virFileCacheLookupByFunc(cache, virQEMUCapsCompareArch, &data);
|
||||
if (!ret) {
|
||||
/* If the first attempt at finding capabilities has failed, try
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 3d3a978759..956babc7eb 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -574,8 +574,7 @@ void virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
|
||||
virFileCachePtr virQEMUCapsCacheNew(const char *libDir,
|
||||
const char *cacheDir,
|
||||
uid_t uid,
|
||||
- gid_t gid,
|
||||
- unsigned int microcodeVersion);
|
||||
+ gid_t gid);
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookup(virFileCachePtr cache,
|
||||
const char *binary);
|
||||
virQEMUCapsPtr virQEMUCapsCacheLookupCopy(virFileCachePtr cache,
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index a0f7c71675..75f8699e7d 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -592,8 +592,6 @@ qemuStateInitialize(bool privileged,
|
||||
char *hugepagePath = NULL;
|
||||
char *memoryBackingPath = NULL;
|
||||
size_t i;
|
||||
- virCPUDefPtr hostCPU = NULL;
|
||||
- unsigned int microcodeVersion = 0;
|
||||
|
||||
if (VIR_ALLOC(qemu_driver) < 0)
|
||||
return -1;
|
||||
@@ -813,15 +811,10 @@ qemuStateInitialize(bool privileged,
|
||||
run_gid = cfg->group;
|
||||
}
|
||||
|
||||
- if ((hostCPU = virCPUProbeHost(virArchFromHost())))
|
||||
- microcodeVersion = hostCPU->microcodeVersion;
|
||||
- virCPUDefFree(hostCPU);
|
||||
-
|
||||
qemu_driver->qemuCapsCache = virQEMUCapsCacheNew(cfg->libDir,
|
||||
cfg->cacheDir,
|
||||
run_uid,
|
||||
- run_gid,
|
||||
- microcodeVersion);
|
||||
+ run_gid);
|
||||
if (!qemu_driver->qemuCapsCache)
|
||||
goto error;
|
||||
|
||||
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
|
||||
index 8438613f28..4e53f03f9e 100644
|
||||
--- a/tests/testutilsqemu.c
|
||||
+++ b/tests/testutilsqemu.c
|
||||
@@ -707,7 +707,7 @@ int qemuTestDriverInit(virQEMUDriver *driver)
|
||||
|
||||
/* Using /dev/null for libDir and cacheDir automatically produces errors
|
||||
* upon attempt to use any of them */
|
||||
- driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null", 0, 0, 0);
|
||||
+ driver->qemuCapsCache = virQEMUCapsCacheNew("/dev/null", "/dev/null", 0, 0);
|
||||
if (!driver->qemuCapsCache)
|
||||
goto error;
|
||||
|
||||
@@ -1,880 +0,0 @@
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 5 Apr 2019 11:19:30 +0200
|
||||
Subject: [PATCH] cputest: Add data for Intel(R) Xeon(R) CPU E3-1225 v5
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 5cd9db3ac11e88846cbcf95fad9f6fae9d880dee)
|
||||
|
||||
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
|
||||
|
||||
Conflicts:
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
- intel-pt feature is missing
|
||||
- stibp feature is missing
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
tests/cputest.c | 1 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5-disabled.xml | 7 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml | 8 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5-guest.xml | 26 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5-host.xml | 27 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5-json.xml | 10 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5.json | 652 ++++++++++++++++++
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5.sig | 4 +
|
||||
.../x86_64-cpuid-Xeon-E3-1225-v5.xml | 47 ++
|
||||
9 files changed, 782 insertions(+)
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-disabled.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.json
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.sig
|
||||
create mode 100644 tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.xml
|
||||
|
||||
diff --git a/tests/cputest.c b/tests/cputest.c
|
||||
index baf2b3c648..fbb2a86af8 100644
|
||||
--- a/tests/cputest.c
|
||||
+++ b/tests/cputest.c
|
||||
@@ -1190,6 +1190,7 @@ mymain(void)
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Phenom-B95", JSON_HOST);
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Ryzen-7-1800X-Eight-Core", JSON_HOST);
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-5110", JSON_NONE);
|
||||
+ DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E3-1225-v5", JSON_MODELS);
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E3-1245-v5", JSON_MODELS);
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2609-v3", JSON_MODELS);
|
||||
DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-E5-2623-v4", JSON_MODELS);
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-disabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-disabled.xml
|
||||
new file mode 100644
|
||||
index 0000000000..ce51903e53
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-disabled.xml
|
||||
@@ -0,0 +1,7 @@
|
||||
+<!-- Features disabled by QEMU -->
|
||||
+<cpudata arch='x86'>
|
||||
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x0800c1fc' edx='0xb0600000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x02000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
|
||||
+</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
new file mode 100644
|
||||
index 0000000000..0deca9fba6
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
@@ -0,0 +1,8 @@
|
||||
+<!-- Features enabled by QEMU -->
|
||||
+<cpudata arch='x86'>
|
||||
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3203' edx='0x0f8bfbff'/>
|
||||
+ <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000004' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c4fbb' ecx='0x00000000' edx='0x8c000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000007' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
|
||||
+</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
new file mode 100644
|
||||
index 0000000000..993db80cc9
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
@@ -0,0 +1,26 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='forbid'>Skylake-Client-IBRS</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ds'/>
|
||||
+ <feature policy='require' name='acpi'/>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='ht'/>
|
||||
+ <feature policy='require' name='tm'/>
|
||||
+ <feature policy='require' name='pbe'/>
|
||||
+ <feature policy='require' name='dtes64'/>
|
||||
+ <feature policy='require' name='monitor'/>
|
||||
+ <feature policy='require' name='ds_cpl'/>
|
||||
+ <feature policy='require' name='vmx'/>
|
||||
+ <feature policy='require' name='smx'/>
|
||||
+ <feature policy='require' name='est'/>
|
||||
+ <feature policy='require' name='tm2'/>
|
||||
+ <feature policy='require' name='xtpr'/>
|
||||
+ <feature policy='require' name='pdcm'/>
|
||||
+ <feature policy='require' name='osxsave'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='ssbd'/>
|
||||
+ <feature policy='require' name='xsaves'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+ <feature policy='require' name='invtsc'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
new file mode 100644
|
||||
index 0000000000..074a39ba1d
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
@@ -0,0 +1,27 @@
|
||||
+<cpu>
|
||||
+ <arch>x86_64</arch>
|
||||
+ <model>Skylake-Client-IBRS</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature name='ds'/>
|
||||
+ <feature name='acpi'/>
|
||||
+ <feature name='ss'/>
|
||||
+ <feature name='ht'/>
|
||||
+ <feature name='tm'/>
|
||||
+ <feature name='pbe'/>
|
||||
+ <feature name='dtes64'/>
|
||||
+ <feature name='monitor'/>
|
||||
+ <feature name='ds_cpl'/>
|
||||
+ <feature name='vmx'/>
|
||||
+ <feature name='smx'/>
|
||||
+ <feature name='est'/>
|
||||
+ <feature name='tm2'/>
|
||||
+ <feature name='xtpr'/>
|
||||
+ <feature name='pdcm'/>
|
||||
+ <feature name='osxsave'/>
|
||||
+ <feature name='tsc_adjust'/>
|
||||
+ <feature name='clflushopt'/>
|
||||
+ <feature name='ssbd'/>
|
||||
+ <feature name='xsaves'/>
|
||||
+ <feature name='pdpe1gb'/>
|
||||
+ <feature name='invtsc'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
new file mode 100644
|
||||
index 0000000000..1984bd4cf2
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
@@ -0,0 +1,10 @@
|
||||
+<cpu mode='custom' match='exact'>
|
||||
+ <model fallback='forbid'>Skylake-Client-IBRS</model>
|
||||
+ <vendor>Intel</vendor>
|
||||
+ <feature policy='require' name='ss'/>
|
||||
+ <feature policy='require' name='hypervisor'/>
|
||||
+ <feature policy='require' name='tsc_adjust'/>
|
||||
+ <feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='ssbd'/>
|
||||
+ <feature policy='require' name='pdpe1gb'/>
|
||||
+</cpu>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.json b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.json
|
||||
new file mode 100644
|
||||
index 0000000000..084747556b
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.json
|
||||
@@ -0,0 +1,652 @@
|
||||
+{
|
||||
+ "return": {
|
||||
+ "model": {
|
||||
+ "name": "base",
|
||||
+ "props": {
|
||||
+ "phys-bits": 0,
|
||||
+ "core-id": -1,
|
||||
+ "xlevel": 2147483656,
|
||||
+ "cmov": true,
|
||||
+ "ia64": false,
|
||||
+ "aes": true,
|
||||
+ "mmx": true,
|
||||
+ "rdpid": false,
|
||||
+ "arat": true,
|
||||
+ "gfni": false,
|
||||
+ "pause-filter": false,
|
||||
+ "xsavec": true,
|
||||
+ "intel-pt": false,
|
||||
+ "osxsave": false,
|
||||
+ "hv-frequencies": false,
|
||||
+ "tsc-frequency": 0,
|
||||
+ "xd": true,
|
||||
+ "hv-vendor-id": "",
|
||||
+ "kvm-asyncpf": true,
|
||||
+ "kvm_asyncpf": true,
|
||||
+ "perfctr_core": false,
|
||||
+ "perfctr-core": false,
|
||||
+ "mpx": true,
|
||||
+ "pbe": false,
|
||||
+ "decodeassists": false,
|
||||
+ "avx512cd": false,
|
||||
+ "sse4_1": true,
|
||||
+ "sse4.1": true,
|
||||
+ "sse4-1": true,
|
||||
+ "family": 6,
|
||||
+ "legacy-cache": true,
|
||||
+ "vmware-cpuid-freq": true,
|
||||
+ "avx512f": false,
|
||||
+ "msr": true,
|
||||
+ "mce": true,
|
||||
+ "mca": true,
|
||||
+ "hv-runtime": false,
|
||||
+ "xcrypt": false,
|
||||
+ "thread-id": -1,
|
||||
+ "min-level": 13,
|
||||
+ "xgetbv1": true,
|
||||
+ "cid": false,
|
||||
+ "hv-relaxed": false,
|
||||
+ "hv-crash": false,
|
||||
+ "ds": false,
|
||||
+ "fxsr": true,
|
||||
+ "xsaveopt": true,
|
||||
+ "xtpr": false,
|
||||
+ "avx512vl": false,
|
||||
+ "avx512-vpopcntdq": false,
|
||||
+ "phe": false,
|
||||
+ "extapic": false,
|
||||
+ "3dnowprefetch": true,
|
||||
+ "avx512vbmi2": false,
|
||||
+ "cr8legacy": false,
|
||||
+ "stibp": true,
|
||||
+ "cpuid-0xb": true,
|
||||
+ "xcrypt-en": false,
|
||||
+ "kvm_pv_eoi": true,
|
||||
+ "apic-id": 4294967295,
|
||||
+ "pn": false,
|
||||
+ "dca": false,
|
||||
+ "vendor": "GenuineIntel",
|
||||
+ "pku": false,
|
||||
+ "smx": false,
|
||||
+ "cmp_legacy": false,
|
||||
+ "cmp-legacy": false,
|
||||
+ "node-id": -1,
|
||||
+ "avx512-4fmaps": false,
|
||||
+ "vmcb_clean": false,
|
||||
+ "vmcb-clean": false,
|
||||
+ "3dnowext": false,
|
||||
+ "hle": true,
|
||||
+ "npt": false,
|
||||
+ "memory": "/machine/unattached/system[0]",
|
||||
+ "clwb": false,
|
||||
+ "lbrv": false,
|
||||
+ "adx": true,
|
||||
+ "ss": true,
|
||||
+ "pni": true,
|
||||
+ "svm_lock": false,
|
||||
+ "svm-lock": false,
|
||||
+ "pfthreshold": false,
|
||||
+ "smep": true,
|
||||
+ "smap": true,
|
||||
+ "x2apic": true,
|
||||
+ "avx512vbmi": false,
|
||||
+ "avx512vnni": false,
|
||||
+ "hv-stimer": false,
|
||||
+ "i64": true,
|
||||
+ "flushbyasid": false,
|
||||
+ "f16c": true,
|
||||
+ "ace2-en": false,
|
||||
+ "pat": true,
|
||||
+ "pae": true,
|
||||
+ "sse": true,
|
||||
+ "phe-en": false,
|
||||
+ "kvm_nopiodelay": true,
|
||||
+ "kvm-nopiodelay": true,
|
||||
+ "tm": false,
|
||||
+ "kvmclock-stable-bit": true,
|
||||
+ "hypervisor": true,
|
||||
+ "socket-id": -1,
|
||||
+ "pcommit": false,
|
||||
+ "syscall": true,
|
||||
+ "level": 13,
|
||||
+ "avx512dq": false,
|
||||
+ "svm": false,
|
||||
+ "full-cpuid-auto-level": true,
|
||||
+ "hv-reset": false,
|
||||
+ "invtsc": false,
|
||||
+ "sse3": true,
|
||||
+ "sse2": true,
|
||||
+ "ssbd": true,
|
||||
+ "est": false,
|
||||
+ "avx512ifma": false,
|
||||
+ "tm2": false,
|
||||
+ "kvm-pv-eoi": true,
|
||||
+ "cx8": true,
|
||||
+ "kvm_mmu": false,
|
||||
+ "kvm-mmu": false,
|
||||
+ "sse4_2": true,
|
||||
+ "sse4.2": true,
|
||||
+ "sse4-2": true,
|
||||
+ "pge": true,
|
||||
+ "fill-mtrr-mask": true,
|
||||
+ "avx512bitalg": false,
|
||||
+ "nodeid_msr": false,
|
||||
+ "pdcm": false,
|
||||
+ "movbe": true,
|
||||
+ "model": 94,
|
||||
+ "nrip_save": false,
|
||||
+ "nrip-save": false,
|
||||
+ "kvm_pv_unhalt": true,
|
||||
+ "ssse3": true,
|
||||
+ "sse4a": false,
|
||||
+ "invpcid": true,
|
||||
+ "pdpe1gb": true,
|
||||
+ "tsc-deadline": true,
|
||||
+ "fma": true,
|
||||
+ "cx16": true,
|
||||
+ "de": true,
|
||||
+ "enforce": false,
|
||||
+ "stepping": 3,
|
||||
+ "xsave": true,
|
||||
+ "clflush": true,
|
||||
+ "skinit": false,
|
||||
+ "tsc": true,
|
||||
+ "tce": false,
|
||||
+ "fpu": true,
|
||||
+ "ibs": false,
|
||||
+ "ds_cpl": false,
|
||||
+ "ds-cpl": false,
|
||||
+ "host-phys-bits": true,
|
||||
+ "fma4": false,
|
||||
+ "la57": false,
|
||||
+ "osvw": false,
|
||||
+ "check": true,
|
||||
+ "hv-spinlocks": -1,
|
||||
+ "pmu": false,
|
||||
+ "pmm": false,
|
||||
+ "apic": true,
|
||||
+ "spec-ctrl": true,
|
||||
+ "min-xlevel2": 0,
|
||||
+ "tsc-adjust": true,
|
||||
+ "tsc_adjust": true,
|
||||
+ "kvm-steal-time": true,
|
||||
+ "kvm_steal_time": true,
|
||||
+ "kvmclock": true,
|
||||
+ "l3-cache": true,
|
||||
+ "lwp": false,
|
||||
+ "ibpb": false,
|
||||
+ "xop": false,
|
||||
+ "avx": true,
|
||||
+ "ospke": false,
|
||||
+ "ace2": false,
|
||||
+ "avx512bw": false,
|
||||
+ "acpi": false,
|
||||
+ "hv-vapic": false,
|
||||
+ "fsgsbase": true,
|
||||
+ "ht": false,
|
||||
+ "nx": true,
|
||||
+ "pclmulqdq": true,
|
||||
+ "mmxext": false,
|
||||
+ "vaes": false,
|
||||
+ "popcnt": true,
|
||||
+ "xsaves": false,
|
||||
+ "tcg-cpuid": true,
|
||||
+ "lm": true,
|
||||
+ "umip": false,
|
||||
+ "pse": true,
|
||||
+ "avx2": true,
|
||||
+ "sep": true,
|
||||
+ "pclmuldq": true,
|
||||
+ "virt-ssbd": false,
|
||||
+ "x-hv-max-vps": -1,
|
||||
+ "nodeid-msr": false,
|
||||
+ "md-clear": true,
|
||||
+ "kvm": true,
|
||||
+ "misalignsse": false,
|
||||
+ "min-xlevel": 2147483656,
|
||||
+ "kvm-pv-unhalt": true,
|
||||
+ "bmi2": true,
|
||||
+ "bmi1": true,
|
||||
+ "realized": false,
|
||||
+ "tsc_scale": false,
|
||||
+ "tsc-scale": false,
|
||||
+ "topoext": false,
|
||||
+ "hv-vpindex": false,
|
||||
+ "xlevel2": 0,
|
||||
+ "clflushopt": true,
|
||||
+ "kvm-no-smi-migration": false,
|
||||
+ "monitor": false,
|
||||
+ "avx512er": false,
|
||||
+ "pmm-en": false,
|
||||
+ "pcid": true,
|
||||
+ "3dnow": false,
|
||||
+ "erms": true,
|
||||
+ "lahf-lm": true,
|
||||
+ "lahf_lm": true,
|
||||
+ "vpclmulqdq": false,
|
||||
+ "fxsr-opt": false,
|
||||
+ "hv-synic": false,
|
||||
+ "xstore": false,
|
||||
+ "fxsr_opt": false,
|
||||
+ "kvm-hint-dedicated": false,
|
||||
+ "rtm": true,
|
||||
+ "lmce": true,
|
||||
+ "hv-time": false,
|
||||
+ "perfctr-nb": false,
|
||||
+ "perfctr_nb": false,
|
||||
+ "ffxsr": false,
|
||||
+ "rdrand": true,
|
||||
+ "rdseed": true,
|
||||
+ "avx512-4vnniw": false,
|
||||
+ "vmx": false,
|
||||
+ "vme": true,
|
||||
+ "dtes64": false,
|
||||
+ "mtrr": true,
|
||||
+ "rdtscp": true,
|
||||
+ "pse36": true,
|
||||
+ "kvm-pv-tlb-flush": false,
|
||||
+ "tbm": false,
|
||||
+ "wdt": false,
|
||||
+ "pause_filter": false,
|
||||
+ "sha-ni": false,
|
||||
+ "model-id": "Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz",
|
||||
+ "abm": true,
|
||||
+ "avx512pf": false,
|
||||
+ "xstore-en": false
|
||||
+ }
|
||||
+ }
|
||||
+ },
|
||||
+ "id": "model-expansion"
|
||||
+}
|
||||
+
|
||||
+{
|
||||
+ "return": [
|
||||
+ {
|
||||
+ "name": "max",
|
||||
+ "typename": "max-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": false
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "host",
|
||||
+ "typename": "host-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": false
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "base",
|
||||
+ "typename": "base-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": true,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "qemu64",
|
||||
+ "typename": "qemu64-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "qemu32",
|
||||
+ "typename": "qemu32-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "phenom",
|
||||
+ "typename": "phenom-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "mmxext",
|
||||
+ "fxsr-opt",
|
||||
+ "3dnowext",
|
||||
+ "3dnow",
|
||||
+ "sse4a",
|
||||
+ "npt"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "pentium3",
|
||||
+ "typename": "pentium3-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "pentium2",
|
||||
+ "typename": "pentium2-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "pentium",
|
||||
+ "typename": "pentium-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "n270",
|
||||
+ "typename": "n270-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "kvm64",
|
||||
+ "typename": "kvm64-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "kvm32",
|
||||
+ "typename": "kvm32-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "cpu64-rhel6",
|
||||
+ "typename": "cpu64-rhel6-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "sse4a"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "coreduo",
|
||||
+ "typename": "coreduo-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "core2duo",
|
||||
+ "typename": "core2duo-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "athlon",
|
||||
+ "typename": "athlon-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "mmxext",
|
||||
+ "3dnowext",
|
||||
+ "3dnow"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Westmere",
|
||||
+ "typename": "Westmere-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Westmere-IBRS",
|
||||
+ "typename": "Westmere-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Skylake-Server",
|
||||
+ "typename": "Skylake-Server-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "avx512f",
|
||||
+ "avx512dq",
|
||||
+ "clwb",
|
||||
+ "avx512cd",
|
||||
+ "avx512bw",
|
||||
+ "avx512vl",
|
||||
+ "avx512f",
|
||||
+ "avx512f",
|
||||
+ "avx512f"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Skylake-Server-IBRS",
|
||||
+ "typename": "Skylake-Server-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "avx512f",
|
||||
+ "avx512dq",
|
||||
+ "clwb",
|
||||
+ "avx512cd",
|
||||
+ "avx512bw",
|
||||
+ "avx512vl",
|
||||
+ "avx512f",
|
||||
+ "avx512f",
|
||||
+ "avx512f"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Skylake-Client",
|
||||
+ "typename": "Skylake-Client-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Skylake-Client-IBRS",
|
||||
+ "typename": "Skylake-Client-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "SandyBridge",
|
||||
+ "typename": "SandyBridge-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "SandyBridge-IBRS",
|
||||
+ "typename": "SandyBridge-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Penryn",
|
||||
+ "typename": "Penryn-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Opteron_G5",
|
||||
+ "typename": "Opteron_G5-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "sse4a",
|
||||
+ "misalignsse",
|
||||
+ "xop",
|
||||
+ "fma4",
|
||||
+ "tbm"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Opteron_G4",
|
||||
+ "typename": "Opteron_G4-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "sse4a",
|
||||
+ "misalignsse",
|
||||
+ "xop",
|
||||
+ "fma4"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Opteron_G3",
|
||||
+ "typename": "Opteron_G3-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "sse4a",
|
||||
+ "misalignsse"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Opteron_G2",
|
||||
+ "typename": "Opteron_G2-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Opteron_G1",
|
||||
+ "typename": "Opteron_G1-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Nehalem",
|
||||
+ "typename": "Nehalem-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Nehalem-IBRS",
|
||||
+ "typename": "Nehalem-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "IvyBridge",
|
||||
+ "typename": "IvyBridge-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "IvyBridge-IBRS",
|
||||
+ "typename": "IvyBridge-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Haswell",
|
||||
+ "typename": "Haswell-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Haswell-noTSX",
|
||||
+ "typename": "Haswell-noTSX-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Haswell-noTSX-IBRS",
|
||||
+ "typename": "Haswell-noTSX-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Haswell-IBRS",
|
||||
+ "typename": "Haswell-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "EPYC",
|
||||
+ "typename": "EPYC-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "sha-ni",
|
||||
+ "mmxext",
|
||||
+ "fxsr-opt",
|
||||
+ "cr8legacy",
|
||||
+ "sse4a",
|
||||
+ "misalignsse",
|
||||
+ "osvw"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "EPYC-IBPB",
|
||||
+ "typename": "EPYC-IBPB-x86_64-cpu",
|
||||
+ "unavailable-features": [
|
||||
+ "sha-ni",
|
||||
+ "mmxext",
|
||||
+ "fxsr-opt",
|
||||
+ "cr8legacy",
|
||||
+ "sse4a",
|
||||
+ "misalignsse",
|
||||
+ "osvw",
|
||||
+ "ibpb"
|
||||
+ ],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Conroe",
|
||||
+ "typename": "Conroe-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Broadwell",
|
||||
+ "typename": "Broadwell-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Broadwell-noTSX",
|
||||
+ "typename": "Broadwell-noTSX-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Broadwell-noTSX-IBRS",
|
||||
+ "typename": "Broadwell-noTSX-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "Broadwell-IBRS",
|
||||
+ "typename": "Broadwell-IBRS-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ },
|
||||
+ {
|
||||
+ "name": "486",
|
||||
+ "typename": "486-x86_64-cpu",
|
||||
+ "unavailable-features": [],
|
||||
+ "static": false,
|
||||
+ "migration-safe": true
|
||||
+ }
|
||||
+ ],
|
||||
+ "id": "definitions"
|
||||
+}
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.sig b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.sig
|
||||
new file mode 100644
|
||||
index 0000000000..7e57c2ded6
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.sig
|
||||
@@ -0,0 +1,4 @@
|
||||
+0506e3
|
||||
+family: 6 (0x06)
|
||||
+model: 94 (0x5e)
|
||||
+stepping: 3 (0x03)
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.xml
|
||||
new file mode 100644
|
||||
index 0000000000..437429d61d
|
||||
--- /dev/null
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5.xml
|
||||
@@ -0,0 +1,47 @@
|
||||
+<!-- Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz -->
|
||||
+<cpudata arch='x86'>
|
||||
+ <cpuid eax_in='0x00000000' ecx_in='0x00' eax='0x00000016' ebx='0x756e6547' ecx='0x6c65746e' edx='0x49656e69'/>
|
||||
+ <cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x000506e3' ebx='0x06100800' ecx='0x7ffafbff' edx='0xbfebfbff'/>
|
||||
+ <cpuid eax_in='0x00000002' ecx_in='0x00' eax='0x76036301' ebx='0x00f0b6ff' ecx='0x00000000' edx='0x00c30000'/>
|
||||
+ <cpuid eax_in='0x00000003' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000004' ecx_in='0x00' eax='0x1c004121' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000004' ecx_in='0x01' eax='0x1c004122' ebx='0x01c0003f' ecx='0x0000003f' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000004' ecx_in='0x02' eax='0x1c004143' ebx='0x00c0003f' ecx='0x000003ff' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000004' ecx_in='0x03' eax='0x1c03c163' ebx='0x03c0003f' ecx='0x00001fff' edx='0x00000006'/>
|
||||
+ <cpuid eax_in='0x00000005' ecx_in='0x00' eax='0x00000040' ebx='0x00000040' ecx='0x00000003' edx='0x00142120'/>
|
||||
+ <cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x000027f7' ebx='0x00000002' ecx='0x00000009' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x029c6fbf' ecx='0x00000000' edx='0x9c002400'/>
|
||||
+ <cpuid eax_in='0x00000008' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000009' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000a' ecx_in='0x00' eax='0x07300804' ebx='0x00000000' ecx='0x00000000' edx='0x00000603'/>
|
||||
+ <cpuid eax_in='0x0000000b' ecx_in='0x00' eax='0x00000001' ebx='0x00000001' ecx='0x00000100' edx='0x00000006'/>
|
||||
+ <cpuid eax_in='0x0000000b' ecx_in='0x01' eax='0x00000004' ebx='0x00000004' ecx='0x00000201' edx='0x00000006'/>
|
||||
+ <cpuid eax_in='0x0000000c' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x00' eax='0x0000001f' ebx='0x00000440' ecx='0x00000440' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x0000000f' ebx='0x000003c0' ecx='0x00000100' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x02' eax='0x00000100' ebx='0x00000240' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x03' eax='0x00000040' ebx='0x000003c0' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x04' eax='0x00000040' ebx='0x00000400' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000d' ecx_in='0x08' eax='0x00000080' ebx='0x00000000' ecx='0x00000001' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000e' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x0000000f' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000010' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000011' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000012' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000013' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000014' ecx_in='0x00' eax='0x00000001' ebx='0x0000000f' ecx='0x00000007' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000014' ecx_in='0x01' eax='0x02490002' ebx='0x003f3fff' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000015' ecx_in='0x00' eax='0x00000002' ebx='0x00000114' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x00000016' ecx_in='0x00' eax='0x00000ce4' ebx='0x00000e74' ecx='0x00000064' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000000' ecx_in='0x00' eax='0x80000008' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
|
||||
+ <cpuid eax_in='0x80000002' ecx_in='0x00' eax='0x65746e49' ebx='0x2952286c' ecx='0x6f655820' edx='0x2952286e'/>
|
||||
+ <cpuid eax_in='0x80000003' ecx_in='0x00' eax='0x55504320' ebx='0x2d334520' ecx='0x35323231' edx='0x20357620'/>
|
||||
+ <cpuid eax_in='0x80000004' ecx_in='0x00' eax='0x2e332040' ebx='0x48473033' ecx='0x0000007a' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000005' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000006' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x01006040' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80000007' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000000' edx='0x00000100'/>
|
||||
+ <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x00003027' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x00000ce4' ebx='0x00000e74' ecx='0x00000064' edx='0x00000000'/>
|
||||
+ <cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x00000ce4' ebx='0x00000e74' ecx='0x00000064' edx='0x00000000'/>
|
||||
+</cpudata>
|
||||
@@ -1,102 +0,0 @@
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Tue, 9 Apr 2019 12:35:52 +0200
|
||||
Subject: [PATCH] cpu_map: Define md-clear CPUID bit
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
|
||||
|
||||
The bit is set when microcode provides the mechanism to invoke a flush
|
||||
of various exploitable CPU buffers by invoking the VERW instruction.
|
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 538d873571d7a682852dc1d70e5f4478f4d64e85)
|
||||
|
||||
Conflicts:
|
||||
src/cpu_map/x86_features.xml
|
||||
- missing pconfig feature
|
||||
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-guest.xml
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268-host.xml
|
||||
- test data missing downstream
|
||||
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
- intel-pt feature is missing
|
||||
- stibp feature is missing
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
src/cpu_map/x86_features.xml | 3 +++
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml | 2 +-
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml | 1 +
|
||||
tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml | 1 +
|
||||
5 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml
|
||||
index 109c653dbc..c8ae540ccc 100644
|
||||
--- a/src/cpu_map/x86_features.xml
|
||||
+++ b/src/cpu_map/x86_features.xml
|
||||
@@ -290,6 +290,9 @@
|
||||
<feature name='avx512-4fmaps'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000008'/>
|
||||
</feature>
|
||||
+ <feature name='md-clear'> <!-- md_clear -->
|
||||
+ <cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000400'/>
|
||||
+ </feature>
|
||||
<feature name='spec-ctrl'>
|
||||
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x04000000'/>
|
||||
</feature>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
index 0deca9fba6..74763a462b 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-enabled.xml
|
||||
@@ -2,7 +2,7 @@
|
||||
<cpudata arch='x86'>
|
||||
<cpuid eax_in='0x00000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0xf7fa3203' edx='0x0f8bfbff'/>
|
||||
<cpuid eax_in='0x00000006' ecx_in='0x00' eax='0x00000004' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
- <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c4fbb' ecx='0x00000000' edx='0x8c000000'/>
|
||||
+ <cpuid eax_in='0x00000007' ecx_in='0x00' eax='0x00000000' ebx='0x009c4fbb' ecx='0x00000000' edx='0x8c000400'/>
|
||||
<cpuid eax_in='0x0000000d' ecx_in='0x01' eax='0x00000007' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
|
||||
<cpuid eax_in='0x80000001' ecx_in='0x00' eax='0x00000000' ebx='0x00000000' ecx='0x00000121' edx='0x2c100800'/>
|
||||
</cpudata>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
index 993db80cc9..29c1fdb80a 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-guest.xml
|
||||
@@ -19,6 +19,7 @@
|
||||
<feature policy='require' name='osxsave'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='md-clear'/>
|
||||
<feature policy='require' name='ssbd'/>
|
||||
<feature policy='require' name='xsaves'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
index 074a39ba1d..2003ca9ef6 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-host.xml
|
||||
@@ -20,6 +20,7 @@
|
||||
<feature name='osxsave'/>
|
||||
<feature name='tsc_adjust'/>
|
||||
<feature name='clflushopt'/>
|
||||
+ <feature name='md-clear'/>
|
||||
<feature name='ssbd'/>
|
||||
<feature name='xsaves'/>
|
||||
<feature name='pdpe1gb'/>
|
||||
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
index 1984bd4cf2..d6529c59a3 100644
|
||||
--- a/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-E3-1225-v5-json.xml
|
||||
@@ -5,6 +5,7 @@
|
||||
<feature policy='require' name='hypervisor'/>
|
||||
<feature policy='require' name='tsc_adjust'/>
|
||||
<feature policy='require' name='clflushopt'/>
|
||||
+ <feature policy='require' name='md-clear'/>
|
||||
<feature policy='require' name='ssbd'/>
|
||||
<feature policy='require' name='pdpe1gb'/>
|
||||
</cpu>
|
||||
@@ -1,54 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 30 Apr 2019 17:26:13 +0100
|
||||
Subject: [PATCH] admin: reject clients unless their UID matches the current
|
||||
UID
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The admin protocol RPC messages are only intended for use by the user
|
||||
running the daemon. As such they should not be allowed for any client
|
||||
UID that does not match the server UID.
|
||||
|
||||
Fixes CVE-2019-10132
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 96f41cd765c9e525fe28ee5abbfbf4a79b3720c7)
|
||||
---
|
||||
src/admin/admin_server_dispatch.c | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/src/admin/admin_server_dispatch.c b/src/admin/admin_server_dispatch.c
|
||||
index b78ff902c0..9f25813ae3 100644
|
||||
--- a/src/admin/admin_server_dispatch.c
|
||||
+++ b/src/admin/admin_server_dispatch.c
|
||||
@@ -66,6 +66,28 @@ remoteAdmClientNew(virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
void *opaque)
|
||||
{
|
||||
struct daemonAdmClientPrivate *priv;
|
||||
+ uid_t clientuid;
|
||||
+ gid_t clientgid;
|
||||
+ pid_t clientpid;
|
||||
+ unsigned long long timestamp;
|
||||
+
|
||||
+ if (virNetServerClientGetUNIXIdentity(client,
|
||||
+ &clientuid,
|
||||
+ &clientgid,
|
||||
+ &clientpid,
|
||||
+ ×tamp) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ VIR_DEBUG("New client pid %lld uid %lld",
|
||||
+ (long long)clientpid,
|
||||
+ (long long)clientuid);
|
||||
+
|
||||
+ if (geteuid() != clientuid) {
|
||||
+ virReportRestrictedError(_("Disallowing client %lld with uid %lld"),
|
||||
+ (long long)clientpid,
|
||||
+ (long long)clientuid);
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
if (VIR_ALLOC(priv) < 0)
|
||||
return NULL;
|
||||
@@ -1,47 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 30 Apr 2019 16:51:37 +0100
|
||||
Subject: [PATCH] locking: restrict sockets to mode 0600
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virtlockd daemon's only intended client is the libvirtd daemon. As
|
||||
such it should never allow clients from other user accounts to connect.
|
||||
The code already enforces this and drops clients from other UIDs, but
|
||||
we can get earlier (and thus stronger) protection against DoS by setting
|
||||
the socket permissions to 0600
|
||||
|
||||
Fixes CVE-2019-10132
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit f111e09468693909b1f067aa575efdafd9a262a1)
|
||||
---
|
||||
src/locking/virtlockd-admin.socket.in | 1 +
|
||||
src/locking/virtlockd.socket.in | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/locking/virtlockd-admin.socket.in b/src/locking/virtlockd-admin.socket.in
|
||||
index 2a7500f3d0..f674c492f7 100644
|
||||
--- a/src/locking/virtlockd-admin.socket.in
|
||||
+++ b/src/locking/virtlockd-admin.socket.in
|
||||
@@ -5,6 +5,7 @@ Before=libvirtd.service
|
||||
[Socket]
|
||||
ListenStream=@localstatedir@/run/libvirt/virtlockd-admin-sock
|
||||
Service=virtlockd.service
|
||||
+SocketMode=0600
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
diff --git a/src/locking/virtlockd.socket.in b/src/locking/virtlockd.socket.in
|
||||
index 45e0f20235..d701b27516 100644
|
||||
--- a/src/locking/virtlockd.socket.in
|
||||
+++ b/src/locking/virtlockd.socket.in
|
||||
@@ -4,6 +4,7 @@ Before=libvirtd.service
|
||||
|
||||
[Socket]
|
||||
ListenStream=@localstatedir@/run/libvirt/virtlockd-sock
|
||||
+SocketMode=0600
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
@@ -1,47 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 30 Apr 2019 17:27:41 +0100
|
||||
Subject: [PATCH] logging: restrict sockets to mode 0600
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virtlogd daemon's only intended client is the libvirtd daemon. As
|
||||
such it should never allow clients from other user accounts to connect.
|
||||
The code already enforces this and drops clients from other UIDs, but
|
||||
we can get earlier (and thus stronger) protection against DoS by setting
|
||||
the socket permissions to 0600
|
||||
|
||||
Fixes CVE-2019-10132
|
||||
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit e37bd65f9948c1185456b2cdaa3bd6e875af680f)
|
||||
---
|
||||
src/logging/virtlogd-admin.socket.in | 1 +
|
||||
src/logging/virtlogd.socket.in | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/logging/virtlogd-admin.socket.in b/src/logging/virtlogd-admin.socket.in
|
||||
index 595e6c4c4b..5c41dfeb7b 100644
|
||||
--- a/src/logging/virtlogd-admin.socket.in
|
||||
+++ b/src/logging/virtlogd-admin.socket.in
|
||||
@@ -5,6 +5,7 @@ Before=libvirtd.service
|
||||
[Socket]
|
||||
ListenStream=@localstatedir@/run/libvirt/virtlogd-admin-sock
|
||||
Service=virtlogd.service
|
||||
+SocketMode=0600
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
diff --git a/src/logging/virtlogd.socket.in b/src/logging/virtlogd.socket.in
|
||||
index 22b9360c8d..ae48cdab9a 100644
|
||||
--- a/src/logging/virtlogd.socket.in
|
||||
+++ b/src/logging/virtlogd.socket.in
|
||||
@@ -4,6 +4,7 @@ Before=libvirtd.service
|
||||
|
||||
[Socket]
|
||||
ListenStream=@localstatedir@/run/libvirt/virtlogd-sock
|
||||
+SocketMode=0600
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
@@ -1,80 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 14 Jun 2019 08:47:42 +0200
|
||||
Subject: [PATCH] api: disallow virDomainSaveImageGetXMLDesc on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virDomainSaveImageGetXMLDesc API is taking a path parameter,
|
||||
which can point to any path on the system. This file will then be
|
||||
read and parsed by libvirtd running with root privileges.
|
||||
|
||||
Forbid it on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10161
|
||||
Reported-by: Matthias Gerstner <mgerstner@suse.de>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit aed6a032cead4386472afb24b16196579e239580)
|
||||
---
|
||||
src/libvirt-domain.c | 10 ++--------
|
||||
src/qemu/qemu_driver.c | 2 +-
|
||||
src/remote/remote_protocol.x | 3 +--
|
||||
3 files changed, 4 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index ef460277f7..cda579180b 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -1073,8 +1073,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
|
||||
* previously by virDomainSave() or virDomainSaveFlags().
|
||||
*
|
||||
* No security-sensitive data will be included unless @flags contains
|
||||
- * VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only
|
||||
- * connections. For this API, @flags should not contain either
|
||||
+ * VIR_DOMAIN_XML_SECURE
|
||||
* VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU.
|
||||
*
|
||||
* Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of
|
||||
@@ -1091,12 +1090,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
virCheckNonNullArgGoto(file, error);
|
||||
-
|
||||
- if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
|
||||
- virReportError(VIR_ERR_OPERATION_DENIED, "%s",
|
||||
- _("virDomainSaveImageGetXMLDesc with secure flag"));
|
||||
- goto error;
|
||||
- }
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->domainSaveImageGetXMLDesc) {
|
||||
char *ret;
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 75f8699e7d..933f71c7b8 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -6791,7 +6791,7 @@ qemuDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *path,
|
||||
if (fd < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (virDomainSaveImageGetXMLDescEnsureACL(conn, def, flags) < 0)
|
||||
+ if (virDomainSaveImageGetXMLDescEnsureACL(conn, def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = qemuDomainDefFormatXML(driver, def, flags);
|
||||
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
|
||||
index 28c8febabd..52b92334fa 100644
|
||||
--- a/src/remote/remote_protocol.x
|
||||
+++ b/src/remote/remote_protocol.x
|
||||
@@ -5226,8 +5226,7 @@ enum remote_procedure {
|
||||
/**
|
||||
* @generate: both
|
||||
* @priority: high
|
||||
- * @acl: domain:read
|
||||
- * @acl: domain:read_secure:VIR_DOMAIN_XML_SECURE
|
||||
+ * @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC = 235,
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 14 Jun 2019 09:14:53 +0200
|
||||
Subject: [PATCH] api: disallow virDomainManagedSaveDefineXML on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virDomainManagedSaveDefineXML can be used to alter the domain's
|
||||
config used for managedsave or even execute arbitrary emulator binaries.
|
||||
Forbid it on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10166
|
||||
Reported-by: Matthias Gerstner <mgerstner@suse.de>
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit db0b78457f183e4c7ac45bc94de86044a1e2056a)
|
||||
---
|
||||
src/libvirt-domain.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index cda579180b..4c0355180e 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -9483,6 +9483,7 @@ virDomainManagedSaveDefineXML(virDomainPtr domain, const char *dxml,
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
conn = domain->conn;
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->domainManagedSaveDefineXML) {
|
||||
int ret;
|
||||
@@ -1,31 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 14 Jun 2019 09:16:14 +0200
|
||||
Subject: [PATCH] api: disallow virConnectGetDomainCapabilities on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This API can be used to execute arbitrary emulators.
|
||||
Forbid it on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10167
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 8afa68bac0cf99d1f8aaa6566685c43c22622f26)
|
||||
---
|
||||
src/libvirt-domain.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index 4c0355180e..8ecb964381 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -11275,6 +11275,7 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
virResetLastError();
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->connectGetDomainCapabilities) {
|
||||
char *ret;
|
||||
@@ -1,39 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Fri, 14 Jun 2019 09:17:39 +0200
|
||||
Subject: [PATCH] api: disallow virConnect*HypervisorCPU on read-only
|
||||
connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
These APIs can be used to execute arbitrary emulators.
|
||||
Forbid them on read-only connections.
|
||||
|
||||
Fixes: CVE-2019-10168
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit bf6c2830b6c338b1f5699b095df36f374777b291)
|
||||
---
|
||||
src/libvirt-host.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/libvirt-host.c b/src/libvirt-host.c
|
||||
index e20d6ee250..2978825d22 100644
|
||||
--- a/src/libvirt-host.c
|
||||
+++ b/src/libvirt-host.c
|
||||
@@ -1041,6 +1041,7 @@ virConnectCompareHypervisorCPU(virConnectPtr conn,
|
||||
|
||||
virCheckConnectReturn(conn, VIR_CPU_COMPARE_ERROR);
|
||||
virCheckNonNullArgGoto(xmlCPU, error);
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->connectCompareHypervisorCPU) {
|
||||
int ret;
|
||||
@@ -1234,6 +1235,7 @@ virConnectBaselineHypervisorCPU(virConnectPtr conn,
|
||||
|
||||
virCheckConnectReturn(conn, NULL);
|
||||
virCheckNonNullArgGoto(xmlCPUs, error);
|
||||
+ virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->connectBaselineHypervisorCPU) {
|
||||
char *cpu;
|
||||
@@ -1,32 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 27 Mar 2019 10:59:58 +0000
|
||||
Subject: [PATCH] api: disallow virDomainGetHostname for read-only connections
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The virDomainGetHostname API is fetching guest information and this may
|
||||
involve use of an untrusted guest agent. As such its use must be
|
||||
forbidden on a read-only connection to libvirt.
|
||||
|
||||
Fixes CVE-2019-3886
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 2a07c990bd9143d7a0fe8d1b6b7c763c52185240)
|
||||
---
|
||||
src/libvirt-domain.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index 8ecb964381..cc2f61275d 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -10940,6 +10940,8 @@ virDomainGetHostname(virDomainPtr domain, unsigned int flags)
|
||||
virCheckDomainReturn(domain, NULL);
|
||||
conn = domain->conn;
|
||||
|
||||
+ virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||
+
|
||||
if (conn->driver->domainGetHostname) {
|
||||
char *ret;
|
||||
ret = conn->driver->domainGetHostname(domain, flags);
|
||||
@@ -1,42 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 27 Mar 2019 11:22:49 +0000
|
||||
Subject: [PATCH] remote: enforce ACL write permission for getting guest time &
|
||||
hostname
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Getting the guest time and hostname both require use of guest agent
|
||||
commands. These must not be allowed for read-only users, so the
|
||||
permissions check must validate "write" permission not "read".
|
||||
|
||||
Fixes CVE-2019-3886
|
||||
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit ae076bb40e0e150aef41361b64001138d04d6c60)
|
||||
---
|
||||
src/remote/remote_protocol.x | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
|
||||
index 52b92334fa..58ab4ab039 100644
|
||||
--- a/src/remote/remote_protocol.x
|
||||
+++ b/src/remote/remote_protocol.x
|
||||
@@ -5496,7 +5496,7 @@ enum remote_procedure {
|
||||
|
||||
/**
|
||||
* @generate: both
|
||||
- * @acl: domain:read
|
||||
+ * @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_GET_HOSTNAME = 277,
|
||||
|
||||
@@ -5891,7 +5891,7 @@ enum remote_procedure {
|
||||
|
||||
/**
|
||||
* @generate: none
|
||||
- * @acl: domain:read
|
||||
+ * @acl: domain:write
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_GET_TIME = 337,
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 24 Sep 2018 16:49:01 +0200
|
||||
Subject: [PATCH] Revert "qemu: hotplug: Prepare disk source in
|
||||
qemuDomainAttachDeviceDiskLive"
|
||||
|
||||
Preparing the storage source prior to assigning the alias will not work
|
||||
as the names of the certain objects depend on the alias for the legacy
|
||||
hotplug case as we generate the object names for the secrets based on
|
||||
the alias.
|
||||
|
||||
This reverts commit 192fdaa614e3800255048a8a70c1292ccf18397a.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
(cherry picked from commit 9ac196997839a29486029a02d8f519df54ae0186)
|
||||
---
|
||||
src/qemu/qemu_hotplug.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
||||
index 4f290b5648..421cc2c174 100644
|
||||
--- a/src/qemu/qemu_hotplug.c
|
||||
+++ b/src/qemu/qemu_hotplug.c
|
||||
@@ -781,6 +781,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuHotplugDiskSourceDataPtr diskdata = NULL;
|
||||
char *devstr = NULL;
|
||||
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
if (qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, false) < 0)
|
||||
goto cleanup;
|
||||
@@ -788,6 +789,9 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
|
||||
+ if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
if (!(diskdata = qemuHotplugDiskSourceAttachPrepare(disk, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
||||
@@ -822,6 +826,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
|
||||
qemuHotplugDiskSourceDataFree(diskdata);
|
||||
qemuDomainSecretDiskDestroy(disk);
|
||||
VIR_FREE(devstr);
|
||||
+ virObjectUnref(cfg);
|
||||
return ret;
|
||||
|
||||
exit_monitor:
|
||||
@@ -1062,8 +1067,6 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
|
||||
bool forceMediaChange)
|
||||
{
|
||||
size_t i;
|
||||
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
- qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virDomainDiskDefPtr disk = dev->data.disk;
|
||||
virDomainDiskDefPtr orig_disk = NULL;
|
||||
int ret = -1;
|
||||
@@ -1080,9 +1083,6 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
|
||||
if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0)
|
||||
- goto cleanup;
|
||||
-
|
||||
switch ((virDomainDiskDevice) disk->device) {
|
||||
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
||||
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
|
||||
@@ -1153,7 +1153,6 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
|
||||
cleanup:
|
||||
if (ret != 0)
|
||||
ignore_value(qemuRemoveSharedDevice(driver, dev, vm->def->name));
|
||||
- virObjectUnref(cfg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
|
||||
Date: Tue, 22 Jan 2019 12:26:15 -0700
|
||||
Subject: [PATCH] util: Fixing invalid error checking from virPCIGetNetname()
|
||||
|
||||
The @linkdev is In/Out function parameter as second order
|
||||
reference pointer so requires first order dereference for
|
||||
checking NULL which can be the result of virPCIGetNetName().
|
||||
|
||||
Fixes: d6ee56d7237 (util: change virPCIGetNetName() to not return error if device has no net name)
|
||||
Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
|
||||
Signed-off-by: dann frazier <dann.frazier@canonical.com>
|
||||
(cherry picked from commit 04983c3c6a821f67994b1c65d4d6175f3ac49d69)
|
||||
---
|
||||
src/util/virhostdev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
|
||||
index ca79c37787..d9a3711386 100644
|
||||
--- a/src/util/virhostdev.c
|
||||
+++ b/src/util/virhostdev.c
|
||||
@@ -319,7 +319,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev,
|
||||
if (virPCIGetNetName(sysfs_path, 0, NULL, linkdev) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!linkdev) {
|
||||
+ if (!(*linkdev)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("The device at %s has no network device name"),
|
||||
sysfs_path);
|
||||
@@ -1,203 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 1 May 2018 11:34:51 +0100
|
||||
Subject: [PATCH] tests: merge code for UNIX and TCP socket testing
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The test code for UNIX and TCP sockets will need to be rewritten and
|
||||
extended later, and will benefit from code sharing.
|
||||
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 9e2fad87b429060842a536de26d6af61ea3d96ea)
|
||||
---
|
||||
tests/virnetsockettest.c | 120 +++++++++++++++++----------------------
|
||||
1 file changed, 51 insertions(+), 69 deletions(-)
|
||||
|
||||
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
|
||||
index 9f9a243484..e463d432ff 100644
|
||||
--- a/tests/virnetsockettest.c
|
||||
+++ b/tests/virnetsockettest.c
|
||||
@@ -116,38 +116,67 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
|
||||
}
|
||||
|
||||
|
||||
-struct testTCPData {
|
||||
+struct testSocketData {
|
||||
const char *lnode;
|
||||
int port;
|
||||
const char *cnode;
|
||||
};
|
||||
|
||||
-static int testSocketTCPAccept(const void *opaque)
|
||||
+static int testSocketAccept(const void *opaque)
|
||||
{
|
||||
virNetSocketPtr *lsock = NULL; /* Listen socket */
|
||||
size_t nlsock = 0, i;
|
||||
virNetSocketPtr ssock = NULL; /* Server socket */
|
||||
virNetSocketPtr csock = NULL; /* Client socket */
|
||||
- const struct testTCPData *data = opaque;
|
||||
+ const struct testSocketData *data = opaque;
|
||||
int ret = -1;
|
||||
char portstr[100];
|
||||
+ char *tmpdir = NULL;
|
||||
+ char *path = NULL;
|
||||
+ char template[] = "/tmp/libvirt_XXXXXX";
|
||||
|
||||
- snprintf(portstr, sizeof(portstr), "%d", data->port);
|
||||
+ if (!data) {
|
||||
+ virNetSocketPtr usock;
|
||||
+ tmpdir = mkdtemp(template);
|
||||
+ if (tmpdir == NULL) {
|
||||
+ VIR_WARN("Failed to create temporary directory");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (virAsprintf(&path, "%s/test.sock", tmpdir) < 0)
|
||||
+ goto cleanup;
|
||||
|
||||
- if (virNetSocketNewListenTCP(data->lnode, portstr,
|
||||
- AF_UNSPEC,
|
||||
- &lsock, &nlsock) < 0)
|
||||
- goto cleanup;
|
||||
+ if (virNetSocketNewListenUNIX(path, 0700, -1, getegid(), &usock) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (VIR_ALLOC_N(lsock, 1) < 0) {
|
||||
+ virObjectUnref(usock);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ lsock[0] = usock;
|
||||
+ nlsock = 1;
|
||||
+ } else {
|
||||
+ snprintf(portstr, sizeof(portstr), "%d", data->port);
|
||||
+ if (virNetSocketNewListenTCP(data->lnode, portstr,
|
||||
+ AF_UNSPEC,
|
||||
+ &lsock, &nlsock) < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < nlsock; i++) {
|
||||
if (virNetSocketListen(lsock[i], 0) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (virNetSocketNewConnectTCP(data->cnode, portstr,
|
||||
- AF_UNSPEC,
|
||||
- &csock) < 0)
|
||||
- goto cleanup;
|
||||
+ if (!data) {
|
||||
+ if (virNetSocketNewConnectUNIX(path, false, NULL, &csock) < 0)
|
||||
+ goto cleanup;
|
||||
+ } else {
|
||||
+ if (virNetSocketNewConnectTCP(data->cnode, portstr,
|
||||
+ AF_UNSPEC,
|
||||
+ &csock) < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
|
||||
virObjectUnref(csock);
|
||||
|
||||
@@ -171,62 +200,15 @@ static int testSocketTCPAccept(const void *opaque)
|
||||
for (i = 0; i < nlsock; i++)
|
||||
virObjectUnref(lsock[i]);
|
||||
VIR_FREE(lsock);
|
||||
- return ret;
|
||||
-}
|
||||
-#endif
|
||||
-
|
||||
-
|
||||
-#ifndef WIN32
|
||||
-static int testSocketUNIXAccept(const void *data ATTRIBUTE_UNUSED)
|
||||
-{
|
||||
- virNetSocketPtr lsock = NULL; /* Listen socket */
|
||||
- virNetSocketPtr ssock = NULL; /* Server socket */
|
||||
- virNetSocketPtr csock = NULL; /* Client socket */
|
||||
- int ret = -1;
|
||||
-
|
||||
- char *path = NULL;
|
||||
- char *tmpdir;
|
||||
- char template[] = "/tmp/libvirt_XXXXXX";
|
||||
-
|
||||
- tmpdir = mkdtemp(template);
|
||||
- if (tmpdir == NULL) {
|
||||
- VIR_WARN("Failed to create temporary directory");
|
||||
- goto cleanup;
|
||||
- }
|
||||
- if (virAsprintf(&path, "%s/test.sock", tmpdir) < 0)
|
||||
- goto cleanup;
|
||||
-
|
||||
- if (virNetSocketNewListenUNIX(path, 0700, -1, getegid(), &lsock) < 0)
|
||||
- goto cleanup;
|
||||
-
|
||||
- if (virNetSocketListen(lsock, 0) < 0)
|
||||
- goto cleanup;
|
||||
-
|
||||
- if (virNetSocketNewConnectUNIX(path, false, NULL, &csock) < 0)
|
||||
- goto cleanup;
|
||||
-
|
||||
- virObjectUnref(csock);
|
||||
-
|
||||
- if (virNetSocketAccept(lsock, &ssock) != -1) {
|
||||
- char c = 'a';
|
||||
- if (virNetSocketWrite(ssock, &c, 1) != -1) {
|
||||
- VIR_DEBUG("Unexpected client socket present");
|
||||
- goto cleanup;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- ret = 0;
|
||||
-
|
||||
- cleanup:
|
||||
VIR_FREE(path);
|
||||
- virObjectUnref(lsock);
|
||||
- virObjectUnref(ssock);
|
||||
if (tmpdir)
|
||||
rmdir(tmpdir);
|
||||
return ret;
|
||||
}
|
||||
+#endif
|
||||
|
||||
|
||||
+#ifndef WIN32
|
||||
static int testSocketUNIXAddrs(const void *data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virNetSocketPtr lsock = NULL; /* Listen socket */
|
||||
@@ -456,28 +438,28 @@ mymain(void)
|
||||
}
|
||||
|
||||
if (hasIPv4) {
|
||||
- struct testTCPData tcpData = { "127.0.0.1", freePort, "127.0.0.1" };
|
||||
- if (virTestRun("Socket TCP/IPv4 Accept", testSocketTCPAccept, &tcpData) < 0)
|
||||
+ struct testSocketData tcpData = { "127.0.0.1", freePort, "127.0.0.1" };
|
||||
+ if (virTestRun("Socket TCP/IPv4 Accept", testSocketAccept, &tcpData) < 0)
|
||||
ret = -1;
|
||||
}
|
||||
if (hasIPv6) {
|
||||
- struct testTCPData tcpData = { "::1", freePort, "::1" };
|
||||
- if (virTestRun("Socket TCP/IPv6 Accept", testSocketTCPAccept, &tcpData) < 0)
|
||||
+ struct testSocketData tcpData = { "::1", freePort, "::1" };
|
||||
+ if (virTestRun("Socket TCP/IPv6 Accept", testSocketAccept, &tcpData) < 0)
|
||||
ret = -1;
|
||||
}
|
||||
if (hasIPv6 && hasIPv4) {
|
||||
- struct testTCPData tcpData = { NULL, freePort, "127.0.0.1" };
|
||||
- if (virTestRun("Socket TCP/IPv4+IPv6 Accept", testSocketTCPAccept, &tcpData) < 0)
|
||||
+ struct testSocketData tcpData = { NULL, freePort, "127.0.0.1" };
|
||||
+ if (virTestRun("Socket TCP/IPv4+IPv6 Accept", testSocketAccept, &tcpData) < 0)
|
||||
ret = -1;
|
||||
|
||||
tcpData.cnode = "::1";
|
||||
- if (virTestRun("Socket TCP/IPv4+IPv6 Accept", testSocketTCPAccept, &tcpData) < 0)
|
||||
+ if (virTestRun("Socket TCP/IPv4+IPv6 Accept", testSocketAccept, &tcpData) < 0)
|
||||
ret = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
- if (virTestRun("Socket UNIX Accept", testSocketUNIXAccept, NULL) < 0)
|
||||
+ if (virTestRun("Socket UNIX Accept", testSocketAccept, NULL) < 0)
|
||||
ret = -1;
|
||||
|
||||
if (virTestRun("Socket UNIX Addrs", testSocketUNIXAddrs, NULL) < 0)
|
||||
@@ -1,241 +0,0 @@
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 1 May 2018 11:55:02 +0100
|
||||
Subject: [PATCH] tests: rewrite socket to do something sensible and reliable
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The current socket test is rather crazy in that it sets up a server
|
||||
listening for sockets and then runs a client connect call, relying on
|
||||
the fact that the kernel will accept this despite the application
|
||||
not having called accept() yet. It then closes the client socket and
|
||||
calls accept() on the server. On Linux accept() will always see that
|
||||
the client has gone and so skip the rest of the code. On FreeBSD,
|
||||
however, the accept sometimes succeeds, causing us to then go into
|
||||
code that attempts to read and write to the client which will fail
|
||||
aborting the test. The accept() never succeeds on FreeBSD guests
|
||||
with a single CPU, but as you add more CPUs, accept() becomes more and
|
||||
more likely to succeed, giving a 100% failure rate for the test when
|
||||
using 8 CPUs.
|
||||
|
||||
This completely rewrites the test so that it is avoids this designed in
|
||||
race condition. We simply spawn a background thread to act as the
|
||||
client, which will read a byte from the server and write it back again.
|
||||
The main thread can now properly listen and accept the client in a
|
||||
synchronous manner avoiding any races.
|
||||
|
||||
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 39015a6f3a0d4f9ca2041b9227094f0bcc2217e9)
|
||||
---
|
||||
tests/virnetsockettest.c | 141 +++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 120 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
|
||||
index e463d432ff..cccb90d0be 100644
|
||||
--- a/tests/virnetsockettest.c
|
||||
+++ b/tests/virnetsockettest.c
|
||||
@@ -115,6 +115,56 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+struct testClientData {
|
||||
+ const char *path;
|
||||
+ const char *cnode;
|
||||
+ const char *portstr;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+testSocketClient(void *opaque)
|
||||
+{
|
||||
+ struct testClientData *data = opaque;
|
||||
+ char c;
|
||||
+ virNetSocketPtr csock = NULL;
|
||||
+
|
||||
+ if (data->path) {
|
||||
+ if (virNetSocketNewConnectUNIX(data->path, false,
|
||||
+ NULL, &csock) < 0)
|
||||
+ return;
|
||||
+ } else {
|
||||
+ if (virNetSocketNewConnectTCP(data->cnode, data->portstr,
|
||||
+ AF_UNSPEC,
|
||||
+ &csock) < 0)
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ virNetSocketSetBlocking(csock, true);
|
||||
+
|
||||
+ if (virNetSocketRead(csock, &c, 1) != 1) {
|
||||
+ VIR_DEBUG("Cannot read from server");
|
||||
+ goto done;
|
||||
+ }
|
||||
+ if (virNetSocketWrite(csock, &c, 1) != 1) {
|
||||
+ VIR_DEBUG("Cannot write to server");
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ done:
|
||||
+ virObjectUnref(csock);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+testSocketIncoming(virNetSocketPtr sock,
|
||||
+ int events ATTRIBUTE_UNUSED,
|
||||
+ void *opaque)
|
||||
+{
|
||||
+ virNetSocketPtr *retsock = opaque;
|
||||
+ VIR_DEBUG("Incoming sock=%p events=%d\n", sock, events);
|
||||
+ *retsock = sock;
|
||||
+}
|
||||
+
|
||||
|
||||
struct testSocketData {
|
||||
const char *lnode;
|
||||
@@ -122,18 +172,25 @@ struct testSocketData {
|
||||
const char *cnode;
|
||||
};
|
||||
|
||||
-static int testSocketAccept(const void *opaque)
|
||||
+
|
||||
+static int
|
||||
+testSocketAccept(const void *opaque)
|
||||
{
|
||||
virNetSocketPtr *lsock = NULL; /* Listen socket */
|
||||
size_t nlsock = 0, i;
|
||||
virNetSocketPtr ssock = NULL; /* Server socket */
|
||||
- virNetSocketPtr csock = NULL; /* Client socket */
|
||||
+ virNetSocketPtr rsock = NULL; /* Incoming client socket */
|
||||
const struct testSocketData *data = opaque;
|
||||
int ret = -1;
|
||||
char portstr[100];
|
||||
char *tmpdir = NULL;
|
||||
char *path = NULL;
|
||||
char template[] = "/tmp/libvirt_XXXXXX";
|
||||
+ virThread th;
|
||||
+ struct testClientData cdata = { 0 };
|
||||
+ bool goodsock = false;
|
||||
+ char a = 'a';
|
||||
+ char b = '\0';
|
||||
|
||||
if (!data) {
|
||||
virNetSocketPtr usock;
|
||||
@@ -155,50 +212,90 @@ static int testSocketAccept(const void *opaque)
|
||||
|
||||
lsock[0] = usock;
|
||||
nlsock = 1;
|
||||
+
|
||||
+ cdata.path = path;
|
||||
} else {
|
||||
snprintf(portstr, sizeof(portstr), "%d", data->port);
|
||||
if (virNetSocketNewListenTCP(data->lnode, portstr,
|
||||
AF_UNSPEC,
|
||||
&lsock, &nlsock) < 0)
|
||||
goto cleanup;
|
||||
+
|
||||
+ cdata.cnode = data->cnode;
|
||||
+ cdata.portstr = portstr;
|
||||
}
|
||||
|
||||
for (i = 0; i < nlsock; i++) {
|
||||
if (virNetSocketListen(lsock[i], 0) < 0)
|
||||
goto cleanup;
|
||||
- }
|
||||
|
||||
- if (!data) {
|
||||
- if (virNetSocketNewConnectUNIX(path, false, NULL, &csock) < 0)
|
||||
- goto cleanup;
|
||||
- } else {
|
||||
- if (virNetSocketNewConnectTCP(data->cnode, portstr,
|
||||
- AF_UNSPEC,
|
||||
- &csock) < 0)
|
||||
+ if (virNetSocketAddIOCallback(lsock[i],
|
||||
+ VIR_EVENT_HANDLE_READABLE,
|
||||
+ testSocketIncoming,
|
||||
+ &rsock,
|
||||
+ NULL) < 0) {
|
||||
goto cleanup;
|
||||
+ }
|
||||
}
|
||||
|
||||
- virObjectUnref(csock);
|
||||
+ if (virThreadCreate(&th, true,
|
||||
+ testSocketClient,
|
||||
+ &cdata) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ while (rsock == NULL)
|
||||
+ virEventRunDefaultImpl();
|
||||
|
||||
for (i = 0; i < nlsock; i++) {
|
||||
- if (virNetSocketAccept(lsock[i], &ssock) != -1 && ssock) {
|
||||
- char c = 'a';
|
||||
- if (virNetSocketWrite(ssock, &c, 1) != -1 &&
|
||||
- virNetSocketRead(ssock, &c, 1) != -1) {
|
||||
- VIR_DEBUG("Unexpected client socket present");
|
||||
- goto cleanup;
|
||||
- }
|
||||
+ if (lsock[i] == rsock) {
|
||||
+ goodsock = true;
|
||||
+ break;
|
||||
}
|
||||
- virObjectUnref(ssock);
|
||||
- ssock = NULL;
|
||||
}
|
||||
|
||||
+ if (!goodsock) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ "Unexpected server socket seen");
|
||||
+ goto join;
|
||||
+ }
|
||||
+
|
||||
+ if (virNetSocketAccept(rsock, &ssock) < 0)
|
||||
+ goto join;
|
||||
+
|
||||
+ if (!ssock) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ "Client went away unexpectedly");
|
||||
+ goto join;
|
||||
+ }
|
||||
+
|
||||
+ virNetSocketSetBlocking(ssock, true);
|
||||
+
|
||||
+ if (virNetSocketWrite(ssock, &a, 1) < 0 ||
|
||||
+ virNetSocketRead(ssock, &b, 1) < 0) {
|
||||
+ goto join;
|
||||
+ }
|
||||
+
|
||||
+ if (a != b) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ "Bad data received '%x' != '%x'", a, b);
|
||||
+ goto join;
|
||||
+ }
|
||||
+
|
||||
+ virObjectUnref(ssock);
|
||||
+ ssock = NULL;
|
||||
+
|
||||
ret = 0;
|
||||
|
||||
+ join:
|
||||
+ virThreadJoin(&th);
|
||||
+
|
||||
cleanup:
|
||||
virObjectUnref(ssock);
|
||||
- for (i = 0; i < nlsock; i++)
|
||||
+ for (i = 0; i < nlsock; i++) {
|
||||
+ virNetSocketRemoveIOCallback(lsock[i]);
|
||||
+ virNetSocketClose(lsock[i]);
|
||||
virObjectUnref(lsock[i]);
|
||||
+ }
|
||||
VIR_FREE(lsock);
|
||||
VIR_FREE(path);
|
||||
if (tmpdir)
|
||||
@@ -431,6 +528,8 @@ mymain(void)
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
+ virEventRegisterDefaultImpl();
|
||||
+
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
if (checkProtocols(&hasIPv4, &hasIPv6, &freePort) < 0) {
|
||||
fprintf(stderr, "Cannot identify IPv4/6 availability\n");
|
||||
@@ -1,34 +0,0 @@
|
||||
From: John Ferlan <jferlan@redhat.com>
|
||||
Date: Fri, 7 Sep 2018 08:20:15 -0400
|
||||
Subject: [PATCH] test: Remove possible infinite loop in virnetsockettest
|
||||
|
||||
Commit 39015a6f3 modified the test to be more reliable/realistic,
|
||||
but without checking the return status of virEventRunDefaultImpl
|
||||
it's possible that the test could run infinitely.
|
||||
|
||||
Found by Coverity
|
||||
|
||||
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
||||
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit a0ba31c0069e89f178f064e724ddbc8540b64d32)
|
||||
---
|
||||
tests/virnetsockettest.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
|
||||
index cccb90d0be..5927be1f80 100644
|
||||
--- a/tests/virnetsockettest.c
|
||||
+++ b/tests/virnetsockettest.c
|
||||
@@ -243,8 +243,10 @@ testSocketAccept(const void *opaque)
|
||||
&cdata) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- while (rsock == NULL)
|
||||
- virEventRunDefaultImpl();
|
||||
+ while (rsock == NULL) {
|
||||
+ if (virEventRunDefaultImpl() < 0)
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
for (i = 0; i < nlsock; i++) {
|
||||
if (lsock[i] == rsock) {
|
||||
@@ -1,21 +0,0 @@
|
||||
# Makefile for source rpm: libvirt
|
||||
# $Id$
|
||||
NAME := libvirt
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attempt a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
@@ -0,0 +1,31 @@
|
||||
From c9056e682a8a67dc29e39eb01392fcf8ee978c31 Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Wright <jonathan@almalinux.org>
|
||||
Date: Wed, 3 Jan 2024 09:26:59 -0600
|
||||
Subject: [PATCH] conf: Restore setting default bus for input devices
|
||||
|
||||
Prior to v9.3.0-rc1~30 we used to set default bus for <input/>
|
||||
devices, during XML parsing. In the commit this code was moved to
|
||||
a post parse callback. But somehow the line that sets the bus in
|
||||
one specific case disappeared. Bring it back.
|
||||
|
||||
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/577
|
||||
Fixes: c4bc4d3b82fbe22e03c986ca896090f481df5c10
|
||||
Signed-off-by: Jonathan Wright <jonathan@almalinux.org>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
---
|
||||
src/conf/domain_postparse.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c
|
||||
index e79913b73f..ee27023f3e 100644
|
||||
--- a/src/conf/domain_postparse.c
|
||||
+++ b/src/conf/domain_postparse.c
|
||||
@@ -657,6 +657,7 @@ virDomainInputDefPostParse(virDomainInputDef *input,
|
||||
if ((input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
|
||||
input->type == VIR_DOMAIN_INPUT_TYPE_KBD) &&
|
||||
(ARCH_IS_X86(def->os.arch) || def->os.arch == VIR_ARCH_NONE)) {
|
||||
+ input->bus = VIR_DOMAIN_INPUT_BUS_PS2;
|
||||
} else if (ARCH_IS_S390(def->os.arch) ||
|
||||
input->type == VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH) {
|
||||
input->bus = VIR_DOMAIN_INPUT_BUS_VIRTIO;
|
||||
--
|
||||
+1488
-924
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
SHA512 (libvirt-4.7.0.tar.xz) = a4b320460b923508d9519c65c8be18b5013eb7ed4d581984cc5edf0d3476c34f959d69ad4ca7a0e257dac91351e11718785efc3f201d4b58fa999dbca1daac47
|
||||
SHA512 (libvirt-9.7.0.tar.xz) = dd771822c0fa0861a32cab9d7f82235b101867fa0a4e8cf9a857ddfb2347e41b625b1e6f8791c4b3543fec836a1a23cae1fac4ce4b40debd51f2097bae46c949
|
||||
|
||||
Reference in New Issue
Block a user