[libvirt] [PATCH 1/2] build: update gnulib

Done as a separate commit to make backporting the next patch easier. * .gnulib: Update, for syntax-check fix. --- If anyone needs to backport the next patch, it will be easier to add an appropriate INT_MULTIPLY_OVERFLOW macro in "internal.h" than to do a gnulib update, so I've separated these two tasks. .gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/.gnulib b/.gnulib index 478c2dc..25e4c2e 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 478c2dcc839e5f4765e6417684ce414e2d4973a8 +Subproject commit 25e4c2ec96602d132ad4429d6eaebaea1a8f504b -- 1.7.4.4

Integer overflow and remote code are never a nice mix. This has existed since commit 56cd414. * src/libvirt.c (virDomainGetVcpus): Reject overflow up front. * src/remote/remote_driver.c (remoteDomainGetVcpus): Avoid overflow on sending rpc. * daemon/remote.c (remoteDispatchDomainGetVcpus): Avoid overflow on receiving rpc. --- Gnulib makes checking for multiply overflow easy. daemon/remote.c | 4 +++- src/libvirt.c | 5 +++-- src/remote/remote_driver.c | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 48624d6..8d04fc7 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -61,6 +61,7 @@ #include "network.h" #include "libvirt/libvirt-qemu.h" #include "command.h" +#include "intprops.h" #define VIR_FROM_THIS VIR_FROM_REMOTE @@ -1074,7 +1075,8 @@ remoteDispatchDomainGetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED, goto cleanup; } - if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) { + if (INT_MULTIPLY_OVERFLOW(args->maxinfo, args->maplen) || + args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) { virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); goto cleanup; } diff --git a/src/libvirt.c b/src/libvirt.c index 76e16ad..9fe9a69 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -39,6 +39,7 @@ #include "util.h" #include "memory.h" #include "configmake.h" +#include "intprops.h" #ifndef WITH_DRIVER_MODULES # ifdef WITH_TEST @@ -7153,8 +7154,8 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, /* Ensure that domainGetVcpus (aka remoteDomainGetVcpus) does not try to memcpy anything into a NULL pointer. */ - if ((cpumaps == NULL && maplen != 0) - || (cpumaps && maplen <= 0)) { + if (!cpumaps ? maplen != 0 + : (maplen <= 0 || INT_MULTIPLY_OVERFLOW(maxinfo, maplen))) { virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index a7ac90a..f2edf43 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -83,6 +83,7 @@ #include "ignore-value.h" #include "files.h" #include "command.h" +#include "intprops.h" #define VIR_FROM_THIS VIR_FROM_REMOTE @@ -2161,7 +2162,8 @@ remoteDomainGetVcpus (virDomainPtr domain, maxinfo, REMOTE_VCPUINFO_MAX); goto done; } - if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) { + if (INT_MULTIPLY_OVERFLOW(maxinfo, maplen) || + maxinfo * maplen > REMOTE_CPUMAPS_MAX) { remoteError(VIR_ERR_RPC, _("vCPU map buffer length exceeds maximum: %d > %d"), maxinfo * maplen, REMOTE_CPUMAPS_MAX); -- 1.7.4.4

2011/6/24 Eric Blake <eblake@redhat.com>:
Integer overflow and remote code are never a nice mix.
This has existed since commit 56cd414.
* src/libvirt.c (virDomainGetVcpus): Reject overflow up front. * src/remote/remote_driver.c (remoteDomainGetVcpus): Avoid overflow on sending rpc. * daemon/remote.c (remoteDispatchDomainGetVcpus): Avoid overflow on receiving rpc. ---
Gnulib makes checking for multiply overflow easy.
daemon/remote.c | 4 +++- src/libvirt.c | 5 +++-- src/remote/remote_driver.c | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c index 48624d6..8d04fc7 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -61,6 +61,7 @@ #include "network.h" #include "libvirt/libvirt-qemu.h" #include "command.h" +#include "intprops.h"
I see this file in ./gnulib/lib but intprops is not listed in bootstrap.conf, so it's probably pulled in as a dependency for another module. But it doesn't hurt to be explicit and list it in bootstrap.conf. ACK, with that fixed. -- Matthias Bolte http://photron.blogspot.com

On 06/24/2011 01:48 PM, Matthias Bolte wrote:
2011/6/24 Eric Blake <eblake@redhat.com>:
Integer overflow and remote code are never a nice mix.
This has existed since commit 56cd414.
* src/libvirt.c (virDomainGetVcpus): Reject overflow up front. * src/remote/remote_driver.c (remoteDomainGetVcpus): Avoid overflow on sending rpc. * daemon/remote.c (remoteDispatchDomainGetVcpus): Avoid overflow on receiving rpc.
+#include "intprops.h"
I see this file in ./gnulib/lib but intprops is not listed in bootstrap.conf, so it's probably pulled in as a dependency for another module. But it doesn't hurt to be explicit and list it in bootstrap.conf.
Actually, I squashed that into patch 1/2.
ACK, with that fixed.
Thanks, and pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2011/6/24 Eric Blake <eblake@redhat.com>:
Done as a separate commit to make backporting the next patch easier.
* .gnulib: Update, for syntax-check fix. ---
If anyone needs to backport the next patch, it will be easier to add an appropriate INT_MULTIPLY_OVERFLOW macro in "internal.h" than to do a gnulib update, so I've separated these two tasks.
.gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib index 478c2dc..25e4c2e 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 478c2dcc839e5f4765e6417684ce414e2d4973a8 +Subproject commit 25e4c2ec96602d132ad4429d6eaebaea1a8f504b -- 1.7.4.4
ACK. -- Matthias Bolte http://photron.blogspot.com

On 06/24/2011 01:48 PM, Matthias Bolte wrote:
2011/6/24 Eric Blake <eblake@redhat.com>:
Done as a separate commit to make backporting the next patch easier.
* .gnulib: Update, for syntax-check fix. ---
If anyone needs to backport the next patch, it will be easier to add an appropriate INT_MULTIPLY_OVERFLOW macro in "internal.h" than to do a gnulib update, so I've separated these two tasks.
.gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib index 478c2dc..25e4c2e 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 478c2dcc839e5f4765e6417684ce414e2d4973a8 +Subproject commit 25e4c2ec96602d132ad4429d6eaebaea1a8f504b -- 1.7.4.4
ACK.
Thanks; pushed. Here's the gnulib changes: * .gnulib 478c2dc...25e4c2e (3):
maint.mk: update sc_prohibit_intprops_without_use strerror-override: No-op tweak. autoupdate
Also, I squashed this in, based on your comments on 2/2: diff --git a/bootstrap.conf b/bootstrap.conf index 769e57c..7b2cd60 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -46,6 +46,7 @@ gitlog-to-changelog gnumakefile ignore-value inet_pton +intprops ioctl maintainer-makefile manywarnings diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c index feb3f98..dd9683c 100644 --- a/src/locking/domain_lock.c +++ b/src/locking/domain_lock.c @@ -21,8 +21,7 @@ #include <config.h> -#include <intprops.h> - +#include "intprops.h" #include "domain_lock.h" #include "memory.h" #include "uuid.h" diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index ce845ac..cf818a2 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -37,10 +37,10 @@ #include <netinet/ip.h> #include <netinet/udp.h> #include <net/if_arp.h> -#include <intprops.h> #include "internal.h" +#include "intprops.h" #include "buf.h" #include "memory.h" #include "logging.h" -- 1.7.4.4 -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Matthias Bolte