diff --git a/backport-meson-drop-debug_logs-configure-argument.patch b/backport-meson-drop-debug_logs-configure-argument.patch new file mode 100644 index 0000000000000000000000000000000000000000..fac1c12e8d21d2e888162dd1cc4d512aa365daf2 --- /dev/null +++ b/backport-meson-drop-debug_logs-configure-argument.patch @@ -0,0 +1,155 @@ +From 2b3bbbc1b7f8723c4947c6d1e4fb43cabc25fb2e Mon Sep 17 00:00:00 2001 +From: Pavel Hrdina +Date: Fri, 24 Jul 2020 16:30:06 +0200 +Subject: [PATCH 2/4] meson: drop debug_logs configure argument + +There is no point of having this option in libvirt because the debug +logs can be configured using log filters. + +origin commit: https://gitlab.com/libvirt/libvirt/-/commit/da6d644ea7b49500680a3d4a403571234fecefad +Signed-off-by: Pavel Hrdina +Reviewed-by: Peter Krempa +Reviewed-by: Neal Gompa +Signed-off-by: Chenxi Mao +--- + configure.ac | 3 --- + m4/virt-debug.m4 | 33 --------------------------------- + src/util/virlog.h | 23 +---------------------- + tools/virsh.c | 2 -- + tools/virt-admin.c | 2 -- + 5 files changed, 1 insertion(+), 62 deletions(-) + delete mode 100644 m4/virt-debug.m4 + +diff --git a/configure.ac b/configure.ac +index cb62e5aac8..93d13496f3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -496,7 +496,6 @@ dnl + dnl Miscellaneous checks + dnl + +-LIBVIRT_ARG_DEBUG + LIBVIRT_ARG_DTRACE + LIBVIRT_ARG_NUMAD + LIBVIRT_ARG_INIT_SCRIPT +@@ -509,7 +508,6 @@ LIBVIRT_ARG_TLS_PRIORITY + LIBVIRT_ARG_SYSCTL_CONFIG + + +-LIBVIRT_CHECK_DEBUG + LIBVIRT_CHECK_DTRACE + LIBVIRT_CHECK_NUMAD + LIBVIRT_CHECK_INIT_SCRIPT +@@ -1038,7 +1036,6 @@ LIBVIRT_RESULT([Coverage], [$enable_test_coverage]) + AC_MSG_NOTICE([]) + AC_MSG_NOTICE([Miscellaneous]) + AC_MSG_NOTICE([]) +-LIBVIRT_RESULT_DEBUG + LIBVIRT_RESULT([Use -Werror], [$enable_werror]) + LIBVIRT_RESULT([Warning Flags], [$WARN_CFLAGS]) + LIBVIRT_RESULT_DTRACE +diff --git a/m4/virt-debug.m4 b/m4/virt-debug.m4 +deleted file mode 100644 +index d3ac0564f2..0000000000 +--- a/m4/virt-debug.m4 ++++ /dev/null +@@ -1,33 +0,0 @@ +-dnl The debug check +-dnl +-dnl Copyright (C) 2016 Red Hat, Inc. +-dnl +-dnl This library is free software; you can redistribute it and/or +-dnl modify it under the terms of the GNU Lesser General Public +-dnl License as published by the Free Software Foundation; either +-dnl version 2.1 of the License, or (at your option) any later version. +-dnl +-dnl This library is distributed in the hope that it will be useful, +-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-dnl Lesser General Public License for more details. +-dnl +-dnl You should have received a copy of the GNU Lesser General Public +-dnl License along with this library. If not, see +-dnl . +-dnl +- +-AC_DEFUN([LIBVIRT_ARG_DEBUG], [ +- LIBVIRT_ARG_ENABLE([DEBUG], [enable debugging output], [yes]) +-]) +- +-AC_DEFUN([LIBVIRT_CHECK_DEBUG], [ +- AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes") +- if test x"$enable_debug" = x"yes"; then +- AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled]) +- fi +-]) +- +-AC_DEFUN([LIBVIRT_RESULT_DEBUG], [ +- LIBVIRT_RESULT([Debug], [$enable_debug]) +-]) +diff --git a/src/util/virlog.h b/src/util/virlog.h +index feb2f85904..716fb9a378 100644 +--- a/src/util/virlog.h ++++ b/src/util/virlog.h +@@ -78,29 +78,8 @@ struct _virLogSource { + .serial = 0, \ + } + +-/* +- * If configured with --enable-debug=yes then library calls +- * are printed to stderr for debugging or to an appropriate channel +- * defined at runtime from the libvirt daemon configuration file +- */ +-#ifdef ENABLE_DEBUG +-# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ ++#define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ + virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__) +-#else +-/** +- * virLogEatParams: +- * +- * Do nothing but eat parameters. +- */ +-static inline void virLogEatParams(virLogSourcePtr unused, ...) +-{ +- /* Silence gcc */ +- unused = unused; +-} +-# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ +- virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__) +-#endif /* !ENABLE_DEBUG */ +- + #define VIR_INFO_INT(src, filename, linenr, funcname, ...) \ + virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__) + #define VIR_WARN_INT(src, filename, linenr, funcname, ...) \ +diff --git a/tools/virsh.c b/tools/virsh.c +index 197a90636d..06ff5e8336 100644 +--- a/tools/virsh.c ++++ b/tools/virsh.c +@@ -614,9 +614,7 @@ virshShowVersion(vshControl *ctl G_GNUC_UNUSED) + #ifdef WITH_SECRETS + vshPrint(ctl, " Secrets"); + #endif +-#ifdef ENABLE_DEBUG + vshPrint(ctl, " Debug"); +-#endif + #ifdef WITH_DTRACE_PROBES + vshPrint(ctl, " DTrace"); + #endif +diff --git a/tools/virt-admin.c b/tools/virt-admin.c +index a8e5e0a5af..df23330ee1 100644 +--- a/tools/virt-admin.c ++++ b/tools/virt-admin.c +@@ -1277,9 +1277,7 @@ vshAdmShowVersion(vshControl *ctl G_GNUC_UNUSED) + #ifdef WITH_LIBVIRTD + vshPrint(ctl, " Daemon"); + #endif +-#ifdef ENABLE_DEBUG + vshPrint(ctl, " Debug"); +-#endif + #if WITH_READLINE + vshPrint(ctl, " Readline"); + #endif +-- +2.33.0 + diff --git a/backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch b/backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch new file mode 100644 index 0000000000000000000000000000000000000000..42211ca39f41e11ad09c403505cf546aceea4eae --- /dev/null +++ b/backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch @@ -0,0 +1,67 @@ +From f6c9bb6adbee8f74172707845dcdf221e79e35d4 Mon Sep 17 00:00:00 2001 +From: Peter Krempa +Date: Tue, 23 Aug 2022 15:29:43 +0200 +Subject: [PATCH 1/4] virhostcpu: Fix build with clang and newest kernel + headers + +The most recent environment e.g. present in our Fedora Rawhide builds +fail to build the tree with clang with the following error: + +../src/util/virhostcpu.c:1291:25: error: field 'header' with variable sized type 'struct kvm_msrs' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] + struct kvm_msrs header; + ^ + +The problem seems to be that clang doesn't like the new way the +'entries' field in struct kvm_msrs is declared. + +To work around the issue we can simply allocate the variable dynamically +and use the 'entries' member as it was intended to to access the +members. + +origin commit: https://gitlab.com/libvirt/libvirt/-/commit/56b3ee743916c8951a32a1650616621d78afe8c7 +Signed-off-by: Peter Krempa +Reviewed-by: Jiri Denemark +Signed-off-by: Chenxi Mao +--- + src/util/virhostcpu.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c +index ce3da7e6ec..8c8fc3a476 100644 +--- a/src/util/virhostcpu.c ++++ b/src/util/virhostcpu.c +@@ -1275,25 +1275,22 @@ virHostCPUGetMSRFromKVM(unsigned long index, + uint64_t *result) + { + VIR_AUTOCLOSE fd = -1; +- struct { +- struct kvm_msrs header; +- struct kvm_msr_entry entry; +- } msr = { +- .header = { .nmsrs = 1 }, +- .entry = { .index = index }, +- }; ++ g_autofree struct kvm_msrs *msr = g_malloc0(sizeof(struct kvm_msrs) + ++ sizeof(struct kvm_msr_entry)); ++ msr->nmsrs = 1; ++ msr->entries[0].index = index; + + if ((fd = open(KVM_DEVICE, O_RDONLY)) < 0) { + virReportSystemError(errno, _("Unable to open %s"), KVM_DEVICE); + return -1; + } + +- if (ioctl(fd, KVM_GET_MSRS, &msr) < 0) { ++ if (ioctl(fd, KVM_GET_MSRS, msr) < 0) { + VIR_DEBUG("Cannot get MSR 0x%lx from KVM", index); + return 1; + } + +- *result = msr.entry.data; ++ *result = msr->entries[0].data; + return 0; + } + +-- +2.33.0 + diff --git a/backport-vshCommandStringGetArg-Drop-sz.patch b/backport-vshCommandStringGetArg-Drop-sz.patch new file mode 100644 index 0000000000000000000000000000000000000000..0f19fcb82098b2bc735e835d4db5a95c5c137088 --- /dev/null +++ b/backport-vshCommandStringGetArg-Drop-sz.patch @@ -0,0 +1,42 @@ +From 6d3c4b49c08d5fcf42f324af0d04551619e4109f Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Thu, 7 Jan 2021 17:59:55 +0100 +Subject: [PATCH 3/4] vshCommandStringGetArg: Drop @sz +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This variable is unused since introduction of the function in +v0.8.5~150. + +origin commit: https://gitlab.com/libvirt/libvirt/-/commit/9b9542586cc047075469053606d1e12cb017b5ca +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +Signed-off-by: Chenxi Mao +--- + tools/vsh.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tools/vsh.c b/tools/vsh.c +index 3646f37cea..f5fa7b6f6f 100644 +--- a/tools/vsh.c ++++ b/tools/vsh.c +@@ -1641,7 +1641,6 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res, + { + bool single_quote = false; + bool double_quote = false; +- int sz = 0; + char *p = parser->pos; + char *q = g_strdup(p); + +@@ -1695,7 +1694,6 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res, + } + + *q++ = *p++; +- sz++; + } + if (double_quote) { + if (report) +-- +2.33.0 + diff --git a/bugfix-fix-warnings-found-by-clang.patch b/bugfix-fix-warnings-found-by-clang.patch new file mode 100644 index 0000000000000000000000000000000000000000..378bc20903f0ee18a437e9f758baa9fdf65eface --- /dev/null +++ b/bugfix-fix-warnings-found-by-clang.patch @@ -0,0 +1,30 @@ +From 0559dfd4d4fa74484dae487711a986cc9acdfbfc Mon Sep 17 00:00:00 2001 +From: Chenxi Mao +Date: Tue, 4 Apr 2023 14:25:17 +0800 +Subject: [PATCH 4/4] Fix warnings found by clang + +Warnings found if build with clang 15: + +[ 257s] ../../src/qemu/qemu_hotpatch.c:217:22: error: unused variable 'libvirtd_conf' [-Werror,-Wunused-variable] +[ 257s] g_autofree char *libvirtd_conf = NULL; + +Signed-off-by: Chenxi Mao +--- + src/qemu/qemu_hotpatch.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/qemu/qemu_hotpatch.c b/src/qemu/qemu_hotpatch.c +index 02f511cc38..64aac9bb4c 100644 +--- a/src/qemu/qemu_hotpatch.c ++++ b/src/qemu/qemu_hotpatch.c +@@ -214,7 +214,6 @@ qemuDomainHotpatchAutoload(virDomainObjPtr vm, char *hotpatch_path) + VIR_AUTOSTRINGLIST applied_patches = NULL; + VIR_AUTOSTRINGLIST lines = NULL; + g_autofree char *applied_patch = NULL; +- g_autofree char *libvirtd_conf = NULL; + g_autofree char *patch_conf = NULL; + g_autofree char *buf = NULL; + char *ret = NULL; +-- +2.33.0 + diff --git a/libvirt.spec b/libvirt.spec index 100572aaafbd93d82941f25b8acd18472aa3c883..e4d0d0ae0d919cfa75a58a2a7b7b6a0d99a3c032 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -101,7 +101,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 6.2.0 -Release: 53 +Release: 54 License: LGPLv2+ URL: https://libvirt.org/ @@ -473,6 +473,10 @@ Patch0360: Add-loongarch-cpu-support.patch Patch0361: Add-loongarch-cpu-model-and-vendor-info.patch Patch0362: Config-some-capabilities-for-loongarch-virt-machine.patch Patch0363: Implement-the-method-of-getting-host-info-for-loonga.patch +Patch0364: backport-virhostcpu-Fix-build-with-clang-and-newest-kernel-he.patch +Patch0365: backport-meson-drop-debug_logs-configure-argument.patch +Patch0366: backport-vshCommandStringGetArg-Drop-sz.patch +Patch0367: bugfix-fix-warnings-found-by-clang.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2209,6 +2213,9 @@ exit 0 %changelog +* Tue Apr 04 2023 Chenxi Mao - 6.2.0-54 +- bugfix: Fix build error if compiler switch to clang. + * Thu Mar 30 2023 zhaotianrui - 6.2.0-53 - bugfix: correct the firmware path of loongarch virt machine