|
| 1 | +From e35fd05e2512a1c650b1940910bb394bfe8bd27d Mon Sep 17 00:00:00 2001 |
| 2 | +From: Aninda <v-anipradhan@microsoft.com> |
| 3 | +Date: Thu, 15 May 2025 08:56:07 -0400 |
| 4 | +Subject: [PATCH] Address CVE-2024-4418 |
| 5 | +Upstream Patch Reference: https://gitlab.com/libvirt/libvirt/-/commit/8074d64dc2eca846d6a61efe1a9b7428a0ce1dd1 |
| 6 | +--- |
| 7 | + src/rpc/virnetclient.c | 14 +++++++++++++- |
| 8 | + 1 file changed, 13 insertions(+), 1 deletion(-) |
| 9 | + |
| 10 | +diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c |
| 11 | +index 68098b1..147b0d6 100644 |
| 12 | +--- a/src/rpc/virnetclient.c |
| 13 | ++++ b/src/rpc/virnetclient.c |
| 14 | +@@ -1657,7 +1657,7 @@ static int virNetClientIOEventLoop(virNetClient *client, |
| 15 | + #endif /* !WIN32 */ |
| 16 | + int timeout = -1; |
| 17 | + virNetMessage *msg = NULL; |
| 18 | +- g_autoptr(GSource) G_GNUC_UNUSED source = NULL; |
| 19 | ++ g_autoptr(GSource) source = NULL; |
| 20 | + GIOCondition ev = 0; |
| 21 | + struct virNetClientIOEventData data = { |
| 22 | + .client = client, |
| 23 | +@@ -1721,6 +1721,18 @@ static int virNetClientIOEventLoop(virNetClient *client, |
| 24 | + |
| 25 | + g_main_loop_run(client->eventLoop); |
| 26 | + |
| 27 | ++ /* |
| 28 | ++ * If virNetClientIOEventFD ran, this GSource will already be |
| 29 | ++ * destroyed due to G_SOURCE_REMOVE. It is harmless to re-destroy |
| 30 | ++ * it, since we still own a reference. |
| 31 | ++ * |
| 32 | ++ * If virNetClientIOWakeup ran, it will have interrupted the |
| 33 | ++ * g_main_loop_run call, before virNetClientIOEventFD could |
| 34 | ++ * run, and thus the GSource is still registered, and we need |
| 35 | ++ * to destroy it since it is referencing stack memory for 'data' |
| 36 | ++ */ |
| 37 | ++ g_source_destroy(source); |
| 38 | ++ |
| 39 | + #ifndef WIN32 |
| 40 | + ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL)); |
| 41 | + #endif /* !WIN32 */ |
| 42 | +-- |
| 43 | +2.34.1 |
| 44 | + |
0 commit comments