Compare commits
No commits in common. "c8-stream-rhel" and "c8-beta-stream-rhel" have entirely different histories.
c8-stream-
...
c8-beta-st
@ -1,218 +0,0 @@
|
|||||||
From cb42cd98d347deeee7c225d8d1e9f71f232cad29 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-ID: <cb42cd98d347deeee7c225d8d1e9f71f232cad29.1712647819.git.jdenemar@redhat.com>
|
|
||||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
||||||
Date: Fri, 15 Mar 2024 10:47:50 +0000
|
|
||||||
Subject: [PATCH] remote: check for negative array lengths before allocation
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
While the C API entry points will validate non-negative lengths
|
|
||||||
for various parameters, the RPC server de-serialization code
|
|
||||||
will need to allocate memory for arrays before entering the C
|
|
||||||
API. These allocations will thus happen before the non-negative
|
|
||||||
length check is performed.
|
|
||||||
|
|
||||||
Passing a negative length to the g_new0 function will usually
|
|
||||||
result in a crash due to the negative length being treated as
|
|
||||||
a huge positive number.
|
|
||||||
|
|
||||||
This was found and diagnosed by ALT Linux Team with AFLplusplus.
|
|
||||||
|
|
||||||
CVE-2024-2494
|
|
||||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
||||||
Found-by: Alexandr Shashkin <dutyrok@altlinux.org>
|
|
||||||
Co-developed-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
|
|
||||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
||||||
(cherry picked from commit 8a3f8d957507c1f8223fdcf25a3ff885b15557f2)
|
|
||||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
||||||
---
|
|
||||||
src/remote/remote_daemon_dispatch.c | 65 +++++++++++++++++++++++++++++
|
|
||||||
src/rpc/gendispatch.pl | 5 +++
|
|
||||||
2 files changed, 70 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
|
|
||||||
index 689001889e..c193227926 100644
|
|
||||||
--- a/src/remote/remote_daemon_dispatch.c
|
|
||||||
+++ b/src/remote/remote_daemon_dispatch.c
|
|
||||||
@@ -2306,6 +2306,10 @@ remoteDispatchDomainGetSchedulerParameters(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
if (!conn)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -2354,6 +2358,10 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServer *server G_GNUC_UNUS
|
|
||||||
if (!conn)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -2512,6 +2520,10 @@ remoteDispatchDomainBlockStatsFlags(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
goto cleanup;
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -2737,6 +2749,14 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (args->ncpumaps < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
+ if (args->maplen < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maplen must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->ncpumaps > REMOTE_VCPUINFO_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps > REMOTE_VCPUINFO_MAX"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -2831,6 +2851,11 @@ remoteDispatchDomainGetEmulatorPinInfo(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (args->maplen < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maplen must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* Allocate buffers to take the results */
|
|
||||||
if (args->maplen > 0)
|
|
||||||
cpumaps = g_new0(unsigned char, args->maplen);
|
|
||||||
@@ -2878,6 +2903,14 @@ remoteDispatchDomainGetVcpus(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (args->maxinfo < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
+ if (args->maplen < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -3117,6 +3150,10 @@ remoteDispatchDomainGetMemoryParameters(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -3177,6 +3214,10 @@ remoteDispatchDomainGetNumaParameters(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_NUMA_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -3237,6 +3278,10 @@ remoteDispatchDomainGetBlkioParameters(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -3298,6 +3343,10 @@ remoteDispatchNodeGetCPUStats(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_NODE_CPU_STATS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -3365,6 +3414,10 @@ remoteDispatchNodeGetMemoryStats(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_NODE_MEMORY_STATS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -3545,6 +3598,10 @@ remoteDispatchDomainGetBlockIoTune(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
if (!conn)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -5087,6 +5144,10 @@ remoteDispatchDomainGetInterfaceParameters(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
@@ -5307,6 +5368,10 @@ remoteDispatchNodeGetMemoryParameters(virNetServer *server G_GNUC_UNUSED,
|
|
||||||
|
|
||||||
flags = args->flags;
|
|
||||||
|
|
||||||
+ if (args->nparams < 0) {
|
|
||||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams must be non-negative"));
|
|
||||||
+ goto cleanup;
|
|
||||||
+ }
|
|
||||||
if (args->nparams > REMOTE_NODE_MEMORY_PARAMETERS_MAX) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
|
|
||||||
goto cleanup;
|
|
||||||
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
|
|
||||||
index 9f5bf0e316..aacab88808 100755
|
|
||||||
--- a/src/rpc/gendispatch.pl
|
|
||||||
+++ b/src/rpc/gendispatch.pl
|
|
||||||
@@ -1074,6 +1074,11 @@ elsif ($mode eq "server") {
|
|
||||||
print "\n";
|
|
||||||
|
|
||||||
if ($single_ret_as_list) {
|
|
||||||
+ print " if (args->$single_ret_list_max_var < 0) {\n";
|
|
||||||
+ print " virReportError(VIR_ERR_RPC,\n";
|
|
||||||
+ print " \"%s\", _(\"max$single_ret_list_name must be non-negative\"));\n";
|
|
||||||
+ print " goto cleanup;\n";
|
|
||||||
+ print " }\n";
|
|
||||||
print " if (args->$single_ret_list_max_var > $single_ret_list_max_define) {\n";
|
|
||||||
print " virReportError(VIR_ERR_RPC,\n";
|
|
||||||
print " \"%s\", _(\"max$single_ret_list_name > $single_ret_list_max_define\"));\n";
|
|
||||||
--
|
|
||||||
2.44.0
|
|
@ -1,101 +0,0 @@
|
|||||||
From b84d0a699f3976644d3090562ce62ede55335fbc Mon Sep 17 00:00:00 2001
|
|
||||||
Message-ID: <b84d0a699f3976644d3090562ce62ede55335fbc.1717684031.git.jdenemar@redhat.com>
|
|
||||||
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>
|
|
||||||
(cherry picked from commit 8074d64dc2eca846d6a61efe1a9b7428a0ce1dd1)
|
|
||||||
Signed-off-by: Jiri Denemark <jdenemar@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 f526ad89ec..b9490072c3 100644
|
|
||||||
--- a/src/rpc/virnetclient.c
|
|
||||||
+++ b/src/rpc/virnetclient.c
|
|
||||||
@@ -1664,7 +1664,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,
|
|
||||||
@@ -1728,6 +1728,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
|
|
@ -1,39 +0,0 @@
|
|||||||
From ffbae27bd15ae9475fd4f0e79b492a7e03bca93e Mon Sep 17 00:00:00 2001
|
|
||||||
Message-ID: <ffbae27bd15ae9475fd4f0e79b492a7e03bca93e.1717684031.git.jdenemar@redhat.com>
|
|
||||||
From: Jonathon Jongsma <jjongsma@redhat.com>
|
|
||||||
Date: Fri, 22 Sep 2023 14:23:10 -0500
|
|
||||||
Subject: [PATCH] util: Fix error return for virProcessKillPainfullyDelay()
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Commit 93af79fb removed a cleanup label in favor of returning error
|
|
||||||
values directly in certain cases. But the final return value was changed
|
|
||||||
from -1 to 0. If we get to the end of the function, that means that
|
|
||||||
we've waited for the process to exit but it still exists. So we should
|
|
||||||
return -1. The error message was still being set correctly, but we were
|
|
||||||
returning a success status (0).
|
|
||||||
|
|
||||||
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
||||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
||||||
(cherry picked from commit 51a074e74c6ef2fb95e6f53d41315e3f1e00be77)
|
|
||||||
https://issues.redhat.com/browse/RHEL-36064
|
|
||||||
---
|
|
||||||
src/util/virprocess.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
|
|
||||||
index b559a4257e..f3933a2d16 100644
|
|
||||||
--- a/src/util/virprocess.c
|
|
||||||
+++ b/src/util/virprocess.c
|
|
||||||
@@ -471,7 +471,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay, boo
|
|
||||||
_("Failed to terminate process %lld with SIG%s"),
|
|
||||||
(long long)pid, signame);
|
|
||||||
|
|
||||||
- return 0;
|
|
||||||
+ return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
2.45.1
|
|
@ -1,68 +0,0 @@
|
|||||||
From f3ae3ac1807549c1eb4cc5a0286047ff019e14a0 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-ID: <f3ae3ac1807549c1eb4cc5a0286047ff019e14a0.1702401900.git.jdenemar@redhat.com>
|
|
||||||
From: Michal Privoznik <mprivozn@redhat.com>
|
|
||||||
Date: Fri, 24 Nov 2023 11:59:32 +0100
|
|
||||||
Subject: [PATCH] virnuma: Avoid integer overflow in virNumaGetPages()
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
On systems with humongous pages (16GiB) and 32bit int it's easy
|
|
||||||
to hit integer overflow in virNumaGetPages(). What happens is,
|
|
||||||
inside of virNumaGetPages() as we process hugepages for given
|
|
||||||
NUMA node (e.g. in order to produce capabilities XML), we keep a
|
|
||||||
sum of sizes of pools in an ULL variable (huge_page_sum). In each
|
|
||||||
iteration, the variable is incremented by 1024 * page_size *
|
|
||||||
page_avail. Now, page_size is just an uint, so we have:
|
|
||||||
|
|
||||||
ULL += U * U * ULL;
|
|
||||||
|
|
||||||
and because of associativity, U * U is computed first and since
|
|
||||||
we have two operands of the same type, no type expansion happens.
|
|
||||||
But this means, for humongous pages (like 16GiB) the
|
|
||||||
multiplication overflows.
|
|
||||||
|
|
||||||
Therefore, move the multiplication out of the loop. This helps in
|
|
||||||
two ways:
|
|
||||||
|
|
||||||
1) now we have ULL += U * ULL; which expands the uint in
|
|
||||||
multiplication,
|
|
||||||
|
|
||||||
2) it saves couple of CPU cycles.
|
|
||||||
|
|
||||||
Resolves: https://issues.redhat.com/browse/RHEL-16749
|
|
||||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
||||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
||||||
(cherry picked from commit 9694d1ca6a4ef7a37ac20249eb8b85c1bb48ef6b)
|
|
||||||
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
||||||
---
|
|
||||||
src/util/virnuma.c | 7 ++++---
|
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
|
|
||||||
index 7c892d6267..e0938867f9 100644
|
|
||||||
--- a/src/util/virnuma.c
|
|
||||||
+++ b/src/util/virnuma.c
|
|
||||||
@@ -806,9 +806,7 @@ virNumaGetPages(int node,
|
|
||||||
tmp_free[ntmp] = page_free;
|
|
||||||
ntmp++;
|
|
||||||
|
|
||||||
- /* page_size is in kibibytes while we want huge_page_sum
|
|
||||||
- * in just bytes. */
|
|
||||||
- huge_page_sum += 1024 * page_size * page_avail;
|
|
||||||
+ huge_page_sum += page_size * page_avail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (direrr < 0)
|
|
||||||
@@ -819,6 +817,9 @@ virNumaGetPages(int node,
|
|
||||||
VIR_REALLOC_N(tmp_avail, ntmp + 1);
|
|
||||||
VIR_REALLOC_N(tmp_free, ntmp + 1);
|
|
||||||
|
|
||||||
+ /* page_size is in kibibytes while we want huge_page_sum in just bytes. */
|
|
||||||
+ huge_page_sum *= 1024;
|
|
||||||
+
|
|
||||||
if (virNumaGetPageInfo(node, system_page_size, huge_page_sum,
|
|
||||||
&tmp_avail[ntmp], &tmp_free[ntmp]) < 0)
|
|
||||||
return -1;
|
|
||||||
--
|
|
||||||
2.43.0
|
|
@ -210,7 +210,7 @@
|
|||||||
Summary: Library providing a simple virtualization API
|
Summary: Library providing a simple virtualization API
|
||||||
Name: libvirt
|
Name: libvirt
|
||||||
Version: 8.0.0
|
Version: 8.0.0
|
||||||
Release: 23.2%{?dist}%{?extra_release}
|
Release: 22%{?dist}%{?extra_release}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://libvirt.org/
|
URL: https://libvirt.org/
|
||||||
|
|
||||||
@ -317,10 +317,6 @@ Patch94: libvirt-virpci-Resolve-leak-in-virPCIVirtualFunctionList-cleanup.patch
|
|||||||
Patch95: libvirt-node_device_conf-Avoid-memleak-in-virNodeDeviceGetPCIVPDDynamicCap.patch
|
Patch95: libvirt-node_device_conf-Avoid-memleak-in-virNodeDeviceGetPCIVPDDynamicCap.patch
|
||||||
Patch96: libvirt-nodedev-update-transient-mdevs.patch
|
Patch96: libvirt-nodedev-update-transient-mdevs.patch
|
||||||
Patch97: libvirt-lib-Set-up-cpuset-controller-for-restrictive-numatune.patch
|
Patch97: libvirt-lib-Set-up-cpuset-controller-for-restrictive-numatune.patch
|
||||||
Patch98: libvirt-virnuma-Avoid-integer-overflow-in-virNumaGetPages.patch
|
|
||||||
Patch99: libvirt-remote-check-for-negative-array-lengths-before-allocation.patch
|
|
||||||
Patch100: libvirt-util-Fix-error-return-for-virProcessKillPainfullyDelay.patch
|
|
||||||
Patch101: libvirt-rpc-ensure-temporary-GSource-is-removed-from-client-event-loop.patch
|
|
||||||
|
|
||||||
Requires: libvirt-daemon = %{version}-%{release}
|
Requires: libvirt-daemon = %{version}-%{release}
|
||||||
Requires: libvirt-daemon-config-network = %{version}-%{release}
|
Requires: libvirt-daemon-config-network = %{version}-%{release}
|
||||||
@ -2200,16 +2196,6 @@ exit 0
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Jun 6 2024 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-23.2.el8
|
|
||||||
- util: Fix error return for virProcessKillPainfullyDelay() (RHEL-36064)
|
|
||||||
- rpc: ensure temporary GSource is removed from client event loop (CVE-2024-4418)
|
|
||||||
|
|
||||||
* Tue Apr 9 2024 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-23.1.el8
|
|
||||||
- remote: check for negative array lengths before allocation (CVE-2024-2494)
|
|
||||||
|
|
||||||
* Tue Dec 12 2023 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-23
|
|
||||||
- virnuma: Avoid integer overflow in virNumaGetPages() (rhbz#RHEL-16749)
|
|
||||||
|
|
||||||
* Mon Jul 31 2023 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-22
|
* Mon Jul 31 2023 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-22
|
||||||
- lib: Set up cpuset controller for restrictive numatune (rhbz#2223464)
|
- lib: Set up cpuset controller for restrictive numatune (rhbz#2223464)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user