Compare commits
85 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 |
@@ -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
|
||||
|
||||
@@ -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: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Wed, 5 Aug 2020 10:01:45 +0200
|
||||
Subject: [PATCH] util: Fix logic in virFileSetCOW
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When COW is not explicitly requested to be disabled or enabled, the
|
||||
function is supposed to do nothing on non-BTRFS file systems.
|
||||
|
||||
Fixes commit 7230bc95aa78379c9ee20cf59394c5fc4305b75b.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1866157
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 2edd63a0dbd445112db23596ee0128521e8f1ff5)
|
||||
---
|
||||
src/util/virfile.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/util/virfile.c b/src/util/virfile.c
|
||||
index af150421e7..a06e7dfcce 100644
|
||||
--- a/src/util/virfile.c
|
||||
+++ b/src/util/virfile.c
|
||||
@@ -4550,7 +4550,7 @@ virFileSetCOW(const char *path,
|
||||
}
|
||||
|
||||
if (buf.f_type != BTRFS_SUPER_MAGIC) {
|
||||
- if (state == VIR_TRISTATE_BOOL_ABSENT) {
|
||||
+ if (state != VIR_TRISTATE_BOOL_ABSENT) {
|
||||
virReportSystemError(ENOSYS,
|
||||
_("unable to control COW flag on '%s', not btrfs"),
|
||||
path);
|
||||
@@ -1,88 +0,0 @@
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 18 Aug 2020 11:08:15 +0200
|
||||
Subject: [PATCH] virdevmapper: Don't cache device-mapper major
|
||||
|
||||
The device mapper major is needed in virIsDevMapperDevice() which
|
||||
determines whether given device is managed by device-mapper. This
|
||||
number is obtained by parsing /proc/devices and then stored in a
|
||||
global variable so that the file doesn't have to be parsed again.
|
||||
However, as it turns out this logic is flawed - the major number
|
||||
is not static and can change as it can be specified as a
|
||||
parameter when loading the dm-mod module.
|
||||
|
||||
Unfortunately, I was not able to come up with a good solution and
|
||||
thus the /proc/devices file is being parsed every time we need
|
||||
the device mapper major.
|
||||
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
(cherry picked from commit 82bb167f0d15b733b23931205be3488b83cb9ec6)
|
||||
---
|
||||
src/util/virdevmapper.c | 17 +++++------------
|
||||
1 file changed, 5 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
|
||||
index a471504176..b43dbefa9a 100644
|
||||
--- a/src/util/virdevmapper.c
|
||||
+++ b/src/util/virdevmapper.c
|
||||
@@ -46,11 +46,9 @@
|
||||
|
||||
G_STATIC_ASSERT(BUF_SIZE > sizeof(struct dm_ioctl));
|
||||
|
||||
-static unsigned int virDMMajor;
|
||||
-
|
||||
|
||||
static int
|
||||
-virDevMapperOnceInit(void)
|
||||
+virDevMapperGetMajor(unsigned int *major)
|
||||
{
|
||||
g_autofree char *buf = NULL;
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
@@ -69,7 +67,7 @@ virDevMapperOnceInit(void)
|
||||
|
||||
if (sscanf(lines[i], "%u %ms\n", &maj, &dev) == 2 &&
|
||||
STREQ(dev, DM_NAME)) {
|
||||
- virDMMajor = maj;
|
||||
+ *major = maj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -85,9 +83,6 @@ virDevMapperOnceInit(void)
|
||||
}
|
||||
|
||||
|
||||
-VIR_ONCE_GLOBAL_INIT(virDevMapper);
|
||||
-
|
||||
-
|
||||
static void *
|
||||
virDMIoctl(int controlFD, int cmd, struct dm_ioctl *dm, char **buf)
|
||||
{
|
||||
@@ -305,9 +300,6 @@ virDevMapperGetTargets(const char *path,
|
||||
* consist of devices or yet another targets. If that's the
|
||||
* case, we have to stop recursion somewhere. */
|
||||
|
||||
- if (virDevMapperInitialize() < 0)
|
||||
- return -1;
|
||||
-
|
||||
if ((controlFD = virDMOpen()) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -319,13 +311,14 @@ bool
|
||||
virIsDevMapperDevice(const char *dev_name)
|
||||
{
|
||||
struct stat buf;
|
||||
+ unsigned int major;
|
||||
|
||||
- if (virDevMapperInitialize() < 0)
|
||||
+ if (virDevMapperGetMajor(&major) < 0)
|
||||
return false;
|
||||
|
||||
if (!stat(dev_name, &buf) &&
|
||||
S_ISBLK(buf.st_mode) &&
|
||||
- major(buf.st_rdev) == virDMMajor)
|
||||
+ major(buf.st_rdev) == major)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1,76 +0,0 @@
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 18 Aug 2020 11:04:24 +0200
|
||||
Subject: [PATCH] virdevmapper: Handle kernel without device-mapper support
|
||||
|
||||
In one of my latest patch (v6.6.0~30) I was trying to remove
|
||||
libdevmapper use in favor of our own implementation. However, the
|
||||
code did not take into account that device mapper can be not
|
||||
compiled into the kernel (e.g. be a separate module that's not
|
||||
loaded) in which case /proc/devices won't have the device-mapper
|
||||
major number and thus virDevMapperGetTargets() and/or
|
||||
virIsDevMapperDevice() fails.
|
||||
|
||||
However, such failure is safe to ignore, because if device mapper
|
||||
is missing then there can't be any multipath devices and thus we
|
||||
don't need to allow the deps in CGroups, nor create them in the
|
||||
domain private namespace, etc.
|
||||
|
||||
Fixes: 22494556542c676d1b9e7f1c1f2ea13ac17e1e3e
|
||||
Reported-by: Andrea Bolognani <abologna@redhat.com>
|
||||
Reported-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
(cherry picked from commit feb8564a3cc63bc8f68284063d53ec0d2d81a1cc)
|
||||
---
|
||||
src/util/virdevmapper.c | 20 ++++++++++++++++++--
|
||||
1 file changed, 18 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
|
||||
index b43dbefa9a..a81e2edee4 100644
|
||||
--- a/src/util/virdevmapper.c
|
||||
+++ b/src/util/virdevmapper.c
|
||||
@@ -54,6 +54,9 @@ virDevMapperGetMajor(unsigned int *major)
|
||||
VIR_AUTOSTRINGLIST lines = NULL;
|
||||
size_t i;
|
||||
|
||||
+ if (!virFileExists(CONTROL_PATH))
|
||||
+ return -2;
|
||||
+
|
||||
if (virFileReadAll(PROC_DEVICES, BUF_SIZE, &buf) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -126,8 +129,13 @@ virDMOpen(void)
|
||||
|
||||
memset(&dm, 0, sizeof(dm));
|
||||
|
||||
- if ((controlFD = open(CONTROL_PATH, O_RDWR)) < 0)
|
||||
+ if ((controlFD = open(CONTROL_PATH, O_RDWR)) < 0) {
|
||||
+ if (errno == ENOENT)
|
||||
+ return -2;
|
||||
+
|
||||
+ virReportSystemError(errno, _("Unable to open %s"), CONTROL_PATH);
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
if (!virDMIoctl(controlFD, DM_VERSION, &dm, &tmp)) {
|
||||
virReportSystemError(errno, "%s",
|
||||
@@ -300,8 +308,16 @@ virDevMapperGetTargets(const char *path,
|
||||
* consist of devices or yet another targets. If that's the
|
||||
* case, we have to stop recursion somewhere. */
|
||||
|
||||
- if ((controlFD = virDMOpen()) < 0)
|
||||
+ if ((controlFD = virDMOpen()) < 0) {
|
||||
+ if (controlFD == -2) {
|
||||
+ /* The CONTROL_PATH doesn't exist. Probably the
|
||||
+ * module isn't loaded, yet. Don't error out, just
|
||||
+ * exit. */
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
return virDevMapperGetTargetsImpl(controlFD, path, devPaths, ttl);
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Wed, 19 Aug 2020 13:35:55 +0200
|
||||
Subject: [PATCH] virdevmapper: Ignore all errors when opening
|
||||
/dev/mapper/control
|
||||
|
||||
So far, only ENOENT is ignored (to deal with kernels without
|
||||
devmapper). However, as reported on the list, under certain
|
||||
scenarios a different error can occur. For instance, when libvirt
|
||||
is running inside a container which doesn't have permissions to
|
||||
talk to the devmapper. If this is the case, then open() returns
|
||||
-1 and sets errno=EPERM.
|
||||
|
||||
Assuming that multipath devices are fairly narrow use case and
|
||||
using them in a restricted container is even more narrow the best
|
||||
fix seems to be to ignore all open errors BUT produce a warning
|
||||
on failure. To avoid flooding logs with warnings on kernels
|
||||
without devmapper the level is reduced to a plain debug message.
|
||||
|
||||
Reported-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 53d9af1e7924757e3b5f661131dd707d7110d094)
|
||||
---
|
||||
src/util/virdevmapper.c | 23 +++++++++++++++--------
|
||||
1 file changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
|
||||
index a81e2edee4..ee2fab5ae3 100644
|
||||
--- a/src/util/virdevmapper.c
|
||||
+++ b/src/util/virdevmapper.c
|
||||
@@ -35,9 +35,12 @@
|
||||
# include "viralloc.h"
|
||||
# include "virstring.h"
|
||||
# include "virfile.h"
|
||||
+# include "virlog.h"
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_STORAGE
|
||||
|
||||
+VIR_LOG_INIT("util.virdevmapper");
|
||||
+
|
||||
# define PROC_DEVICES "/proc/devices"
|
||||
# define DM_NAME "device-mapper"
|
||||
# define DEV_DM_DIR "/dev/" DM_DIR
|
||||
@@ -130,11 +133,15 @@ virDMOpen(void)
|
||||
memset(&dm, 0, sizeof(dm));
|
||||
|
||||
if ((controlFD = open(CONTROL_PATH, O_RDWR)) < 0) {
|
||||
- if (errno == ENOENT)
|
||||
- return -2;
|
||||
-
|
||||
- virReportSystemError(errno, _("Unable to open %s"), CONTROL_PATH);
|
||||
- return -1;
|
||||
+ /* We can't talk to devmapper. Produce a warning and let
|
||||
+ * the caller decide what to do next. */
|
||||
+ if (errno == ENOENT) {
|
||||
+ VIR_DEBUG("device mapper not available");
|
||||
+ } else {
|
||||
+ VIR_WARN("unable to open %s: %s",
|
||||
+ CONTROL_PATH, g_strerror(errno));
|
||||
+ }
|
||||
+ return -2;
|
||||
}
|
||||
|
||||
if (!virDMIoctl(controlFD, DM_VERSION, &dm, &tmp)) {
|
||||
@@ -310,9 +317,9 @@ virDevMapperGetTargets(const char *path,
|
||||
|
||||
if ((controlFD = virDMOpen()) < 0) {
|
||||
if (controlFD == -2) {
|
||||
- /* The CONTROL_PATH doesn't exist. Probably the
|
||||
- * module isn't loaded, yet. Don't error out, just
|
||||
- * exit. */
|
||||
+ /* The CONTROL_PATH doesn't exist or is unusable.
|
||||
+ * Probably the module isn't loaded, yet. Don't error
|
||||
+ * out, just exit. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Wed, 4 Nov 2020 12:08:19 +0100
|
||||
Subject: [PATCH] util: use g_autofree in virSCSIHostGetUniqueId
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
(cherry picked from commit 843b70995471c1a20822ee62ff084310066b4b4a)
|
||||
---
|
||||
src/util/virscsihost.c | 16 +++++-----------
|
||||
1 file changed, 5 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c
|
||||
index 7d8e5299b8..4e6d8f7ad6 100644
|
||||
--- a/src/util/virscsihost.c
|
||||
+++ b/src/util/virscsihost.c
|
||||
@@ -46,17 +46,16 @@ int
|
||||
virSCSIHostGetUniqueId(const char *sysfs_prefix,
|
||||
int host)
|
||||
{
|
||||
- char *sysfs_path = NULL;
|
||||
+ g_autofree char *sysfs_path = NULL;
|
||||
char *p = NULL;
|
||||
- int ret = -1;
|
||||
- char *buf = NULL;
|
||||
+ g_autofree char *buf = NULL;
|
||||
int unique_id;
|
||||
|
||||
sysfs_path = g_strdup_printf("%s/host%d/unique_id",
|
||||
sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_HOST_PATH, host);
|
||||
|
||||
if (virFileReadAll(sysfs_path, 1024, &buf) < 0)
|
||||
- goto cleanup;
|
||||
+ return -1;
|
||||
|
||||
if ((p = strchr(buf, '\n')))
|
||||
*p = '\0';
|
||||
@@ -65,15 +64,10 @@ virSCSIHostGetUniqueId(const char *sysfs_prefix,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unable to parse unique_id: %s"), buf);
|
||||
|
||||
- goto cleanup;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
- ret = unique_id;
|
||||
-
|
||||
- cleanup:
|
||||
- VIR_FREE(sysfs_path);
|
||||
- VIR_FREE(buf);
|
||||
- return ret;
|
||||
+ return unique_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Wed, 4 Nov 2020 12:29:07 +0100
|
||||
Subject: [PATCH] util: quieten virSCSIHostGetUniqueId
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The only caller of this function ignores failure
|
||||
and just sets the unique_id to -1.
|
||||
|
||||
Failing to read the file is likely to the device no longer
|
||||
being present, not a real error.
|
||||
|
||||
Stop reporting errors in this function.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1692100
|
||||
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
||||
(cherry picked from commit 4a56278e770c972dbee7be5842b557de152a586e)
|
||||
---
|
||||
src/util/virscsihost.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/util/virscsihost.c b/src/util/virscsihost.c
|
||||
index 4e6d8f7ad6..b1d51b40d3 100644
|
||||
--- a/src/util/virscsihost.c
|
||||
+++ b/src/util/virscsihost.c
|
||||
@@ -41,6 +41,8 @@ VIR_LOG_INIT("util.scsi_host");
|
||||
* Read the value of the "scsi_host" unique_id file.
|
||||
*
|
||||
* Returns the value on success or -1 on failure.
|
||||
+ *
|
||||
+ * No errors are reported.
|
||||
*/
|
||||
int
|
||||
virSCSIHostGetUniqueId(const char *sysfs_prefix,
|
||||
@@ -54,16 +56,14 @@ virSCSIHostGetUniqueId(const char *sysfs_prefix,
|
||||
sysfs_path = g_strdup_printf("%s/host%d/unique_id",
|
||||
sysfs_prefix ? sysfs_prefix : SYSFS_SCSI_HOST_PATH, host);
|
||||
|
||||
- if (virFileReadAll(sysfs_path, 1024, &buf) < 0)
|
||||
+ if (virFileReadAllQuiet(sysfs_path, 1024, &buf) < 0)
|
||||
return -1;
|
||||
|
||||
if ((p = strchr(buf, '\n')))
|
||||
*p = '\0';
|
||||
|
||||
if (virStrToLong_i(buf, NULL, 10, &unique_id) < 0) {
|
||||
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("unable to parse unique_id: %s"), buf);
|
||||
-
|
||||
+ VIR_DEBUG("unable to parse unique_id: '%s'", buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 17 Nov 2020 12:56:39 +0100
|
||||
Subject: [PATCH] node_device: Use "udev" monitor source
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
In v6.3.0-rc1~67 I've made a switch: instead of listening on udev
|
||||
events the nodedev driver started listening for kernel events.
|
||||
This was because when a device changes its name (e.g. NICs) we
|
||||
will get "move" event with DEVPATH_OLD property set, which we can
|
||||
then use to remove the old device and thus keep our internal list
|
||||
up to date. The switch to "kernel" source was made because if the
|
||||
old NICs naming (eth0, eth1, ...) is enabled (e.g. via
|
||||
net.ifnames=0 on the kernel cmd line) then udev overwrites the
|
||||
property with the new name making our internal list go out of
|
||||
sync. Interestingly, when the od NICs naming is not enabled then
|
||||
the DEVPATH_OLD contains the correct value.
|
||||
|
||||
But as it turns out, "kernel" source might be missing some other
|
||||
important properties, e.g. USB vendor/product IDs. Therefore,
|
||||
switch back to "udev" source and wish the best of luck to users
|
||||
using the old NICs naming.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1897625
|
||||
Fixes: 9a13704818e4a018723e0ec5b9e97b176f1c8584
|
||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
(cherry picked from commit 7e67a136dab9034dd3cb2ed76fa90c524c800cde)
|
||||
---
|
||||
src/node_device/node_device_udev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
||||
index ff558efb83..b7fbd42fa1 100644
|
||||
--- a/src/node_device/node_device_udev.c
|
||||
+++ b/src/node_device/node_device_udev.c
|
||||
@@ -1878,7 +1878,7 @@ nodeStateInitialize(bool privileged,
|
||||
|
||||
virObjectLock(priv);
|
||||
|
||||
- priv->udev_monitor = udev_monitor_new_from_netlink(udev, "kernel");
|
||||
+ priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
|
||||
if (!priv->udev_monitor) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("udev_monitor_new_from_netlink returned NULL"));
|
||||
@@ -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;
|
||||
--
|
||||
+1350
-826
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
SHA512 (libvirt-6.6.0.tar.xz) = 55091addcf43d3c0bdd50f9378b588351181d191272d5a19220a0babe0893c1f6e0f1e41a7f51b8c1fb8e2098236b273e1a18b81573f4008ee3cf65374ba9465
|
||||
SHA512 (libvirt-9.7.0.tar.xz) = dd771822c0fa0861a32cab9d7f82235b101867fa0a4e8cf9a857ddfb2347e41b625b1e6f8791c4b3543fec836a1a23cae1fac4ce4b40debd51f2097bae46c949
|
||||
|
||||
Reference in New Issue
Block a user