diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b377f8a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/Sys-Virt-v4.5.0.tar.gz diff --git a/.perl-Sys-Virt.metadata b/.perl-Sys-Virt.metadata new file mode 100644 index 0000000..f0b4d0e --- /dev/null +++ b/.perl-Sys-Virt.metadata @@ -0,0 +1 @@ +8e69ddc32a5f61ad5730859cf312808a3daab5a0 SOURCES/Sys-Virt-v4.5.0.tar.gz diff --git a/SOURCES/0000-Add-NWFilterBinding.pm-module-missed-in-dist.patch b/SOURCES/0000-Add-NWFilterBinding.pm-module-missed-in-dist.patch new file mode 100644 index 0000000..25c76f1 --- /dev/null +++ b/SOURCES/0000-Add-NWFilterBinding.pm-module-missed-in-dist.patch @@ -0,0 +1,126 @@ +From d5ae3d1db19b52676489c2312efd21ab5e86aee4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Tue, 14 Aug 2018 11:46:08 +0100 +Subject: [PATCH] Add NWFilterBinding.pm module missed in dist + +--- + lib/Sys/Virt/NWFilterBinding.pm | 107 ++++++++++++++++++++++++++++++++ + 1 file changed, 107 insertions(+) + create mode 100644 lib/Sys/Virt/NWFilterBinding.pm + +diff --git a/lib/Sys/Virt/NWFilterBinding.pm b/lib/Sys/Virt/NWFilterBinding.pm +new file mode 100644 +index 0000000..2c56b3f +--- /dev/null ++++ b/lib/Sys/Virt/NWFilterBinding.pm +@@ -0,0 +1,107 @@ ++# -*- perl -*- ++# ++# Copyright (C) 2018 Red Hat ++# ++# This program is free software; You can redistribute it and/or modify ++# it under either: ++# ++# a) the GNU General Public License as published by the Free ++# Software Foundation; either version 2, or (at your option) any ++# later version, ++# ++# or ++# ++# b) the "Artistic License" ++# ++# The file "LICENSE" distributed along with this file provides full ++# details of the terms and conditions of the two licenses. ++ ++=pod ++ ++=head1 NAME ++ ++Sys::Virt::NWFilterBinding - Represent & manage a network filter binding ++ ++=head1 DESCRIPTION ++ ++The C module represents a binding between a ++network filter and a network port device. ++ ++=head1 METHODS ++ ++=over 4 ++ ++=cut ++ ++package Sys::Virt::NWFilterBinding; ++ ++use strict; ++use warnings; ++ ++ ++sub _new { ++ my $proto = shift; ++ my $class = ref($proto) || $proto; ++ my %params = @_; ++ ++ my $con = exists $params{connection} ? $params{connection} : die "connection parameter is required"; ++ my $self; ++ if (exists $params{portdev}) { ++ $self = Sys::Virt::NWFilterBinding::_lookup_by_port_dev($con, $params{portdev}); ++ } elsif (exists $params{xml}) { ++ $self = Sys::Virt::NWFilterBinding::_create_xml($con, $params{xml}); ++ } else { ++ die "portdev or xml parameters are required"; ++ } ++ ++ bless $self, $class; ++ ++ return $self; ++} ++ ++ ++=item my $name = $binding->get_port_dev() ++ ++Returns a string with the name of the network port device that is bound to ++ ++=item my $name = $binding->get_filter_name() ++ ++Returns a string with the name of the network filter that is bound to ++ ++=item my $xml = $binding->get_xml_description() ++ ++Returns an XML document containing a complete description of ++the network's configuration ++ ++=item $binding->delete() ++ ++Unbind the network port device from the filter ++ ++=cut ++ ++ ++1; ++ ++=back ++ ++=head1 AUTHORS ++ ++Daniel P. Berrange ++ ++=head1 COPYRIGHT ++ ++Copyright (C) 2018 Red Hat ++ ++=head1 LICENSE ++ ++This program is free software; you can redistribute it and/or modify ++it under the terms of either the GNU General Public License as published ++by the Free Software Foundation (either version 2 of the License, or at ++your option any later version), or, the Artistic License, as specified ++in the Perl README file. ++ ++=head1 SEE ALSO ++ ++L, L, C ++ ++=cut +-- +2.17.1 + diff --git a/SOURCES/0001-Add-missing-import-of-NWFilterBinding.patch b/SOURCES/0001-Add-missing-import-of-NWFilterBinding.patch new file mode 100644 index 0000000..d02330d --- /dev/null +++ b/SOURCES/0001-Add-missing-import-of-NWFilterBinding.patch @@ -0,0 +1,26 @@ +From 9ae7dd0dd0c15dc88ea7e5caf9d29e6fa0630d4c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Thu, 26 Jul 2018 10:30:01 +0100 +Subject: [PATCH] Add missing import of NWFilterBinding +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit fb72cb23fe654d28e7c4027985552cd3b7ca53a0) +--- + lib/Sys/Virt.pm | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/Sys/Virt.pm b/lib/Sys/Virt.pm +index e0b0d77..302a748 100644 +--- a/lib/Sys/Virt.pm ++++ b/lib/Sys/Virt.pm +@@ -75,6 +75,7 @@ use Sys::Virt::NodeDevice; + use Sys::Virt::Interface; + use Sys::Virt::Secret; + use Sys::Virt::NWFilter; ++use Sys::Virt::NWFilterBinding; + use Sys::Virt::DomainSnapshot; + use Sys::Virt::Stream; + diff --git a/SOURCES/0002-Add-missing-initialization-of-virTypedParameters.patch b/SOURCES/0002-Add-missing-initialization-of-virTypedParameters.patch new file mode 100644 index 0000000..61a2b4f --- /dev/null +++ b/SOURCES/0002-Add-missing-initialization-of-virTypedParameters.patch @@ -0,0 +1,67 @@ +From 1dea4a6a88ede59814c672a907dd24d0a683c2a7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Mon, 6 Aug 2018 16:57:47 +0100 +Subject: [PATCH] Add missing initialization of virTypedParameters +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +For any API call where the API impl allocates the virTypedParameters +array must be passed a NULL-initialized pointer. + +Several APIs missed initialization which caused memory corruption. + +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 62edc0530fe04b4fc81473a5f5d750ae4d54ba3d) +--- + lib/Sys/Virt.xs | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/lib/Sys/Virt.xs b/lib/Sys/Virt.xs +index 40134d3..a013915 100644 +--- a/lib/Sys/Virt.xs ++++ b/lib/Sys/Virt.xs +@@ -2403,8 +2403,8 @@ get_node_sev_info(conn, flags=0) + virConnectPtr conn; + unsigned int flags; + PREINIT: +- virTypedParameterPtr params; +- int nparams; ++ virTypedParameterPtr params = NULL; ++ int nparams = 0; + CODE: + if (virNodeGetSEVInfo(conn, ¶ms, &nparams, flags) < 0) { + _croak_error(); +@@ -4554,8 +4554,8 @@ get_job_stats(dom, flags=0) + unsigned int flags; + PREINIT: + int type; +- virTypedParameterPtr params; +- int nparams; ++ virTypedParameterPtr params = NULL; ++ int nparams = 0; + HV *paramsHv; + SV *typeSv; + PPCODE: +@@ -4986,8 +4986,8 @@ get_launch_security_info(dom, flags=0) + virDomainPtr dom; + unsigned int flags; + PREINIT: +- virTypedParameterPtr params; +- int nparams; ++ virTypedParameterPtr params = NULL; ++ int nparams = 0; + CODE: + if (virDomainGetLaunchSecurityInfo(dom, ¶ms, &nparams, flags) < 0) { + _croak_error(); +@@ -5103,8 +5103,8 @@ get_guest_vcpus(dom, flags=0) + virDomainPtr dom; + unsigned int flags; + PREINIT: +- virTypedParameterPtr params; +- unsigned int nparams; ++ virTypedParameterPtr params = NULL; ++ unsigned int nparams = 0; + CODE: + if (virDomainGetGuestVcpus(dom, ¶ms, &nparams, flags) < 0) { + _croak_error(); diff --git a/SOURCES/0003-Add-missing-free-ing-of-virTypedParameters.patch b/SOURCES/0003-Add-missing-free-ing-of-virTypedParameters.patch new file mode 100644 index 0000000..a815d97 --- /dev/null +++ b/SOURCES/0003-Add-missing-free-ing-of-virTypedParameters.patch @@ -0,0 +1,122 @@ +From 1b025f7c670eeafb835858558db356917e150a36 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Mon, 6 Aug 2018 16:59:37 +0100 +Subject: [PATCH] Add missing free'ing of virTypedParameters +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Safefree() must be used to free any virTypedParameter arrays previously +allocated with Newx(). + +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 440fde1cb81595c9f5eab7b03c240ca88e998961) +--- + lib/Sys/Virt.xs | 36 +++++++++++++++++++++++++++--------- + 1 file changed, 27 insertions(+), 9 deletions(-) + +diff --git a/lib/Sys/Virt.xs b/lib/Sys/Virt.xs +index a013915..3d8eb9b 100644 +--- a/lib/Sys/Virt.xs ++++ b/lib/Sys/Virt.xs +@@ -2683,8 +2683,10 @@ set_node_memory_parameters(conn, newparams, flags=0) + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + +- if (virNodeSetMemoryParameters(conn, params, nparams, flags) < 0) ++ if (virNodeSetMemoryParameters(conn, params, nparams, flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } + Safefree(params); + + +@@ -4566,7 +4568,7 @@ get_job_stats(dom, flags=0) + + typeSv = newSViv(type); + paramsHv = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ free(params); + + EXTEND(SP, 2); + PUSHs(newRV_noinc((SV*)typeSv)); +@@ -4775,11 +4777,15 @@ set_scheduler_parameters(dom, newparams, flags=0) + } + nparams = vir_typed_param_from_hv(newparams, params, nparams); + if (flags) { +- if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0) ++ if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } + } else { +- if (virDomainSetSchedulerParameters(dom, params, nparams) < 0) ++ if (virDomainSetSchedulerParameters(dom, params, nparams) < 0) { ++ Safefree(params); + _croak_error(); ++ } + } + Safefree(params); + +@@ -4831,8 +4837,10 @@ set_memory_parameters(dom, newparams, flags=0) + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + +- if (virDomainSetMemoryParameters(dom, params, nparams, flags) < 0) ++ if (virDomainSetMemoryParameters(dom, params, nparams, flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } + Safefree(params); + + +@@ -4883,8 +4891,10 @@ set_numa_parameters(dom, newparams, flags=0) + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + +- if (virDomainSetNumaParameters(dom, params, nparams, flags) < 0) ++ if (virDomainSetNumaParameters(dom, params, nparams, flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } + Safefree(params); + + +@@ -4936,8 +4946,10 @@ set_blkio_parameters(dom, newparams, flags=0) + nparams = vir_typed_param_from_hv(newparams, params, nparams); + + if (virDomainSetBlkioParameters(dom, params, nparams, +- flags) < 0) ++ flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } + Safefree(params); + + +@@ -5658,8 +5670,11 @@ set_block_iotune(dom, disk, newparams, flags=0) + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); +- if (virDomainSetBlockIoTune(dom, disk, params, nparams, flags) < 0) ++ if (virDomainSetBlockIoTune(dom, disk, params, nparams, flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } ++ Safefree(params); + + + HV * +@@ -5709,8 +5724,11 @@ set_interface_parameters(dom, intf, newparams, flags=0) + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); +- if (virDomainSetInterfaceParameters(dom, intf, params, nparams, flags) < 0) ++ if (virDomainSetInterfaceParameters(dom, intf, params, nparams, flags) < 0) { ++ Safefree(params); + _croak_error(); ++ } ++ Safefree(params); + + + HV * diff --git a/SOURCES/0004-Clear-typed-parameter-elements-as-well-as-array.patch b/SOURCES/0004-Clear-typed-parameter-elements-as-well-as-array.patch new file mode 100644 index 0000000..6ebd203 --- /dev/null +++ b/SOURCES/0004-Clear-typed-parameter-elements-as-well-as-array.patch @@ -0,0 +1,472 @@ +From 88cf0236e1b98b00bcaa5762f9207b99fb98e084 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Mon, 6 Aug 2018 17:11:57 +0100 +Subject: [PATCH] Clear typed parameter elements as well as array +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some typed parameter elements may contain strings that need to be +freed. + +We must ensure that the parameter array has dup'd the strings +rather than borrowing a pointer. + +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 54f0d2c64021e6e143f40185f0181cf5d5a51f53) +--- + lib/Sys/Virt.xs | 124 ++++++++++++++++++++++++++---------------------- + 1 file changed, 66 insertions(+), 58 deletions(-) + +diff --git a/lib/Sys/Virt.xs b/lib/Sys/Virt.xs +index 3d8eb9b..6c2bf48 100644 +--- a/lib/Sys/Virt.xs ++++ b/lib/Sys/Virt.xs +@@ -86,7 +86,6 @@ virt_newSVull(unsigned long long val) { + } + + +- + static void + ignoreVirErrorFunc(void * userData, virErrorPtr error) { + /* Do nothing */ +@@ -263,7 +262,8 @@ vir_typed_param_from_hv(HV *newparams, virTypedParameterPtr params, int nparams) + + case VIR_TYPED_PARAM_STRING: + ptr = SvPV(*val, len); +- params[i].value.s = (char *)ptr; ++ if (!(params[i].value.s = strdup((char *)ptr))) ++ abort(); + break; + } + } +@@ -300,7 +300,8 @@ vir_typed_param_add_string_list_from_hv(HV *newparams, + localparams[*nparams + i].field[VIR_TYPED_PARAM_FIELD_LENGTH - 1] = '\0'; + + localparams[*nparams + i].type = VIR_TYPED_PARAM_STRING; +- localparams[*nparams + i].value.s = ptr; ++ if (!(localparams[*nparams + i].value.s = strdup(ptr))) ++ abort(); + } + + *params = localparams; +@@ -308,6 +309,14 @@ vir_typed_param_add_string_list_from_hv(HV *newparams, + } + + ++static void ++vir_typed_param_safe_free(virTypedParameterPtr params, int nparams) ++{ ++ virTypedParamsClear(params, nparams); ++ Safefree(params); ++} ++ ++ + static int + _domain_event_lifecycle_callback(virConnectPtr con, + virDomainPtr dom, +@@ -2411,7 +2420,7 @@ get_node_sev_info(conn, flags=0) + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- free(params); ++ virTypedParamsFree(params, nparams); + OUTPUT: + RETVAL + +@@ -2651,12 +2660,12 @@ get_node_memory_parameters(conn, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virNodeGetMemoryParameters(conn, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -2677,17 +2686,17 @@ set_node_memory_parameters(conn, newparams, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virNodeGetMemoryParameters(conn, params, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + + if (virNodeSetMemoryParameters(conn, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + +@@ -4562,13 +4571,12 @@ get_job_stats(dom, flags=0) + SV *typeSv; + PPCODE: + if (virDomainGetJobStats(dom, &type, ¶ms, &nparams, flags) < 0) { +- Safefree(params); + _croak_error(); + } + + typeSv = newSViv(type); + paramsHv = vir_typed_param_to_hv(params, nparams); +- free(params); ++ virTypedParamsFree(params, nparams); + + EXTEND(SP, 2); + PUSHs(newRV_noinc((SV*)typeSv)); +@@ -4676,11 +4684,11 @@ block_copy(dom, path, destxml, newparams, flags=0) + nparams = vir_typed_param_from_hv(newparams, params, nparams); + + if (virDomainBlockCopy(dom, path, destxml, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + void +@@ -4741,17 +4749,17 @@ get_scheduler_parameters(dom, flags=0) + Newx(params, nparams, virTypedParameter); + if (flags) { + if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + } else { + if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + } + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -4772,22 +4780,22 @@ set_scheduler_parameters(dom, newparams, flags=0) + free(type); + Newx(params, nparams, virTypedParameter); + if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + nparams = vir_typed_param_from_hv(newparams, params, nparams); + if (flags) { + if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + } else { + if (virDomainSetSchedulerParameters(dom, params, nparams) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -4805,12 +4813,12 @@ get_memory_parameters(dom, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainGetMemoryParameters(dom, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -4831,17 +4839,17 @@ set_memory_parameters(dom, newparams, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainGetMemoryParameters(dom, params, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + + if (virDomainSetMemoryParameters(dom, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -4859,12 +4867,12 @@ get_numa_parameters(dom, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainGetNumaParameters(dom, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -4885,17 +4893,17 @@ set_numa_parameters(dom, newparams, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainGetNumaParameters(dom, params, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + + if (virDomainSetNumaParameters(dom, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -4913,12 +4921,12 @@ get_blkio_parameters(dom, flags=0) + Newx(params, nparams, virBlkioParameter); + + if (virDomainGetBlkioParameters(dom, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -4939,7 +4947,7 @@ set_blkio_parameters(dom, newparams, flags=0) + Newx(params, nparams, virBlkioParameter); + + if (virDomainGetBlkioParameters(dom, params, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + +@@ -4947,10 +4955,10 @@ set_blkio_parameters(dom, newparams, flags=0) + + if (virDomainSetBlkioParameters(dom, params, nparams, + flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -4962,12 +4970,12 @@ get_perf_events(dom, flags=0) + int nparams = 0; + CODE: + if (virDomainGetPerfEvents(dom, ¶ms, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -4982,7 +4990,7 @@ set_perf_events(dom, newparams, flags=0) + int nparams = 0; + PPCODE: + if (virDomainGetPerfEvents(dom, ¶ms, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + +@@ -4990,7 +4998,7 @@ set_perf_events(dom, newparams, flags=0) + + if (virDomainSetPerfEvents(dom, params, nparams, flags) < 0) + _croak_error(); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -5005,7 +5013,7 @@ get_launch_security_info(dom, flags=0) + _croak_error(); + } + RETVAL = vir_typed_param_to_hv(params, nparams); +- free(params); ++ virTypedParamsFree(params, nparams); + OUTPUT: + RETVAL + +@@ -5386,10 +5394,10 @@ _migrate(dom, destcon, newparams, flags=0) + * if it is possible todo so + */ + if ((RETVAL = virDomainMigrate3(dom, destcon, params, nparams, flags)) == NULL) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -5477,10 +5485,10 @@ _migrate_to_uri(dom, desturi, newparams, flags=0) + * if it is possible todo so + */ + if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + void +@@ -5639,12 +5647,12 @@ get_block_iotune(dom, disk, flags=0) + + Newx(params, nparams, virTypedParameter); + if (virDomainGetBlockIoTune(dom, disk, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -5665,16 +5673,16 @@ set_block_iotune(dom, disk, newparams, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainGetBlockIoTune(dom, disk, params, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + if (virDomainSetBlockIoTune(dom, disk, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -5693,12 +5701,12 @@ get_interface_parameters(dom, intf, flags=0) + + Newx(params, nparams, virTypedParameter); + if (virDomainGetInterfaceParameters(dom, intf, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + RETVAL = vir_typed_param_to_hv(params, nparams); +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + OUTPUT: + RETVAL + +@@ -5719,16 +5727,16 @@ set_interface_parameters(dom, intf, newparams, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainGetInterfaceParameters(dom, intf, params, &nparams, 0) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + + nparams = vir_typed_param_from_hv(newparams, params, nparams); + if (virDomainSetInterfaceParameters(dom, intf, params, nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + HV * +@@ -5764,7 +5772,7 @@ block_stats(dom, path, flags=0) + Newx(params, nparams, virTypedParameter); + + if (virDomainBlockStatsFlags(dom, path, params, &nparams, flags) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + +@@ -5784,7 +5792,7 @@ block_stats(dom, path, flags=0) + (void)hv_store(RETVAL, field, strlen(field), val, 0); + } + } +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + } + OUTPUT: + RETVAL +@@ -6018,7 +6026,7 @@ get_cpu_stats(dom, start_cpu, ncpus, flags=0) + + Newx(params, ncpus * nparams, virTypedParameter); + if ((ret = virDomainGetCPUStats(dom, params, nparams, start_cpu, ncpus, flags)) < 0) { +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + _croak_error(); + } + +@@ -6028,7 +6036,7 @@ get_cpu_stats(dom, start_cpu, ncpus, flags=0) + PUSHs(newRV_noinc((SV *)rec)); + } + +- Safefree(params); ++ vir_typed_param_safe_free(params, nparams); + + + void diff --git a/SPECS/perl-Sys-Virt.spec b/SPECS/perl-Sys-Virt.spec new file mode 100644 index 0000000..7df4f41 --- /dev/null +++ b/SPECS/perl-Sys-Virt.spec @@ -0,0 +1,337 @@ +Name: perl-Sys-Virt +Version: 4.5.0 +Release: 2%{?dist} +Summary: Represent and manage a libvirt hypervisor connection +License: GPLv2+ or Artistic +URL: https://metacpan.org/release/Sys-Virt +Source0: https://cpan.metacpan.org/authors/id/D/DA/DANBERR/Sys-Virt-v%{version}.tar.gz +Patch0: 0000-Add-NWFilterBinding.pm-module-missed-in-dist.patch +Patch1: 0001-Add-missing-import-of-NWFilterBinding.patch +Patch2: 0002-Add-missing-initialization-of-virTypedParameters.patch +Patch3: 0003-Add-missing-free-ing-of-virTypedParameters.patch +Patch4: 0004-Clear-typed-parameter-elements-as-well-as-array.patch +# Build +BuildRequires: coreutils +BuildRequires: findutils +BuildRequires: libvirt-devel >= %{version} +BuildRequires: make +BuildRequires: perl +BuildRequires: perl(ExtUtils::CBuilder) +BuildRequires: perl(Module::Build) +BuildRequires: sed +# Runtime +BuildRequires: perl(overload) +BuildRequires: perl(strict) +BuildRequires: perl(warnings) +BuildRequires: perl(XSLoader) +# Tests only +BuildRequires: perl(base) +BuildRequires: perl(Sys::Hostname) +BuildRequires: perl(Test::More) +BuildRequires: perl(Time::HiRes) +BuildRequires: perl(XML::XPath) +BuildRequires: perl(XML::XPath::XMLParser) +# Optional tests only +BuildRequires: perl(Test::CPAN::Changes) +BuildRequires: perl(Test::Pod) >= 1.00 +BuildRequires: perl(Test::Pod::Coverage) >= 1.00 +BuildRequires: git +Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version)) + +%description +The Sys::Virt module provides a Perl XS binding to the libvirt virtual +machine management APIs. This allows machines running within arbitrary +virtualization containers to be managed with a consistent API. + +%prep +%autosetup -S git -n Sys-Virt-v%{version} + +%build +%{__perl} Build.PL installdirs=vendor +./Build + +%install +./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 + +%{_fixperms} %{buildroot}/* + +%check +./Build test + +%files +%license LICENSE +%doc AUTHORS Changes README examples/ +%{perl_vendorarch}/auto/* +%{perl_vendorarch}/Sys* +%{_mandir}/man3/* + +%changelog +* Tue Aug 14 2018 Daniel P. Berrangé - 4.5.0-2 +- Fix typed parameter memory handling (rhbz#1613227) +- Fix missing NWFilterBinding module (rhbz#1608755) + +* Tue Jul 3 2018 Daniel P. Berrangé - 4.5.0-1 +- Update to 4.5.0 release (rhbz #1563172) + +* Thu Jun 14 2018 Daniel P. Berrangé - 4.4.0-1 +- Update to 4.4.0 release (rhbz #1563172) + +* Mon Jun 11 2018 Daniel P. Berrangé - 4.2.0-1 +- Update to 4.2.0 release (rhbz #1563172) + +* Thu Nov 30 2017 Daniel P. Berrange - 3.9.0-2 +- Fix package placement of lifecycle constants (rhbz #1515722) + +* Mon Nov 6 2017 Daniel P. Berrange - 3.9.0-1 +- Rebase to 3.9.0 release (rhbz #1472268) + +* Tue Sep 5 2017 Daniel P. Berrange - 3.7.0-1 +- Rebase to 3.7.0 release (rhbz #1472268) + +* Mon Apr 3 2017 Daniel P. Berrange - 3.2.0-1 +- Rebase to 3.2.0 release (rhbz #1382643) + +* Fri Mar 3 2017 Daniel P. Berrange - 3.1.0-1 +- Rebase to 3.1.0 release (rhbz #1382643) + +* Tue Feb 7 2017 Daniel P. Berrange - 3.0.0-1 +- Rebase to 3.0.0 release (rhbz #1382643) + +* Wed Dec 7 2016 Daniel P. Berrange - 2.5.0-1 +- Rebase to 2.5.0 release (rhbz #1382643) + +* Fri Jul 1 2016 Daniel P. Berrange - 2.0.0-1 +- Rebase to 2.0.0 release (rhbz #1286682) + +* Mon Apr 18 2016 Daniel P. Berrange - 1.3.3-1 +- Rebase to 1.3.3 release (rhbz #1286682) + +* Wed Mar 9 2016 Daniel P. Berrange - 1.3.2-1 +- Rebase to 1.3.2 release (rhbz #1286682) + +* Fri Jul 17 2015 Daniel P. Berrange - 1.2.17-2 +- Avoid coverity strncpy() warning + +* Fri Jul 17 2015 Daniel P. Berrange - 1.2.17-1 +- Rebase to 1.2.17 release (rhbz #1194602) + +* Wed May 6 2015 Daniel P. Berrange - 1.2.15-1 +- Rebase to 1.2.15 release (rhbz #1194602) + +* Wed Dec 17 2014 Daniel P. Berrange - 1.2.8-6 +- Add VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING constant (rhbz #1175314) + +* Thu Dec 11 2014 Daniel P. Berrange - 1.2.8-5 +- Fix crash with migrate_to_uri API (rhbz #1171938) + +* Thu Dec 4 2014 Daniel P. Berrange - 1.2.8-4 +- Add agent lifecycle event callbacks & constants (rhbz #1167392) +- Fix docs for get_time method (rhbz #1164972) +- Fix docs for GET_ALL_STATS constnats (rhbz #1170481) + +* Mon Nov 10 2014 Daniel P. Berrange - 1.2.8-3 +- Update for latest constants in libvirt (rhbz #1160793) + +* Tue Sep 30 2014 Daniel P. Berrange - 1.2.8-2 +- Update for latest constants/events in libvirt (rhbz #1147042) + +* Wed Sep 10 2014 Daniel P. Berrange - 1.2.8-1 +- Update to 1.2.8 release (rhbz #1140194) + +* Fri Jan 24 2014 Daniel Mach - 1.1.1-5 +- Mass rebuild 2014-01-24 + +* Fri Dec 27 2013 Daniel Mach - 1.1.1-4 +- Mass rebuild 2013-12-27 + +* Wed Dec 18 2013 Daniel P. Berrange - 1.1.1-3 +- Fix out of bounds read in migrate param handling (rhbz #1043736) + +* Thu Aug 8 2013 Daniel P. Berrange - 1.1.1-2 +- Fix incorrect handling of flags in $dom->get_vcpu_info() (rhbz #994139) +- Fix error handling in $dev->get_parent() (rhbz #994141) + +* Tue Jul 30 2013 Daniel P. Berrange - 1.1.1-1 +- Update to 1.1.1 release + +* Tue Jul 30 2013 Daniel P. Berrange - 1.1.0-1 +- Update to 1.1.0 release + +* Wed Jul 24 2013 Petr Pisar - 1.0.5-2 +- Perl 5.18 rebuild + +* Tue May 14 2013 Daniel P. Berrange - 1.0.5-1 +- Update to 1.0.5 release + +* Tue Mar 5 2013 Daniel P. Berrange - 1.0.3-1 +- Update to 1.0.3 release + +* Wed Feb 27 2013 Daniel P. Berrange - 1.0.2-1 +- Update to 1.0.2 release + +* Tue Feb 26 2013 Daniel P. Berrange - 1.0.1-1 +- Update to 1.0.1 release + +* Thu Feb 14 2013 Fedora Release Engineering - 1.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Fri Nov 16 2012 Daniel P. Berrange - 1.0.0-1 +- Update to 1.0.0 release + +* Wed Sep 26 2012 Daniel P. Berrange - 0.10.2-1 +- Update to 0.10.2 release + +* Mon Sep 17 2012 Daniel P. Berrange - 0.10.0-1 +- Update to 0.10.0 release + +* Fri Jul 20 2012 Fedora Release Engineering - 0.9.13-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 09 2012 Petr Pisar - 0.9.13-2 +- Perl 5.16 rebuild + +* Mon Jul 2 2012 Daniel P. Berrange - 0.9.13-1 +- Update to 0.9.13 release + +* Fri Jun 15 2012 Petr Pisar - 0.9.12-2 +- Perl 5.16 rebuild + +* Mon May 21 2012 Daniel P. Berrange - 0.9.12-1 +- Update to 0.9.12 release + +* Mon Apr 16 2012 Daniel P. Berrange - 0.9.11-1 +- Update to 0.9.11 release + +* Mon Feb 13 2012 Daniel P. Berrange - 0.9.10-1 +- Update to 0.9.10 release + +* Mon Jan 9 2012 Daniel P. Berrange - 0.9.9-1 +- Update to 0.9.9 release + +* Tue Jan 3 2012 Daniel P. Berrange - 0.9.8-1 +- Update to 0.9.8 release + +* Tue Nov 8 2011 Daniel P. Berrange - 0.9.7-1 +- Update to 0.9.7 release + +* Mon Oct 17 2011 Daniel P. Berrange - 0.9.5-2 +- Add binding for virDomainOpenConsole + +* Thu Sep 29 2011 Daniel P. Berrange - 0.9.5-1 +- Update to 0.9.5 release + +* Wed Aug 3 2011 Daniel P. Berrange - 0.9.4-2 +- Re-add virDomainAbortJob API binding accidentally removed + +* Wed Aug 3 2011 Daniel P. Berrange - 0.9.4-1 +- Update to 0.9.4 release + +* Thu Jul 21 2011 Petr Sabata - 0.9.3-3 +- Perl mass rebuild + +* Tue Jul 19 2011 Petr Sabata - 0.9.3-2 +- Perl mass rebuild + +* Tue Jul 12 2011 Daniel P. Berrange - 0.9.3-1 +- Update to 0.9.3 release + +* Fri Jul 8 2011 Daniel P. Berrange - 0.9.2-1 +- Update to 0.9.2 release + +* Wed Jun 29 2011 Daniel P. Berrange - 0.2.7-1 +- Update to 0.2.7 release + +* Thu May 19 2011 Matthew Booth - 0.2.6-3 +- Backport get_xml_description with flags + +* Wed Feb 16 2011 Daniel P Berrange - 0.2.6-2 +- Workaround Test::More's inability to cast XML::XPath::Number to an int + +* Wed Feb 16 2011 Daniel P Berrange - 0.2.6-1 +- Update to 0.2.6 release + +* Wed Feb 09 2011 Fedora Release Engineering - 0.2.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Dec 22 2010 Marcela Maslanova - 0.2.4-3 +- 661697 rebuild for fixing problems with vendorach/lib + +* Sat Aug 14 2010 Daniel P. Berrange - 0.2.4-2 +- Rebuild against perl 5.12.0 +- Fix hostname test + +* Wed May 19 2010 Daniel P. Berrange - 0.2.4-1 +- Update to 0.2.4 release + +* Thu May 06 2010 Marcela Maslanova - 0.2.3-2 +- Mass rebuild with perl-5.12.0 + +* Fri Jan 15 2010 Daniel P. Berrange - 0.2.3-1 +- Update to 0.2.3 release + +* Mon Dec 7 2009 Stepan Kasal - 0.2.1-2 +- rebuild against perl 5.10.1 + +* Wed Aug 26 2009 Stepan Kasal - 0.2.1-1 +- new upstream version +- remove upstreamed patch + +* Sun Jul 26 2009 Fedora Release Engineering - 0.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Mar 30 2009 Stepan Kasal - 0.2.0-2 +- BR: libvirt >= 0.6.1 + +* Mon Mar 30 2009 Stepan Kasal - 0.2.0-1 +- new upstream version (#237421) + +* Thu Feb 26 2009 Fedora Release Engineering - 0.1.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Fri Mar 07 2008 Daniel P. Berrange - 0.1.2-3 +- Fix calls to free() in XS binding + +* Thu Mar 06 2008 Tom "spot" Callaway - 0.1.2-2 +Rebuild for new perl + +* Wed Mar 05 2008 Steven Pritchard 0.1.2-1 +- Update to 0.1.2. +- Drop Sys-Virt-doc.patch. +- BR XML::XPath. +- No longer need to BR pkgconfig or xen-devel. +- Disable 100-connect test. + +* Tue Feb 19 2008 Fedora Release Engineering - 0.1.1-10 +- Autorebuild for GCC 4.3 + +* Tue Apr 17 2007 Steven Pritchard 0.1.1-9 +- BR ExtUtils::MakeMaker. + +* Tue Apr 17 2007 Steven Pritchard 0.1.1-8 +- Use fixperms macro instead of our own chmod incantation. + +* Mon Aug 28 2006 Steven Pritchard 0.1.1-7 +- Rebuild. + +* Sat Aug 19 2006 Steven Pritchard 0.1.1-6 +- More documentation fixes. + +* Fri Aug 18 2006 Steven Pritchard 0.1.1-5 +- Make this spec work on FC5 or FC6. +- Add ExclusiveArch to match xen and libvirt. + +* Fri Aug 18 2006 Steven Pritchard 0.1.1-4 +- BR xen-devel. + +* Fri Aug 18 2006 Steven Pritchard 0.1.1-3 +- BR Test::Pod and Test::Pod::Coverage. + +* Sat Aug 12 2006 Steven Pritchard 0.1.1-2 +- Add Sys-Virt-Domain-doc.patch. + +* Sat Aug 12 2006 Steven Pritchard 0.1.1-1 +- Specfile autogenerated by cpanspec 1.68. +- BR libvirt-devel and pkgconfig. +- Fix License. +- Drop non-doc autobuild.sh and add the examples directory. +- Don't try to build the included perl-Sys-Virt.spec.