From 059f6e6b6f729346a3c6794e3d1e574afc9e82c1 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Aug 2025 10:07:00 +0800 Subject: [PATCH] Sync upstream changes --- 0461-linux-headers-riscv-add-ptrace-h.patch | 159 ++++++++++++ ...ders-fix-forwarding-to-asm-generic-h.patch | 53 ++++ ...ders-move-pvpanic-h-to-correct-direc.patch | 86 +++++++ ...aders-import-linux-kvm-para-h-header.patch | 167 ++++++++++++ ...meson-fix-type-of-relocatable-option.patch | 29 +++ 0466-makefile-clean-qemu-iotests-output.patch | 39 +++ ...onfigure-remove-unnecessary-subshell.patch | 47 ++++ ...again-the-case-arms-in-probe-target-.patch | 165 ++++++++++++ ...dd-more-sections-to-main-meson-build.patch | 75 ++++++ 0470-meson-move-program-checks-together.patch | 158 ++++++++++++ ...eson-move-option-validation-together.patch | 191 ++++++++++++++ ...celerator-dependency-checks-together.patch | 241 ++++++++++++++++++ 0473-meson-keep-subprojects-together.patch | 134 ++++++++++ ...etection-code-with-other-compiler-fl.patch | 117 +++++++++ ...e-config-host-h-definitions-together.patch | 86 +++++++ ...e-subdirs-to-collect-sources-section.patch | 101 ++++++++ ...be-u2f-and-canokey-if-the-option-is-.patch | 34 +++ ...t-fix-overrun-in-update-sctp-checksu.patch | 71 ++++++ ...l-iov-do-not-assert-offset-is-in-iov.patch | 110 ++++++++ ...t-tx-pkt-fix-overrun-in-update-sctp-.patch | 42 +++ qemu.spec | 29 ++- 21 files changed, 2133 insertions(+), 1 deletion(-) create mode 100644 0461-linux-headers-riscv-add-ptrace-h.patch create mode 100644 0462-update-linux-headers-fix-forwarding-to-asm-generic-h.patch create mode 100644 0463-update-linux-headers-move-pvpanic-h-to-correct-direc.patch create mode 100644 0464-update-linux-headers-import-linux-kvm-para-h-header.patch create mode 100644 0465-meson-fix-type-of-relocatable-option.patch create mode 100644 0466-makefile-clean-qemu-iotests-output.patch create mode 100644 0467-configure-remove-unnecessary-subshell.patch create mode 100644 0468-configure-unify-again-the-case-arms-in-probe-target-.patch create mode 100644 0469-meson-add-more-sections-to-main-meson-build.patch create mode 100644 0470-meson-move-program-checks-together.patch create mode 100644 0471-meson-move-option-validation-together.patch create mode 100644 0472-meson-move-accelerator-dependency-checks-together.patch create mode 100644 0473-meson-keep-subprojects-together.patch create mode 100644 0474-meson-move-cfi-detection-code-with-other-compiler-fl.patch create mode 100644 0475-meson-move-config-host-h-definitions-together.patch create mode 100644 0476-meson-move-subdirs-to-collect-sources-section.patch create mode 100644 0477-meson-always-probe-u2f-and-canokey-if-the-option-is-.patch create mode 100644 0478-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-checksu.patch create mode 100644 0479-util-iov-do-not-assert-offset-is-in-iov.patch create mode 100644 0480-revert-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-.patch diff --git a/0461-linux-headers-riscv-add-ptrace-h.patch b/0461-linux-headers-riscv-add-ptrace-h.patch new file mode 100644 index 0000000..0b8f628 --- /dev/null +++ b/0461-linux-headers-riscv-add-ptrace-h.patch @@ -0,0 +1,159 @@ +From f79fc277fc4c9a3e504c4318c473fee8f90c1494 Mon Sep 17 00:00:00 2001 +From: Daniel Henrique Barboza +Date: Mon, 18 Dec 2023 17:43:19 -0300 +Subject: [PATCH] linux-headers: riscv: add ptrace.h + +commit 1583ca8aa61e1648d1f340c9a6ae3cd7ba3a82ae upstream. + +KVM vector support for RISC-V requires the linux-header ptrace.h. + +Signed-off-by: Daniel Henrique Barboza +Acked-by: Alistair Francis +Message-ID: <20231218204321.75757-3-dbarboza@ventanamicro.com> +Signed-off-by: Alistair Francis +--- + linux-headers/asm-riscv/ptrace.h | 132 +++++++++++++++++++++++++++++++ + 1 file changed, 132 insertions(+) + create mode 100644 linux-headers/asm-riscv/ptrace.h + +diff --git a/linux-headers/asm-riscv/ptrace.h b/linux-headers/asm-riscv/ptrace.h +new file mode 100644 +index 0000000000..1e3166caca +--- /dev/null ++++ b/linux-headers/asm-riscv/ptrace.h +@@ -0,0 +1,132 @@ ++/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ ++/* ++ * Copyright (C) 2012 Regents of the University of California ++ */ ++ ++#ifndef _ASM_RISCV_PTRACE_H ++#define _ASM_RISCV_PTRACE_H ++ ++#ifndef __ASSEMBLY__ ++ ++#include ++ ++#define PTRACE_GETFDPIC 33 ++ ++#define PTRACE_GETFDPIC_EXEC 0 ++#define PTRACE_GETFDPIC_INTERP 1 ++ ++/* ++ * User-mode register state for core dumps, ptrace, sigcontext ++ * ++ * This decouples struct pt_regs from the userspace ABI. ++ * struct user_regs_struct must form a prefix of struct pt_regs. ++ */ ++struct user_regs_struct { ++ unsigned long pc; ++ unsigned long ra; ++ unsigned long sp; ++ unsigned long gp; ++ unsigned long tp; ++ unsigned long t0; ++ unsigned long t1; ++ unsigned long t2; ++ unsigned long s0; ++ unsigned long s1; ++ unsigned long a0; ++ unsigned long a1; ++ unsigned long a2; ++ unsigned long a3; ++ unsigned long a4; ++ unsigned long a5; ++ unsigned long a6; ++ unsigned long a7; ++ unsigned long s2; ++ unsigned long s3; ++ unsigned long s4; ++ unsigned long s5; ++ unsigned long s6; ++ unsigned long s7; ++ unsigned long s8; ++ unsigned long s9; ++ unsigned long s10; ++ unsigned long s11; ++ unsigned long t3; ++ unsigned long t4; ++ unsigned long t5; ++ unsigned long t6; ++}; ++ ++struct __riscv_f_ext_state { ++ __u32 f[32]; ++ __u32 fcsr; ++}; ++ ++struct __riscv_d_ext_state { ++ __u64 f[32]; ++ __u32 fcsr; ++}; ++ ++struct __riscv_q_ext_state { ++ __u64 f[64] __attribute__((aligned(16))); ++ __u32 fcsr; ++ /* ++ * Reserved for expansion of sigcontext structure. Currently zeroed ++ * upon signal, and must be zero upon sigreturn. ++ */ ++ __u32 reserved[3]; ++}; ++ ++struct __riscv_ctx_hdr { ++ __u32 magic; ++ __u32 size; ++}; ++ ++struct __riscv_extra_ext_header { ++ __u32 __padding[129] __attribute__((aligned(16))); ++ /* ++ * Reserved for expansion of sigcontext structure. Currently zeroed ++ * upon signal, and must be zero upon sigreturn. ++ */ ++ __u32 reserved; ++ struct __riscv_ctx_hdr hdr; ++}; ++ ++union __riscv_fp_state { ++ struct __riscv_f_ext_state f; ++ struct __riscv_d_ext_state d; ++ struct __riscv_q_ext_state q; ++}; ++ ++struct __riscv_v_ext_state { ++ unsigned long vstart; ++ unsigned long vl; ++ unsigned long vtype; ++ unsigned long vcsr; ++ unsigned long vlenb; ++ void *datap; ++ /* ++ * In signal handler, datap will be set a correct user stack offset ++ * and vector registers will be copied to the address of datap ++ * pointer. ++ */ ++}; ++ ++struct __riscv_v_regset_state { ++ unsigned long vstart; ++ unsigned long vl; ++ unsigned long vtype; ++ unsigned long vcsr; ++ unsigned long vlenb; ++ char vreg[]; ++}; ++ ++/* ++ * According to spec: The number of bits in a single vector register, ++ * VLEN >= ELEN, which must be a power of 2, and must be no greater than ++ * 2^16 = 65536bits = 8192bytes ++ */ ++#define RISCV_MAX_VLENB (8192) ++ ++#endif /* __ASSEMBLY__ */ ++ ++#endif /* _ASM_RISCV_PTRACE_H */ +-- +2.39.3 + diff --git a/0462-update-linux-headers-fix-forwarding-to-asm-generic-h.patch b/0462-update-linux-headers-fix-forwarding-to-asm-generic-h.patch new file mode 100644 index 0000000..672341e --- /dev/null +++ b/0462-update-linux-headers-fix-forwarding-to-asm-generic-h.patch @@ -0,0 +1,53 @@ +From 836c891c3133aa7ca4f881635979e04cc2e4166e Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Mon, 3 Jun 2024 13:49:49 +0200 +Subject: [PATCH] update-linux-headers: fix forwarding to asm-generic headers + +commit ef7c70f020ca1fe9e7c98ea2cd9d6ba3c5714716 upstream. + +Afer commit 3efc75ad9d9 ("scripts/update-linux-headers.sh: Remove +temporary directory inbetween", 2024-05-29), updating linux-headers/ +results in errors such as + + cp: cannot stat '/tmp/tmp.1A1Eejh1UE/headers/include/asm/bitsperlong.h': No such file or directory + +because Loongarch does not have an asm/bitsperlong.h file and uses the +generic version. Before commit 3efc75ad9d9, the missing file would +incorrectly cause stale files to be included in linux-headers/. The files +were never committed to qemu.git, but were wrong nevertheless. The build +would just use the system version of the files, which is opposite to +the idea of importing Linux header files into QEMU's tree. + +Create forwarding headers, resembling the ones that are generated during a +kernel build by scripts/Makefile.asm-generic, if a file is only installed +under include/asm-generic/. + +Reviewed-by: Thomas Huth +Signed-off-by: Paolo Bonzini +--- + scripts/update-linux-headers.sh | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh +index 895a2c1722..0c6a288f13 100755 +--- a/scripts/update-linux-headers.sh ++++ b/scripts/update-linux-headers.sh +@@ -119,7 +119,14 @@ for arch in $ARCHLIST; do + rm -rf "$output/linux-headers/asm-$arch" + mkdir -p "$output/linux-headers/asm-$arch" + for header in kvm.h unistd.h bitsperlong.h mman.h; do +- cp "$hdrdir/include/asm/$header" "$output/linux-headers/asm-$arch" ++ if test -f "$hdrdir/include/asm/$header"; then ++ cp "$hdrdir/include/asm/$header" "$output/linux-headers/asm-$arch" ++ elif test -f "$hdrdir/include/asm-generic/$header"; then ++ # not installed as , but used as such in kernel sources ++ cat <$output/linux-headers/asm-$arch/$header ++#include ++EOF ++ fi + done + + if [ $arch = mips ]; then +-- +2.39.3 + diff --git a/0463-update-linux-headers-move-pvpanic-h-to-correct-direc.patch b/0463-update-linux-headers-move-pvpanic-h-to-correct-direc.patch new file mode 100644 index 0000000..7976c7e --- /dev/null +++ b/0463-update-linux-headers-move-pvpanic-h-to-correct-direc.patch @@ -0,0 +1,86 @@ +From 53a446fa05303f811ec35be509a0e9be25669117 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Mon, 3 Jun 2024 14:16:55 +0200 +Subject: [PATCH] update-linux-headers: move pvpanic.h to correct directory + +commit b8116f4cbaa0f64bb07564f20b3b5219e23c8bff upstream. + +Linux has , not . Use the same +directory for QEMU's include/standard-headers/ copy. + +Reviewed-by: Thomas Huth +Signed-off-by: Paolo Bonzini +--- + hw/misc/pvpanic-isa.c | 2 +- + hw/misc/pvpanic-pci.c | 2 +- + hw/misc/pvpanic.c | 2 +- + include/standard-headers/{linux => misc}/pvpanic.h | 0 + scripts/update-linux-headers.sh | 6 ++++-- + 5 files changed, 7 insertions(+), 5 deletions(-) + rename include/standard-headers/{linux => misc}/pvpanic.h (100%) + +diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c +index ccec50f61b..b4f84c4110 100644 +--- a/hw/misc/pvpanic-isa.c ++++ b/hw/misc/pvpanic-isa.c +@@ -21,7 +21,7 @@ + #include "hw/misc/pvpanic.h" + #include "qom/object.h" + #include "hw/isa/isa.h" +-#include "standard-headers/linux/pvpanic.h" ++#include "standard-headers/misc/pvpanic.h" + #include "hw/acpi/acpi_aml_interface.h" + + OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) +diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c +index fbcaa50731..0af7b15aef 100644 +--- a/hw/misc/pvpanic-pci.c ++++ b/hw/misc/pvpanic-pci.c +@@ -21,7 +21,7 @@ + #include "hw/misc/pvpanic.h" + #include "qom/object.h" + #include "hw/pci/pci_device.h" +-#include "standard-headers/linux/pvpanic.h" ++#include "standard-headers/misc/pvpanic.h" + + OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) + +diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c +index 1540e9091a..80289ecf5f 100644 +--- a/hw/misc/pvpanic.c ++++ b/hw/misc/pvpanic.c +@@ -21,7 +21,7 @@ + #include "hw/qdev-properties.h" + #include "hw/misc/pvpanic.h" + #include "qom/object.h" +-#include "standard-headers/linux/pvpanic.h" ++#include "standard-headers/misc/pvpanic.h" + + static void handle_event(int event) + { +diff --git a/include/standard-headers/linux/pvpanic.h b/include/standard-headers/misc/pvpanic.h +similarity index 100% +rename from include/standard-headers/linux/pvpanic.h +rename to include/standard-headers/misc/pvpanic.h +diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh +index 0c6a288f13..87fabf38df 100755 +--- a/scripts/update-linux-headers.sh ++++ b/scripts/update-linux-headers.sh +@@ -236,10 +236,12 @@ for i in "$hdrdir"/include/linux/*virtio*.h \ + "$hdrdir/include/linux/const.h" \ + "$hdrdir/include/linux/kernel.h" \ + "$hdrdir/include/linux/vhost_types.h" \ +- "$hdrdir/include/linux/sysinfo.h" \ +- "$hdrdir/include/misc/pvpanic.h"; do ++ "$hdrdir/include/linux/sysinfo.h"; do + cp_portable "$i" "$output/include/standard-headers/linux" + done ++mkdir -p "$output/include/standard-headers/misc" ++cp_portable "$hdrdir/include/misc/pvpanic.h" \ ++ "$output/include/standard-headers/misc" + mkdir -p "$output/include/standard-headers/drm" + cp_portable "$hdrdir/include/drm/drm_fourcc.h" \ + "$output/include/standard-headers/drm" +-- +2.39.3 + diff --git a/0464-update-linux-headers-import-linux-kvm-para-h-header.patch b/0464-update-linux-headers-import-linux-kvm-para-h-header.patch new file mode 100644 index 0000000..4f251da --- /dev/null +++ b/0464-update-linux-headers-import-linux-kvm-para-h-header.patch @@ -0,0 +1,167 @@ +From beeac1c83741d9d86055f40312dbd493fe5a3f3f Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Mon, 3 Jun 2024 14:25:06 +0200 +Subject: [PATCH] update-linux-headers: import linux/kvm_para.h header + +commit aa274c33c39e7de981dc195abe60e1a246c9d248 upstream. + +Right now QEMU is importing arch/x86/include/uapi/asm/kvm_para.h +because it includes definitions for kvmclock and for KVM CPUID +bits. However, other definitions for KVM hypercall values and return +codes are included in include/uapi/linux/kvm_para.h and they will be +used by SEV-SNP. + +To ensure that it is possible to include both and +"standard-headers/asm-x86/kvm_para.h" without conflicts, provide +linux/kvm_para.h as a portable header too, and forward linux-headers/ +files to those in include/standard-headers. Note that +will include architecture-specific definitions as well, but +"standard-headers/linux/kvm_para.h" will not because it can be used in +architecture-independent files. + +This could easily be extended to other architectures, but right now +they do not need any symbol in their specific kvm_para.h files. + +Reviewed-by: Thomas Huth +Signed-off-by: Paolo Bonzini +--- + include/standard-headers/linux/kvm_para.h | 38 +++++++++++++++++++++++ + linux-headers/asm-x86/kvm_para.h | 1 + + linux-headers/linux/kvm_para.h | 2 ++ + scripts/update-linux-headers.sh | 22 ++++++++++++- + 4 files changed, 62 insertions(+), 1 deletion(-) + create mode 100644 include/standard-headers/linux/kvm_para.h + create mode 100644 linux-headers/asm-x86/kvm_para.h + create mode 100644 linux-headers/linux/kvm_para.h + +diff --git a/include/standard-headers/linux/kvm_para.h b/include/standard-headers/linux/kvm_para.h +new file mode 100644 +index 0000000000..015c166302 +--- /dev/null ++++ b/include/standard-headers/linux/kvm_para.h +@@ -0,0 +1,38 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef __LINUX_KVM_PARA_H ++#define __LINUX_KVM_PARA_H ++ ++/* ++ * This header file provides a method for making a hypercall to the host ++ * Architectures should define: ++ * - kvm_hypercall0, kvm_hypercall1... ++ * - kvm_arch_para_features ++ * - kvm_para_available ++ */ ++ ++/* Return values for hypercalls */ ++#define KVM_ENOSYS 1000 ++#define KVM_EFAULT EFAULT ++#define KVM_EINVAL EINVAL ++#define KVM_E2BIG E2BIG ++#define KVM_EPERM EPERM ++#define KVM_EOPNOTSUPP 95 ++ ++#define KVM_HC_VAPIC_POLL_IRQ 1 ++#define KVM_HC_MMU_OP 2 ++#define KVM_HC_FEATURES 3 ++#define KVM_HC_PPC_MAP_MAGIC_PAGE 4 ++#define KVM_HC_KICK_CPU 5 ++#define KVM_HC_MIPS_GET_CLOCK_FREQ 6 ++#define KVM_HC_MIPS_EXIT_VM 7 ++#define KVM_HC_MIPS_CONSOLE_OUTPUT 8 ++#define KVM_HC_CLOCK_PAIRING 9 ++#define KVM_HC_SEND_IPI 10 ++#define KVM_HC_SCHED_YIELD 11 ++#define KVM_HC_MAP_GPA_RANGE 12 ++ ++/* ++ * hypercalls use architecture specific ++ */ ++ ++#endif /* __LINUX_KVM_PARA_H */ +diff --git a/linux-headers/asm-x86/kvm_para.h b/linux-headers/asm-x86/kvm_para.h +new file mode 100644 +index 0000000000..1d3e0e0b07 +--- /dev/null ++++ b/linux-headers/asm-x86/kvm_para.h +@@ -0,0 +1 @@ ++#include "standard-headers/asm-x86/kvm_para.h" +diff --git a/linux-headers/linux/kvm_para.h b/linux-headers/linux/kvm_para.h +new file mode 100644 +index 0000000000..6a1e672259 +--- /dev/null ++++ b/linux-headers/linux/kvm_para.h +@@ -0,0 +1,2 @@ ++#include "standard-headers/linux/kvm_para.h" ++#include +diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh +index 87fabf38df..e50d0844bf 100755 +--- a/scripts/update-linux-headers.sh ++++ b/scripts/update-linux-headers.sh +@@ -64,6 +64,7 @@ cp_portable() { + -e 'linux/kernel' \ + -e 'linux/sysinfo' \ + -e 'asm/setup_data.h' \ ++ -e 'asm/kvm_para.h' \ + > /dev/null + then + echo "Unexpected #include in input file $f". +@@ -71,6 +72,15 @@ cp_portable() { + fi + + header=$(basename "$f"); ++ ++ if test -z "$arch"; then ++ # Let users of include/standard-headers/linux/ headers pick the ++ # asm-* header that they care about ++ arch_cmd='/]*\)>/d' ++ else ++ arch_cmd='s/]*\)>/"standard-headers\/asm-'$arch'\/\1"/' ++ fi ++ + sed -e 's/__aligned_u64/__u64 __attribute__((aligned(8)))/g' \ + -e 's/__u\([0-9][0-9]*\)/uint\1_t/g' \ + -e 's/u\([0-9][0-9]*\)/uint\1_t/g' \ +@@ -79,7 +89,7 @@ cp_portable() { + -e 's/__be\([0-9][0-9]*\)/uint\1_t/g' \ + -e 's/"\(input-event-codes\.h\)"/"standard-headers\/linux\/\1"/' \ + -e 's/]*\)>/"standard-headers\/linux\/\1"/' \ +- -e 's/]*\)>/"standard-headers\/asm-'$arch'\/\1"/' \ ++ -e "$arch_cmd" \ + -e 's/__bitwise//' \ + -e 's/__attribute__((packed))/QEMU_PACKED/' \ + -e 's/__inline__/inline/' \ +@@ -159,7 +169,12 @@ EOF + cp "$hdrdir/include/asm/unistd_32.h" "$output/linux-headers/asm-x86/" + cp "$hdrdir/include/asm/unistd_x32.h" "$output/linux-headers/asm-x86/" + cp "$hdrdir/include/asm/unistd_64.h" "$output/linux-headers/asm-x86/" ++ + cp_portable "$hdrdir/include/asm/kvm_para.h" "$output/include/standard-headers/asm-$arch" ++ cat <$output/linux-headers/asm-$arch/kvm_para.h ++#include "standard-headers/asm-$arch/kvm_para.h" ++EOF ++ + # Remove everything except the macros from bootparam.h avoiding the + # unnecessary import of several video/ist/etc headers + sed -e '/__ASSEMBLY__/,/__ASSEMBLY__/d' \ +@@ -213,6 +228,10 @@ if [ -d "$linux/LICENSES" ]; then + done + fi + ++cat <$output/linux-headers/linux/kvm_para.h ++#include "standard-headers/linux/kvm_para.h" ++#include ++EOF + cat <$output/linux-headers/linux/virtio_config.h + #include "standard-headers/linux/virtio_config.h" + EOF +@@ -235,6 +254,7 @@ for i in "$hdrdir"/include/linux/*virtio*.h \ + "$hdrdir/include/linux/ethtool.h" \ + "$hdrdir/include/linux/const.h" \ + "$hdrdir/include/linux/kernel.h" \ ++ "$hdrdir/include/linux/kvm_para.h" \ + "$hdrdir/include/linux/vhost_types.h" \ + "$hdrdir/include/linux/sysinfo.h"; do + cp_portable "$i" "$output/include/standard-headers/linux" +-- +2.39.3 + diff --git a/0465-meson-fix-type-of-relocatable-option.patch b/0465-meson-fix-type-of-relocatable-option.patch new file mode 100644 index 0000000..9e8a683 --- /dev/null +++ b/0465-meson-fix-type-of-relocatable-option.patch @@ -0,0 +1,29 @@ +From 2edb62e006ca7d76ca4703f1ede9b50aa3c48a5e Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Wed, 13 Dec 2023 11:30:09 +0100 +Subject: [PATCH] meson: fix type of "relocatable" option + +Since the option is of boolean type, the default value should be a boolean +rather than a string. + +Signed-off-by: Paolo Bonzini +--- + meson_options.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson_options.txt b/meson_options.txt +index 6a2d8351fd..df2ec63218 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -101,7 +101,7 @@ option('cfi_debug', type: 'boolean', value: false, + description: 'Verbose errors in case of CFI violation') + option('multiprocess', type: 'feature', value: 'auto', + description: 'Out of process device emulation support') +-option('relocatable', type : 'boolean', value : 'true', ++option('relocatable', type : 'boolean', value : true, + description: 'toggle relocatable install') + option('vfio_user_server', type: 'feature', value: 'disabled', + description: 'vfio-user server support') +-- +2.39.3 + diff --git a/0466-makefile-clean-qemu-iotests-output.patch b/0466-makefile-clean-qemu-iotests-output.patch new file mode 100644 index 0000000..79a4d34 --- /dev/null +++ b/0466-makefile-clean-qemu-iotests-output.patch @@ -0,0 +1,39 @@ +From 315ccd8afa7c9572ff7f5b3611d1da920fc258f6 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 3 Nov 2023 10:00:04 +0100 +Subject: [PATCH] Makefile: clean qemu-iotests output + +Signed-off-by: Paolo Bonzini +--- + Makefile | 1 + + configure | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 676a4a54f4..8f36990335 100644 +--- a/Makefile ++++ b/Makefile +@@ -202,6 +202,7 @@ clean: recurse-clean + ! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \ + -exec rm {} + + rm -f TAGS cscope.* *~ */*~ ++ @$(MAKE) -Ctests/qemu-iotests clean + + VERSION = $(shell cat $(SRC_PATH)/VERSION) + +diff --git a/configure b/configure +index 10d8824974..aaf68faf6e 100755 +--- a/configure ++++ b/configure +@@ -1574,7 +1574,7 @@ LINKS="$LINKS pc-bios/s390-ccw/Makefile" + LINKS="$LINKS pc-bios/vof/Makefile" + LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit + LINKS="$LINKS tests/avocado tests/data" +-LINKS="$LINKS tests/qemu-iotests/check" ++LINKS="$LINKS tests/qemu-iotests/check tests/qemu-iotests/Makefile" + LINKS="$LINKS python" + LINKS="$LINKS contrib/plugins/Makefile " + for f in $LINKS ; do +-- +2.39.3 + diff --git a/0467-configure-remove-unnecessary-subshell.patch b/0467-configure-remove-unnecessary-subshell.patch new file mode 100644 index 0000000..1b59575 --- /dev/null +++ b/0467-configure-remove-unnecessary-subshell.patch @@ -0,0 +1,47 @@ +From 8e17dc1767179c65cbe063e959ab65c9ec7629ed Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 3 Nov 2023 10:06:08 +0100 +Subject: [PATCH] configure: remove unnecessary subshell +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Do not use a subshell to hide the shadowing of $config_host_mak. + +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Paolo Bonzini +--- + configure | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/configure b/configure +index aaf68faf6e..88dd116687 100755 +--- a/configure ++++ b/configure +@@ -1686,10 +1686,9 @@ if test "$targetos" = windows; then + fi + + # tests/tcg configuration +-(config_host_mak=tests/tcg/config-host.mak + mkdir -p tests/tcg +-echo "# Automatically generated by configure - do not modify" > $config_host_mak +-echo "SRC_PATH=$source_path" >> $config_host_mak ++echo "# Automatically generated by configure - do not modify" > tests/tcg/$config_host_mak ++echo "SRC_PATH=$source_path" >> tests/tcg/$config_host_mak + if test "$plugins" = "yes" ; then + echo "CONFIG_PLUGIN=y" >> tests/tcg/$config_host_mak + fi +@@ -1735,9 +1734,8 @@ for target in $target_list; do + done + + if test "$tcg" = "enabled"; then +- echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> config-host.mak ++ echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak + fi +-) + + if test "$skip_meson" = no; then + cross="config-meson.cross.new" +-- +2.39.3 + diff --git a/0468-configure-unify-again-the-case-arms-in-probe-target-.patch b/0468-configure-unify-again-the-case-arms-in-probe-target-.patch new file mode 100644 index 0000000..a64c4d1 --- /dev/null +++ b/0468-configure-unify-again-the-case-arms-in-probe-target-.patch @@ -0,0 +1,165 @@ +From 6f6e767717cb46d2aee9915c0b11ba62539ac198 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 3 Nov 2023 09:48:21 +0100 +Subject: [PATCH] configure: unify again the case arms in probe_target_compiler + +Remove assignments that match the default, and group the +targets for debian-legacy-test-cross and debian-all-test-cross +into a single arm. + +Signed-off-by: Paolo Bonzini +--- + configure | 87 ++++++++++++++++++------------------------------------- + 1 file changed, 28 insertions(+), 59 deletions(-) + +diff --git a/configure b/configure +index 88dd116687..aa088b65f1 100755 +--- a/configure ++++ b/configure +@@ -1246,6 +1246,7 @@ probe_target_compiler() { + got_cross_cc=no + container_image= + container_hosts= ++ container_cross_prefix= + container_cross_cc= + container_cross_ar= + container_cross_as= +@@ -1287,16 +1288,33 @@ probe_target_compiler() { + test "$container" != no || continue + test "$host" = "$cpu" || continue + case $target_arch in ++ # debian-all-test-cross architectures ++ ++ hppa|m68k|mips|riscv64|sparc64) ++ container_image=debian-all-test-cross ++ ;; ++ mips64) ++ container_image=debian-all-test-cross ++ container_cross_prefix=mips64-linux-gnuabi64- ++ ;; ++ ppc|ppc64|ppc64le) ++ container_image=debian-all-test-cross ++ container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu- ++ ;; ++ ++ # debian-legacy-test-cross architectures (need Debian 11) ++ # - libc6.1-dev-alpha-cross: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054412 ++ # - sh4-linux-user: binaries don't run with bookworm compiler ++ ++ alpha|sh4) ++ container_image=debian-legacy-test-cross ++ ;; ++ ++ # architectures with individual containers ++ + aarch64) + # We don't have any bigendian build tools so we only use this for AArch64 + container_image=debian-arm64-cross +- container_cross_prefix=aarch64-linux-gnu- +- container_cross_cc=${container_cross_prefix}gcc +- ;; +- alpha) +- container_image=debian-legacy-test-cross +- container_cross_prefix=alpha-linux-gnu- +- container_cross_cc=${container_cross_prefix}gcc + ;; + arm) + # We don't have any bigendian build tools so we only use this for ARM +@@ -1305,18 +1323,11 @@ probe_target_compiler() { + ;; + cris) + container_image=fedora-cris-cross +- container_cross_prefix=cris-linux-gnu- + ;; + hexagon) +- container_image=debian-hexagon-cross + container_cross_prefix=hexagon-unknown-linux-musl- + container_cross_cc=${container_cross_prefix}clang + ;; +- hppa) +- container_image=debian-all-test-cross +- container_cross_prefix=hppa-linux-gnu- +- container_cross_cc=${container_cross_prefix}gcc +- ;; + i386) + container_image=debian-i686-cross + container_cross_prefix=i686-linux-gnu- +@@ -1325,59 +1336,19 @@ probe_target_compiler() { + container_image=debian-loongarch-cross + container_cross_prefix=loongarch64-unknown-linux-gnu- + ;; +- m68k) +- container_image=debian-all-test-cross +- container_cross_prefix=m68k-linux-gnu- +- container_cross_cc=${container_cross_prefix}gcc +- ;; + microblaze) +- container_image=debian-microblaze-cross + container_cross_prefix=microblaze-linux-musl- + ;; + mips64el) + container_image=debian-mips64el-cross + container_cross_prefix=mips64el-linux-gnuabi64- + ;; +- mips64) +- container_image=debian-all-test-cross +- container_cross_prefix=mips64-linux-gnuabi64- +- ;; +- mips) +- container_image=debian-all-test-cross +- container_cross_prefix=mips-linux-gnu- +- ;; +- nios2) +- container_image=debian-nios2-cross +- container_cross_prefix=nios2-linux-gnu- +- ;; +- ppc) +- container_image=debian-all-test-cross +- container_cross_prefix=powerpc-linux-gnu- +- container_cross_cc=${container_cross_prefix}gcc +- ;; +- ppc64|ppc64le) +- container_image=debian-all-test-cross +- container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu- +- ;; +- riscv64) +- container_image=debian-all-test-cross +- container_cross_prefix=riscv64-linux-gnu- +- ;; +- sh4) +- container_image=debian-legacy-test-cross +- container_cross_prefix=sh4-linux-gnu- +- ;; +- sparc64) +- container_image=debian-all-test-cross +- container_cross_prefix=sparc64-linux-gnu- +- ;; + tricore) + container_image=debian-tricore-cross + container_cross_prefix=tricore- + ;; + x86_64) + container_image=debian-amd64-cross +- container_cross_prefix=x86_64-linux-gnu- + ;; + xtensa*) + container_image=debian-xtensa-cross +@@ -1385,12 +1356,10 @@ probe_target_compiler() { + # default to the dc232b cpu + container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf- + ;; +- *) +- # Debian and GNU architecture names usually match +- container_image=debian-$target_arch-cross +- container_cross_prefix=$target_arch-linux-gnu- +- ;; + esac ++ # Debian and GNU architecture names usually match ++ : ${container_image:=debian-$target_arch-cross} ++ : ${container_cross_prefix:=$target_arch-linux-gnu-} + : ${container_cross_cc:=${container_cross_prefix}gcc} + : ${container_cross_ar:=${container_cross_prefix}ar} + : ${container_cross_as:=${container_cross_prefix}as} +-- +2.39.3 + diff --git a/0469-meson-add-more-sections-to-main-meson-build.patch b/0469-meson-add-more-sections-to-main-meson-build.patch new file mode 100644 index 0000000..04edf70 --- /dev/null +++ b/0469-meson-add-more-sections-to-main-meson-build.patch @@ -0,0 +1,75 @@ +From 0f66b1f3439f86d02da46af4da1109c504e2577e Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 8 Sep 2023 12:06:12 +0200 +Subject: [PATCH] meson: add more sections to main meson.build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Paolo Bonzini +--- + meson.build | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/meson.build b/meson.build +index 273a894147..6ea5469e89 100644 +--- a/meson.build ++++ b/meson.build +@@ -9,6 +9,10 @@ add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough']) + + meson.add_postconf_script(find_program('scripts/symlink-install-tree.py')) + ++#################### ++# Global variables # ++#################### ++ + not_found = dependency('', required: false) + keyval = import('keyval') + ss = import('sourceset') +@@ -90,8 +94,16 @@ enable_modules = get_option('modules') \ + .allowed() + have_block = have_system or have_tools + ++############ ++# Programs # ++############ ++ + python = import('python').find_installation() + ++####################################### ++# Variables for host and accelerators # ++####################################### ++ + if cpu not in supported_cpus + host_arch = 'unknown' + elif cpu == 'x86' +@@ -526,9 +538,9 @@ if sparse.found() + '-Wno-non-pointer-null']) + endif + +-########################################### +-# Target-specific checks and dependencies # +-########################################### ++##################### ++# Option validation # ++##################### + + # Fuzzing + if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \ +@@ -3552,9 +3564,9 @@ specific_ss.add_all(when: 'CONFIG_TCG_BUILTIN', if_true: tcg_module_ss) + target_modules += { 'accel' : { 'qtest': qtest_module_ss, + 'tcg': tcg_real_module_ss }} + +-######################## +-# Library dependencies # +-######################## ++############################################## ++# Internal static_libraries and dependencies # ++############################################## + + modinfo_collect = find_program('scripts/modinfo-collect.py') + modinfo_generate = find_program('scripts/modinfo-generate.py') +-- +2.39.3 + diff --git a/0470-meson-move-program-checks-together.patch b/0470-meson-move-program-checks-together.patch new file mode 100644 index 0000000..00ed184 --- /dev/null +++ b/0470-meson-move-program-checks-together.patch @@ -0,0 +1,158 @@ +From 6915c8f9dc180de3ded34af9a166c7b2d11e9c57 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 8 Sep 2023 12:06:57 +0200 +Subject: [PATCH] meson: move program checks together +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Paolo Bonzini +--- + meson.build | 107 +++++++++++++++++++++++++++------------------------- + 1 file changed, 56 insertions(+), 51 deletions(-) + +diff --git a/meson.build b/meson.build +index 6ea5469e89..c5e41f4951 100644 +--- a/meson.build ++++ b/meson.build +@@ -19,21 +19,8 @@ ss = import('sourceset') + fs = import('fs') + + targetos = host_machine.system() +-sh = find_program('sh') + config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') + +-cc = meson.get_compiler('c') +-all_languages = ['c'] +-if targetos == 'windows' and add_languages('cpp', required: false, native: false) +- all_languages += ['cpp'] +- cxx = meson.get_compiler('cpp') +-endif +-if targetos == 'darwin' and \ +- add_languages('objc', required: get_option('cocoa'), native: false) +- all_languages += ['objc'] +- objc = meson.get_compiler('objc') +-endif +- + # Temporary directory used for files created while + # configure runs. Since it is in the build directory + # we can safely blow away any previous version of it +@@ -69,6 +56,62 @@ if cpu == 'sw_64' + endif + + target_dirs = config_host['TARGET_DIRS'].split() ++ ++############ ++# Programs # ++############ ++ ++sh = find_program('sh') ++python = import('python').find_installation() ++ ++cc = meson.get_compiler('c') ++all_languages = ['c'] ++if targetos == 'windows' and add_languages('cpp', required: false, native: false) ++ all_languages += ['cpp'] ++ cxx = meson.get_compiler('cpp') ++endif ++if targetos == 'darwin' and \ ++ add_languages('objc', required: get_option('cocoa'), native: false) ++ all_languages += ['objc'] ++ objc = meson.get_compiler('objc') ++endif ++ ++dtrace = not_found ++stap = not_found ++if 'dtrace' in get_option('trace_backends') ++ dtrace = find_program('dtrace', required: true) ++ stap = find_program('stap', required: false) ++ if stap.found() ++ # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol ++ # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility ++ # instead. QEMU --enable-modules depends on this because the SystemTap ++ # semaphores are linked into the main binary and not the module's shared ++ # object. ++ add_global_arguments('-DSTAP_SDT_V2', ++ native: false, language: all_languages) ++ endif ++endif ++ ++if get_option('iasl') == '' ++ iasl = find_program('iasl', required: false) ++else ++ iasl = find_program(get_option('iasl'), required: true) ++endif ++ ++edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ] ++unpack_edk2_blobs = false ++foreach target : edk2_targets ++ if target in target_dirs ++ bzip2 = find_program('bzip2', required: get_option('install_blobs')) ++ unpack_edk2_blobs = bzip2.found() ++ break ++ endif ++endforeach ++ ++##################### ++# Option validation # ++##################### ++ + have_linux_user = false + have_bsd_user = false + have_system = false +@@ -94,12 +137,6 @@ enable_modules = get_option('modules') \ + .allowed() + have_block = have_system or have_tools + +-############ +-# Programs # +-############ +- +-python = import('python').find_installation() +- + ####################################### + # Variables for host and accelerators # + ####################################### +@@ -175,38 +212,6 @@ if targetos != 'darwin' + modular_tcg = ['i386-softmmu', 'x86_64-softmmu'] + endif + +-edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ] +-unpack_edk2_blobs = false +-foreach target : edk2_targets +- if target in target_dirs +- bzip2 = find_program('bzip2', required: get_option('install_blobs')) +- unpack_edk2_blobs = bzip2.found() +- break +- endif +-endforeach +- +-dtrace = not_found +-stap = not_found +-if 'dtrace' in get_option('trace_backends') +- dtrace = find_program('dtrace', required: true) +- stap = find_program('stap', required: false) +- if stap.found() +- # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol +- # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility +- # instead. QEMU --enable-modules depends on this because the SystemTap +- # semaphores are linked into the main binary and not the module's shared +- # object. +- add_global_arguments('-DSTAP_SDT_V2', +- native: false, language: all_languages) +- endif +-endif +- +-if get_option('iasl') == '' +- iasl = find_program('iasl', required: false) +-else +- iasl = find_program(get_option('iasl'), required: true) +-endif +- + ################## + # Compiler flags # + ################## +-- +2.39.3 + diff --git a/0471-meson-move-option-validation-together.patch b/0471-meson-move-option-validation-together.patch new file mode 100644 index 0000000..9289a4f --- /dev/null +++ b/0471-meson-move-option-validation-together.patch @@ -0,0 +1,191 @@ +From a57b6c67eea3d488dddbb06c236d104db3bfd324 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Sat, 30 Dec 2023 18:42:30 +0100 +Subject: [PATCH] meson: move option validation together + +Check options before compiler flags, because some compiler flags are +incompatible with modules. + +Signed-off-by: Paolo Bonzini +--- + meson.build | 137 ++++++++++++++++++++++++++-------------------------- + 1 file changed, 68 insertions(+), 69 deletions(-) + +diff --git a/meson.build b/meson.build +index c5e41f4951..753e5e843b 100644 +--- a/meson.build ++++ b/meson.build +@@ -112,6 +112,71 @@ endforeach + # Option validation # + ##################### + ++# Fuzzing ++if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \ ++ not cc.links(''' ++ #include ++ #include ++ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); ++ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } ++ ''', ++ args: ['-Werror', '-fsanitize=fuzzer']) ++ error('Your compiler does not support -fsanitize=fuzzer') ++endif ++ ++# Tracing backends ++if 'ftrace' in get_option('trace_backends') and targetos != 'linux' ++ error('ftrace is supported only on Linux') ++endif ++if 'syslog' in get_option('trace_backends') and not cc.compiles(''' ++ #include ++ int main(void) { ++ openlog("qemu", LOG_PID, LOG_DAEMON); ++ syslog(LOG_INFO, "configure"); ++ return 0; ++ }''') ++ error('syslog is not supported on this system') ++endif ++ ++# Miscellaneous Linux-only features ++get_option('mpath') \ ++ .require(targetos == 'linux', error_message: 'Multipath is supported only on Linux') ++ ++multiprocess_allowed = get_option('multiprocess') \ ++ .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \ ++ .allowed() ++ ++vfio_user_server_allowed = get_option('vfio_user_server') \ ++ .require(targetos == 'linux', error_message: 'vfio-user server is supported only on Linux') \ ++ .allowed() ++ ++have_tpm = get_option('tpm') \ ++ .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \ ++ .allowed() ++ ++# vhost ++have_vhost_user = get_option('vhost_user') \ ++ .disable_auto_if(targetos != 'linux') \ ++ .require(targetos != 'windows', ++ error_message: 'vhost-user is not available on Windows').allowed() ++have_vhost_vdpa = get_option('vhost_vdpa') \ ++ .require(targetos == 'linux', ++ error_message: 'vhost-vdpa is only available on Linux').allowed() ++have_vhost_kernel = get_option('vhost_kernel') \ ++ .require(targetos == 'linux', ++ error_message: 'vhost-kernel is only available on Linux').allowed() ++have_vhost_user_crypto = get_option('vhost_crypto') \ ++ .require(have_vhost_user, ++ error_message: 'vhost-crypto requires vhost-user to be enabled').allowed() ++ ++have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel ++ ++have_vhost_net_user = have_vhost_user and get_option('vhost_net').allowed() ++have_vhost_net_vdpa = have_vhost_vdpa and get_option('vhost_net').allowed() ++have_vhost_net_kernel = have_vhost_kernel and get_option('vhost_net').allowed() ++have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or have_vhost_net_vdpa ++ ++# type of binaries to build + have_linux_user = false + have_bsd_user = false + have_system = false +@@ -121,6 +186,7 @@ foreach target : target_dirs + have_system = have_system or target.endswith('-softmmu') + endforeach + have_user = have_linux_user or have_bsd_user ++ + have_tools = get_option('tools') \ + .disable_auto_if(not have_system) \ + .allowed() +@@ -129,13 +195,14 @@ have_ga = get_option('guest_agent') \ + .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'], + error_message: 'unsupported OS for QEMU guest agent') \ + .allowed() ++have_block = have_system or have_tools ++ + enable_modules = get_option('modules') \ + .require(targetos != 'windows', + error_message: 'Modules are not available for Windows') \ + .require(not get_option('prefer_static'), + error_message: 'Modules are incompatible with static linking') \ + .allowed() +-have_block = have_system or have_tools + + ####################################### + # Variables for host and accelerators # +@@ -543,74 +610,6 @@ if sparse.found() + '-Wno-non-pointer-null']) + endif + +-##################### +-# Option validation # +-##################### +- +-# Fuzzing +-if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \ +- not cc.links(''' +- #include +- #include +- int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); +- int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } +- ''', +- args: ['-Werror', '-fsanitize=fuzzer']) +- error('Your compiler does not support -fsanitize=fuzzer') +-endif +- +-# Tracing backends +-if 'ftrace' in get_option('trace_backends') and targetos != 'linux' +- error('ftrace is supported only on Linux') +-endif +-if 'syslog' in get_option('trace_backends') and not cc.compiles(''' +- #include +- int main(void) { +- openlog("qemu", LOG_PID, LOG_DAEMON); +- syslog(LOG_INFO, "configure"); +- return 0; +- }''') +- error('syslog is not supported on this system') +-endif +- +-# Miscellaneous Linux-only features +-get_option('mpath') \ +- .require(targetos == 'linux', error_message: 'Multipath is supported only on Linux') +- +-multiprocess_allowed = get_option('multiprocess') \ +- .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \ +- .allowed() +- +-vfio_user_server_allowed = get_option('vfio_user_server') \ +- .require(targetos == 'linux', error_message: 'vfio-user server is supported only on Linux') \ +- .allowed() +- +-have_tpm = get_option('tpm') \ +- .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \ +- .allowed() +- +-# vhost +-have_vhost_user = get_option('vhost_user') \ +- .disable_auto_if(targetos != 'linux') \ +- .require(targetos != 'windows', +- error_message: 'vhost-user is not available on Windows').allowed() +-have_vhost_vdpa = get_option('vhost_vdpa') \ +- .require(targetos == 'linux', +- error_message: 'vhost-vdpa is only available on Linux').allowed() +-have_vhost_kernel = get_option('vhost_kernel') \ +- .require(targetos == 'linux', +- error_message: 'vhost-kernel is only available on Linux').allowed() +-have_vhost_user_crypto = get_option('vhost_crypto') \ +- .require(have_vhost_user, +- error_message: 'vhost-crypto requires vhost-user to be enabled').allowed() +- +-have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel +- +-have_vhost_net_user = have_vhost_user and get_option('vhost_net').allowed() +-have_vhost_net_vdpa = have_vhost_vdpa and get_option('vhost_net').allowed() +-have_vhost_net_kernel = have_vhost_kernel and get_option('vhost_net').allowed() +-have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or have_vhost_net_vdpa +- + # Target-specific libraries and flags + libm = cc.find_library('m', required: false) + threads = dependency('threads') +-- +2.39.3 + diff --git a/0472-meson-move-accelerator-dependency-checks-together.patch b/0472-meson-move-accelerator-dependency-checks-together.patch new file mode 100644 index 0000000..593a2d1 --- /dev/null +++ b/0472-meson-move-accelerator-dependency-checks-together.patch @@ -0,0 +1,241 @@ +From 41311a3ca3f9c107a23e5a9effe1617128d49c19 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 8 Sep 2023 12:08:53 +0200 +Subject: [PATCH] meson: move accelerator dependency checks together + +Signed-off-by: Paolo Bonzini +--- + meson.build | 175 +++++++++++++++++++++++++++------------------------- + 1 file changed, 91 insertions(+), 84 deletions(-) + +diff --git a/meson.build b/meson.build +index 753e5e843b..5b1611dd85 100644 +--- a/meson.build ++++ b/meson.build +@@ -610,7 +610,10 @@ if sparse.found() + '-Wno-non-pointer-null']) + endif + +-# Target-specific libraries and flags ++##################################### ++# Host-specific libraries and flags # ++##################################### ++ + libm = cc.find_library('m', required: false) + threads = dependency('threads') + util = cc.find_library('util', required: false) +@@ -620,8 +623,6 @@ version_res = [] + coref = [] + iokit = [] + emulator_link_args = [] +-nvmm =not_found +-hvf = not_found + midl = not_found + widl = not_found + pathcch = not_found +@@ -657,7 +658,10 @@ elif targetos == 'openbsd' + endif + endif + +-# Target-specific configuration of accelerators ++############################################### ++# Host-specific configuration of accelerators # ++############################################### ++ + accelerators = [] + if get_option('kvm').allowed() and targetos == 'linux' + accelerators += 'CONFIG_KVM' +@@ -670,6 +674,8 @@ if get_option('whpx').allowed() and targetos == 'windows' + accelerators += 'CONFIG_WHPX' + endif + endif ++ ++hvf = not_found + if get_option('hvf').allowed() + hvf = dependency('appleframeworks', modules: 'Hypervisor', + required: get_option('hvf')) +@@ -677,6 +683,8 @@ if get_option('hvf').allowed() + accelerators += 'CONFIG_HVF' + endif + endif ++ ++nvmm = not_found + if targetos == 'netbsd' + nvmm = cc.find_library('nvmm', required: get_option('nvmm')) + if nvmm.found() +@@ -726,6 +734,85 @@ if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled() + error('WHPX not available on this platform') + endif + ++xen = not_found ++if get_option('xen').enabled() or (get_option('xen').auto() and have_system) ++ xencontrol = dependency('xencontrol', required: false, ++ method: 'pkg-config') ++ if xencontrol.found() ++ xen_pc = declare_dependency(version: xencontrol.version(), ++ dependencies: [ ++ xencontrol, ++ # disabler: true makes xen_pc.found() return false if any is not found ++ dependency('xenstore', required: false, ++ method: 'pkg-config', ++ disabler: true), ++ dependency('xenforeignmemory', required: false, ++ method: 'pkg-config', ++ disabler: true), ++ dependency('xengnttab', required: false, ++ method: 'pkg-config', ++ disabler: true), ++ dependency('xenevtchn', required: false, ++ method: 'pkg-config', ++ disabler: true), ++ dependency('xendevicemodel', required: false, ++ method: 'pkg-config', ++ disabler: true), ++ # optional, no "disabler: true" ++ dependency('xentoolcore', required: false, ++ method: 'pkg-config')]) ++ if xen_pc.found() ++ xen = xen_pc ++ endif ++ endif ++ if not xen.found() ++ xen_tests = [ '4.11.0', '4.10.0', '4.9.0', '4.8.0', '4.7.1' ] ++ xen_libs = { ++ '4.11.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ], ++ '4.10.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ], ++ '4.9.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ], ++ '4.8.0': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ], ++ '4.7.1': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ], ++ } ++ xen_deps = {} ++ foreach ver: xen_tests ++ # cache the various library tests to avoid polluting the logs ++ xen_test_deps = [] ++ foreach l: xen_libs[ver] ++ if l not in xen_deps ++ xen_deps += { l: cc.find_library(l, required: false) } ++ endif ++ xen_test_deps += xen_deps[l] ++ endforeach ++ ++ # Use -D to pick just one of the test programs in scripts/xen-detect.c ++ xen_version = ver.split('.') ++ xen_ctrl_version = xen_version[0] + \ ++ ('0' + xen_version[1]).substring(-2) + \ ++ ('0' + xen_version[2]).substring(-2) ++ if cc.links(files('scripts/xen-detect.c'), ++ args: '-DCONFIG_XEN_CTRL_INTERFACE_VERSION=' + xen_ctrl_version, ++ dependencies: xen_test_deps) ++ xen = declare_dependency(version: ver, dependencies: xen_test_deps) ++ break ++ endif ++ endforeach ++ endif ++ if xen.found() ++ accelerators += 'CONFIG_XEN' ++ elif get_option('xen').enabled() ++ error('could not compile and link Xen test program') ++ endif ++endif ++have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ ++ .require(xen.found(), ++ error_message: 'Xen PCI passthrough requested but Xen not enabled') \ ++ .require(targetos == 'linux', ++ error_message: 'Xen PCI passthrough not available on this platform') \ ++ .require(cpu == 'x86' or cpu == 'x86_64', ++ error_message: 'Xen PCI passthrough not available on this platform') \ ++ .allowed() ++ + ################ + # Dependencies # + ################ +@@ -1712,86 +1799,6 @@ if not get_option('rdma').auto() or have_system + endforeach + endif + +-xen = not_found +-if get_option('xen').enabled() or (get_option('xen').auto() and have_system) +- xencontrol = dependency('xencontrol', required: false, +- method: 'pkg-config') +- if xencontrol.found() +- xen_pc = declare_dependency(version: xencontrol.version(), +- dependencies: [ +- xencontrol, +- # disabler: true makes xen_pc.found() return false if any is not found +- dependency('xenstore', required: false, +- method: 'pkg-config', +- disabler: true), +- dependency('xenforeignmemory', required: false, +- method: 'pkg-config', +- disabler: true), +- dependency('xengnttab', required: false, +- method: 'pkg-config', +- disabler: true), +- dependency('xenevtchn', required: false, +- method: 'pkg-config', +- disabler: true), +- dependency('xendevicemodel', required: false, +- method: 'pkg-config', +- disabler: true), +- # optional, no "disabler: true" +- dependency('xentoolcore', required: false, +- method: 'pkg-config')]) +- if xen_pc.found() +- xen = xen_pc +- endif +- endif +- if not xen.found() +- xen_tests = [ '4.11.0', '4.10.0', '4.9.0', '4.8.0', '4.7.1' ] +- xen_libs = { +- '4.11.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ], +- '4.10.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ], +- '4.9.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ], +- '4.8.0': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ], +- '4.7.1': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ], +- } +- xen_deps = {} +- foreach ver: xen_tests +- # cache the various library tests to avoid polluting the logs +- xen_test_deps = [] +- foreach l: xen_libs[ver] +- if l not in xen_deps +- xen_deps += { l: cc.find_library(l, required: false) } +- endif +- xen_test_deps += xen_deps[l] +- endforeach +- +- # Use -D to pick just one of the test programs in scripts/xen-detect.c +- xen_version = ver.split('.') +- xen_ctrl_version = xen_version[0] + \ +- ('0' + xen_version[1]).substring(-2) + \ +- ('0' + xen_version[2]).substring(-2) +- if cc.links(files('scripts/xen-detect.c'), +- args: '-DCONFIG_XEN_CTRL_INTERFACE_VERSION=' + xen_ctrl_version, +- dependencies: xen_test_deps) +- xen = declare_dependency(version: ver, dependencies: xen_test_deps) +- break +- endif +- endforeach +- endif +- if xen.found() +- accelerators += 'CONFIG_XEN' +- elif get_option('xen').enabled() +- error('could not compile and link Xen test program') +- endif +-endif +-have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ +- .require(xen.found(), +- error_message: 'Xen PCI passthrough requested but Xen not enabled') \ +- .require(targetos == 'linux', +- error_message: 'Xen PCI passthrough not available on this platform') \ +- .require(cpu == 'x86' or cpu == 'x86_64', +- error_message: 'Xen PCI passthrough not available on this platform') \ +- .allowed() +- +- + cacard = not_found + if not get_option('smartcard').auto() or have_system + cacard = dependency('libcacard', required: get_option('smartcard'), +-- +2.39.3 + diff --git a/0473-meson-keep-subprojects-together.patch b/0473-meson-keep-subprojects-together.patch new file mode 100644 index 0000000..f99cbe6 --- /dev/null +++ b/0473-meson-keep-subprojects-together.patch @@ -0,0 +1,134 @@ +From 85dc8c41629f2f972a32ef41cc0101f74bdc7264 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 8 Sep 2023 12:09:22 +0200 +Subject: [PATCH] meson: keep subprojects together + +And move away dependencies that are not subprojects anymore. + +Signed-off-by: Paolo Bonzini +--- + meson.build | 72 ++++++++++++++++++++++++++--------------------------- + 1 file changed, 36 insertions(+), 36 deletions(-) + +diff --git a/meson.build b/meson.build +index 5b1611dd85..7207348f8d 100644 +--- a/meson.build ++++ b/meson.build +@@ -1645,6 +1645,25 @@ if not gnutls_crypto.found() + endif + endif + ++capstone = not_found ++if not get_option('capstone').auto() or have_system or have_user ++ capstone = dependency('capstone', version: '>=3.0.5', ++ method: 'pkg-config', ++ required: get_option('capstone')) ++ ++ # Some versions of capstone have broken pkg-config file ++ # that reports a wrong -I path, causing the #include to ++ # fail later. If the system has such a broken version ++ # do not use it. ++ if capstone.found() and not cc.compiles('#include ', ++ dependencies: [capstone]) ++ capstone = not_found ++ if get_option('capstone').enabled() ++ error('capstone requested, but it does not appear to work') ++ endif ++ endif ++endif ++ + gmp = dependency('gmp', required: false, method: 'pkg-config') + if nettle.found() and gmp.found() + hogweed = dependency('hogweed', version: '>=3.4', +@@ -2150,6 +2169,7 @@ config_host_data.set('CONFIG_ATTR', libattr.found()) + config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools')) + config_host_data.set('CONFIG_BRLAPI', brlapi.found()) + config_host_data.set('CONFIG_BSD', targetos in bsd_oses) ++config_host_data.set('CONFIG_CAPSTONE', capstone.found()) + config_host_data.set('CONFIG_COCOA', cocoa.found()) + config_host_data.set('CONFIG_DARWIN', targetos == 'darwin') + config_host_data.set('CONFIG_FUZZ', get_option('fuzzing')) +@@ -2213,6 +2233,7 @@ if seccomp.found() + config_host_data.set('CONFIG_SECCOMP_SYSRAWRC', seccomp_has_sysrawrc) + endif + config_host_data.set('CONFIG_PIXMAN', pixman.found()) ++config_host_data.set('CONFIG_SLIRP', slirp.found()) + config_host_data.set('CONFIG_SNAPPY', snappy.found()) + config_host_data.set('CONFIG_SOLARIS', targetos == 'sunos') + if get_option('tcg').allowed() +@@ -3119,28 +3140,9 @@ genh += custom_target('config-poison.h', + command: [find_program('scripts/make-config-poison.sh'), + target_configs_h]) + +-############## +-# Submodules # +-############## +- +-capstone = not_found +-if not get_option('capstone').auto() or have_system or have_user +- capstone = dependency('capstone', version: '>=3.0.5', +- method: 'pkg-config', +- required: get_option('capstone')) +- +- # Some versions of capstone have broken pkg-config file +- # that reports a wrong -I path, causing the #include to +- # fail later. If the system has such a broken version +- # do not use it. +- if capstone.found() and not cc.compiles('#include ', +- dependencies: [capstone]) +- capstone = not_found +- if get_option('capstone').enabled() +- error('capstone requested, but it does not appear to work') +- endif +- endif +-endif ++############### ++# Subprojects # ++############### + + libvfio_user_dep = not_found + if have_system and vfio_user_server_allowed +@@ -3184,9 +3186,19 @@ else + fdt_opt = 'disabled' + endif + +-config_host_data.set('CONFIG_CAPSTONE', capstone.found()) + config_host_data.set('CONFIG_FDT', fdt.found()) +-config_host_data.set('CONFIG_SLIRP', slirp.found()) ++ ++vhost_user = not_found ++if targetos == 'linux' and have_vhost_user ++ libvhost_user = subproject('libvhost-user') ++ vhost_user = libvhost_user.get_variable('vhost_user_dep') ++endif ++ ++libvduse = not_found ++if have_libvduse ++ libvduse_proj = subproject('libvduse') ++ libvduse = libvduse_proj.get_variable('libvduse_dep') ++endif + + ##################### + # Generated sources # +@@ -3419,18 +3431,6 @@ if have_system or have_user + ] + endif + +-vhost_user = not_found +-if targetos == 'linux' and have_vhost_user +- libvhost_user = subproject('libvhost-user') +- vhost_user = libvhost_user.get_variable('vhost_user_dep') +-endif +- +-libvduse = not_found +-if have_libvduse +- libvduse_proj = subproject('libvduse') +- libvduse = libvduse_proj.get_variable('libvduse_dep') +-endif +- + # NOTE: the trace/ subdirectory needs the qapi_trace_events variable + # that is filled in by qapi/. + subdir('qapi') +-- +2.39.3 + diff --git a/0474-meson-move-cfi-detection-code-with-other-compiler-fl.patch b/0474-meson-move-cfi-detection-code-with-other-compiler-fl.patch new file mode 100644 index 0000000..6495038 --- /dev/null +++ b/0474-meson-move-cfi-detection-code-with-other-compiler-fl.patch @@ -0,0 +1,117 @@ +From 8f40c6fa024c46043dcdbf9d66013f39c84d0ac1 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Wed, 10 May 2023 14:54:30 +0200 +Subject: [PATCH] meson: move CFI detection code with other compiler flags +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Keep it together with the other compiler modes, and before dependencies. + +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Paolo Bonzini +--- + meson.build | 80 ++++++++++++++++++++++++++--------------------------- + 1 file changed, 40 insertions(+), 40 deletions(-) + +diff --git a/meson.build b/meson.build +index 7207348f8d..598ec79f8c 100644 +--- a/meson.build ++++ b/meson.build +@@ -525,6 +525,46 @@ if get_option('fuzzing') + endif + endif + ++if get_option('cfi') ++ cfi_flags=[] ++ # Check for dependency on LTO ++ if not get_option('b_lto') ++ error('Selected Control-Flow Integrity but LTO is disabled') ++ endif ++ if enable_modules ++ error('Selected Control-Flow Integrity is not compatible with modules') ++ endif ++ # Check for cfi flags. CFI requires LTO so we can't use ++ # get_supported_arguments, but need a more complex "compiles" which allows ++ # custom arguments ++ if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall', ++ args: ['-flto', '-fsanitize=cfi-icall'] ) ++ cfi_flags += '-fsanitize=cfi-icall' ++ else ++ error('-fsanitize=cfi-icall is not supported by the compiler') ++ endif ++ if cc.compiles('int main () { return 0; }', ++ name: '-fsanitize-cfi-icall-generalize-pointers', ++ args: ['-flto', '-fsanitize=cfi-icall', ++ '-fsanitize-cfi-icall-generalize-pointers'] ) ++ cfi_flags += '-fsanitize-cfi-icall-generalize-pointers' ++ else ++ error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler') ++ endif ++ if get_option('cfi_debug') ++ if cc.compiles('int main () { return 0; }', ++ name: '-fno-sanitize-trap=cfi-icall', ++ args: ['-flto', '-fsanitize=cfi-icall', ++ '-fno-sanitize-trap=cfi-icall'] ) ++ cfi_flags += '-fno-sanitize-trap=cfi-icall' ++ else ++ error('-fno-sanitize-trap=cfi-icall is not supported by the compiler') ++ endif ++ endif ++ add_global_arguments(cfi_flags, native: false, language: all_languages) ++ add_global_link_arguments(cfi_flags, native: false, language: all_languages) ++endif ++ + add_global_arguments(qemu_common_flags, native: false, language: all_languages) + add_global_link_arguments(qemu_ldflags, native: false, language: all_languages) + +@@ -2032,46 +2072,6 @@ endif + config_host_data.set('CONFIG_AUDIO_DRIVERS', + '"' + '", "'.join(audio_drivers_selected) + '", ') + +-if get_option('cfi') +- cfi_flags=[] +- # Check for dependency on LTO +- if not get_option('b_lto') +- error('Selected Control-Flow Integrity but LTO is disabled') +- endif +- if enable_modules +- error('Selected Control-Flow Integrity is not compatible with modules') +- endif +- # Check for cfi flags. CFI requires LTO so we can't use +- # get_supported_arguments, but need a more complex "compiles" which allows +- # custom arguments +- if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall', +- args: ['-flto', '-fsanitize=cfi-icall'] ) +- cfi_flags += '-fsanitize=cfi-icall' +- else +- error('-fsanitize=cfi-icall is not supported by the compiler') +- endif +- if cc.compiles('int main () { return 0; }', +- name: '-fsanitize-cfi-icall-generalize-pointers', +- args: ['-flto', '-fsanitize=cfi-icall', +- '-fsanitize-cfi-icall-generalize-pointers'] ) +- cfi_flags += '-fsanitize-cfi-icall-generalize-pointers' +- else +- error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler') +- endif +- if get_option('cfi_debug') +- if cc.compiles('int main () { return 0; }', +- name: '-fno-sanitize-trap=cfi-icall', +- args: ['-flto', '-fsanitize=cfi-icall', +- '-fno-sanitize-trap=cfi-icall'] ) +- cfi_flags += '-fno-sanitize-trap=cfi-icall' +- else +- error('-fno-sanitize-trap=cfi-icall is not supported by the compiler') +- endif +- endif +- add_global_arguments(cfi_flags, native: false, language: all_languages) +- add_global_link_arguments(cfi_flags, native: false, language: all_languages) +-endif +- + have_host_block_device = (targetos != 'darwin' or + cc.has_header('IOKit/storage/IOMedia.h')) + +-- +2.39.3 + diff --git a/0475-meson-move-config-host-h-definitions-together.patch b/0475-meson-move-config-host-h-definitions-together.patch new file mode 100644 index 0000000..33ffe5a --- /dev/null +++ b/0475-meson-move-config-host-h-definitions-together.patch @@ -0,0 +1,86 @@ +From 93765a87fe89fd1e5379659d80b79dc8598a6756 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 8 Sep 2023 12:10:08 +0200 +Subject: [PATCH] meson: move config-host.h definitions together + +Signed-off-by: Paolo Bonzini +--- + meson.build | 27 ++++++++++++++------------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +diff --git a/meson.build b/meson.build +index 598ec79f8c..315e3466fd 100644 +--- a/meson.build ++++ b/meson.build +@@ -40,7 +40,6 @@ qemu_moddir = get_option('libdir') / get_option('qemu_suffix') + qemu_desktopdir = get_option('datadir') / 'applications' + qemu_icondir = get_option('datadir') / 'icons' + +-config_host_data = configuration_data() + genh = [] + qapi_trace_events = [] + +@@ -241,12 +240,6 @@ elif cpu in ['sw64'] + else + kvm_targets = [] + endif +- +-kvm_targets_c = '""' +-if get_option('kvm').allowed() and targetos == 'linux' +- kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"' +-endif +-config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) + accelerator_targets = { 'CONFIG_KVM': kvm_targets } + + if cpu in ['x86', 'x86_64'] +@@ -1214,12 +1207,6 @@ if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu + virgl = dependency('virglrenderer', + method: 'pkg-config', + required: get_option('virglrenderer')) +- if virgl.found() +- config_host_data.set('HAVE_VIRGL_D3D_INFO_EXT', +- cc.has_member('struct virgl_renderer_resource_info_ext', 'd3d_tex2d', +- prefix: '#include ', +- dependencies: virgl)) +- endif + endif + rutabaga = not_found + if not get_option('rutabaga_gfx').auto() or have_system or have_vhost_user_gpu +@@ -2031,6 +2018,8 @@ endif + # config-host.h # + ################# + ++config_host_data = configuration_data() ++ + audio_drivers_selected = [] + if have_system + audio_drivers_available = { +@@ -2160,6 +2149,12 @@ endif + + config_host_data.set('HOST_' + host_arch.to_upper(), 1) + ++kvm_targets_c = '""' ++if get_option('kvm').allowed() and targetos == 'linux' ++ kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"' ++endif ++config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) ++ + if get_option('module_upgrades') and not enable_modules + error('Cannot enable module-upgrades as modules are not enabled') + endif +@@ -2259,6 +2254,12 @@ config_host_data.set('CONFIG_PNG', png.found()) + config_host_data.set('CONFIG_VNC', vnc.found()) + config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) + config_host_data.set('CONFIG_VNC_SASL', sasl.found()) ++if virgl.found() ++ config_host_data.set('HAVE_VIRGL_D3D_INFO_EXT', ++ cc.has_member('struct virgl_renderer_resource_info_ext', 'd3d_tex2d', ++ prefix: '#include ', ++ dependencies: virgl)) ++endif + config_host_data.set('CONFIG_VIRTFS', have_virtfs) + config_host_data.set('CONFIG_VTE', vte.found()) + config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) +-- +2.39.3 + diff --git a/0476-meson-move-subdirs-to-collect-sources-section.patch b/0476-meson-move-subdirs-to-collect-sources-section.patch new file mode 100644 index 0000000..a74cf0f --- /dev/null +++ b/0476-meson-move-subdirs-to-collect-sources-section.patch @@ -0,0 +1,101 @@ +From bce2095b2c8c9738fc23d085685e401dc9728380 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 3 Nov 2023 09:33:57 +0100 +Subject: [PATCH] meson: move subdirs to "Collect sources" section +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Paolo Bonzini +--- + meson.build | 66 ++++++++++++++++++++++++++--------------------------- + 1 file changed, 33 insertions(+), 33 deletions(-) + +diff --git a/meson.build b/meson.build +index 315e3466fd..679904a316 100644 +--- a/meson.build ++++ b/meson.build +@@ -3283,39 +3283,6 @@ foreach d : hx_headers + endforeach + genh += hxdep + +-################### +-# Collect sources # +-################### +- +-authz_ss = ss.source_set() +-blockdev_ss = ss.source_set() +-block_ss = ss.source_set() +-chardev_ss = ss.source_set() +-common_ss = ss.source_set() +-crypto_ss = ss.source_set() +-hwcore_ss = ss.source_set() +-io_ss = ss.source_set() +-qmp_ss = ss.source_set() +-qom_ss = ss.source_set() +-system_ss = ss.source_set() +-specific_fuzz_ss = ss.source_set() +-specific_ss = ss.source_set() +-stub_ss = ss.source_set() +-trace_ss = ss.source_set() +-user_ss = ss.source_set() +-util_ss = ss.source_set() +- +-# accel modules +-qtest_module_ss = ss.source_set() +-tcg_module_ss = ss.source_set() +- +-modules = {} +-target_modules = {} +-hw_arch = {} +-target_arch = {} +-target_system_arch = {} +-target_user_arch = {} +- + ############### + # Trace files # + ############### +@@ -3432,6 +3399,39 @@ if have_system or have_user + ] + endif + ++################### ++# Collect sources # ++################### ++ ++authz_ss = ss.source_set() ++blockdev_ss = ss.source_set() ++block_ss = ss.source_set() ++chardev_ss = ss.source_set() ++common_ss = ss.source_set() ++crypto_ss = ss.source_set() ++hwcore_ss = ss.source_set() ++io_ss = ss.source_set() ++qmp_ss = ss.source_set() ++qom_ss = ss.source_set() ++system_ss = ss.source_set() ++specific_fuzz_ss = ss.source_set() ++specific_ss = ss.source_set() ++stub_ss = ss.source_set() ++trace_ss = ss.source_set() ++user_ss = ss.source_set() ++util_ss = ss.source_set() ++ ++# accel modules ++qtest_module_ss = ss.source_set() ++tcg_module_ss = ss.source_set() ++ ++modules = {} ++target_modules = {} ++hw_arch = {} ++target_arch = {} ++target_system_arch = {} ++target_user_arch = {} ++ + # NOTE: the trace/ subdirectory needs the qapi_trace_events variable + # that is filled in by qapi/. + subdir('qapi') +-- +2.39.3 + diff --git a/0477-meson-always-probe-u2f-and-canokey-if-the-option-is-.patch b/0477-meson-always-probe-u2f-and-canokey-if-the-option-is-.patch new file mode 100644 index 0000000..c743a70 --- /dev/null +++ b/0477-meson-always-probe-u2f-and-canokey-if-the-option-is-.patch @@ -0,0 +1,34 @@ +From d726760b6d73a5566661637ec0842ab56faf1c38 Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Fri, 8 Sep 2023 12:10:27 +0200 +Subject: [PATCH] meson: always probe u2f and canokey if the option is enabled + +commit e7c22ff87aa3a71e6cad1e88c2651dde8c7d504b upstream. + +Signed-off-by: Paolo Bonzini +--- + meson.build | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index 679904a316..5318b28e44 100644 +--- a/meson.build ++++ b/meson.build +@@ -1851,12 +1851,12 @@ if not get_option('smartcard').auto() or have_system + version: '>=2.5.1', method: 'pkg-config') + endif + u2f = not_found +-if have_system ++if not get_option('u2f').auto() or have_system + u2f = dependency('u2f-emu', required: get_option('u2f'), + method: 'pkg-config') + endif + canokey = not_found +-if have_system ++if not get_option('canokey').auto() or have_system + canokey = dependency('canokey-qemu', required: get_option('canokey'), + method: 'pkg-config') + endif +-- +2.39.3 + diff --git a/0478-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-checksu.patch b/0478-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-checksu.patch new file mode 100644 index 0000000..109ae0a --- /dev/null +++ b/0478-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-checksu.patch @@ -0,0 +1,71 @@ +From 21822c11a828053829531eb05cc0cdfcd59074a5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= +Date: Tue, 9 Apr 2024 19:54:05 +0200 +Subject: [PATCH] hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +commit 83ddb3dbba2ee0f1767442ae6ee665058aeb1093 upstream. + +If a fragmented packet size is too short, do not try to +calculate its checksum. + +Reproduced using: + + $ cat << EOF | qemu-system-i386 -display none -nodefaults \ + -machine q35,accel=qtest -m 32M \ + -device igb,netdev=net0 \ + -netdev user,id=net0 \ + -qtest stdio + outl 0xcf8 0x80000810 + outl 0xcfc 0xe0000000 + outl 0xcf8 0x80000804 + outw 0xcfc 0x06 + write 0xe0000403 0x1 0x02 + writel 0xe0003808 0xffffffff + write 0xe000381a 0x1 0x5b + write 0xe000381b 0x1 0x00 + EOF + Assertion failed: (offset == 0), function iov_from_buf_full, file util/iov.c, line 39. + #1 0x5575e81e952a in iov_from_buf_full qemu/util/iov.c:39:5 + #2 0x5575e6500768 in net_tx_pkt_update_sctp_checksum qemu/hw/net/net_tx_pkt.c:144:9 + #3 0x5575e659f3e1 in igb_setup_tx_offloads qemu/hw/net/igb_core.c:478:11 + #4 0x5575e659f3e1 in igb_tx_pkt_send qemu/hw/net/igb_core.c:552:10 + #5 0x5575e659f3e1 in igb_process_tx_desc qemu/hw/net/igb_core.c:671:17 + #6 0x5575e659f3e1 in igb_start_xmit qemu/hw/net/igb_core.c:903:9 + #7 0x5575e659f3e1 in igb_set_tdt qemu/hw/net/igb_core.c:2812:5 + #8 0x5575e657d6a4 in igb_core_write qemu/hw/net/igb_core.c:4248:9 + +Fixes: CVE-2024-3567 +Cc: qemu-stable@nongnu.org +Reported-by: Zheyu Ma +Fixes: f199b13bc1 ("igb: Implement Tx SCTP CSO") +Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2273 +Signed-off-by: Philippe Mathieu-Daudé +Reviewed-by: Akihiko Odaki +Acked-by: Jason Wang +Message-Id: <20240410070459.49112-1-philmd@linaro.org> +Signed-off-by: Bin Guo +--- + hw/net/net_tx_pkt.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c +index 2e5f58b3c9..d40d508a11 100644 +--- a/hw/net/net_tx_pkt.c ++++ b/hw/net/net_tx_pkt.c +@@ -141,6 +141,10 @@ bool net_tx_pkt_update_sctp_checksum(struct NetTxPkt *pkt) + uint32_t csum = 0; + struct iovec *pl_start_frag = pkt->vec + NET_TX_PKT_PL_START_FRAG; + ++ if (iov_size(pl_start_frag, pkt->payload_frags) < 8 + sizeof(csum)) { ++ return false; ++ } ++ + if (iov_from_buf(pl_start_frag, pkt->payload_frags, 8, &csum, sizeof(csum)) < sizeof(csum)) { + return false; + } +-- +2.39.3 + diff --git a/0479-util-iov-do-not-assert-offset-is-in-iov.patch b/0479-util-iov-do-not-assert-offset-is-in-iov.patch new file mode 100644 index 0000000..47a7508 --- /dev/null +++ b/0479-util-iov-do-not-assert-offset-is-in-iov.patch @@ -0,0 +1,110 @@ +From dcb03241609646d4397b24e33ba332b1f2299a56 Mon Sep 17 00:00:00 2001 +From: Akihiko Odaki +Date: Sun, 28 Apr 2024 20:11:22 +0900 +Subject: [PATCH] util/iov: Do not assert offset is in iov + +commit 9dc64bd5a4bebdc820e7e8484cb30e02befdc774 upstream. + +iov_from_buf(), iov_to_buf(), iov_memset(), and iov_copy() asserts +that the given offset fits in the iov while tolerating the specified +number of bytes to operate with to be greater than the size of iov. +This is inconsistent so remove the assertions. + +Asserting the offset fits in the iov makes sense if it is expected that +there are other operations that process the content before the offset +and the content is processed in order. Under this expectation, the +offset should point to the end of bytes that are previously processed +and fit in the iov. However, this expectation depends on the details of +the caller, and did not hold true at least one case and required code to +check iov_size(), which is added with commit 83ddb3dbba2e +("hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()"). + +Adding such a check is inefficient and error-prone. These functions +already tolerate the specified number of bytes to operate with to be +greater than the size of iov to avoid such checks so remove the +assertions to tolerate invalid offset as well. They return the number of +bytes they operated with so their callers can still check the returned +value to ensure there are sufficient space at the given offset. + +Signed-off-by: Akihiko Odaki +Signed-off-by: Jason Wang +Signed-off-by: Bin Guo +--- + include/qemu/iov.h | 5 +++-- + util/iov.c | 5 ----- + 2 files changed, 3 insertions(+), 7 deletions(-) + +diff --git a/include/qemu/iov.h b/include/qemu/iov.h +index 63a1c01965..33548058d2 100644 +--- a/include/qemu/iov.h ++++ b/include/qemu/iov.h +@@ -30,7 +30,7 @@ size_t iov_size(const struct iovec *iov, const unsigned int iov_cnt); + * only part of data will be copied, up to the end of the iovec. + * Number of bytes actually copied will be returned, which is + * min(bytes, iov_size(iov)-offset) +- * `Offset' must point to the inside of iovec. ++ * Returns 0 when `offset' points to the outside of iovec. + */ + size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, + size_t offset, const void *buf, size_t bytes); +@@ -66,11 +66,12 @@ iov_to_buf(const struct iovec *iov, const unsigned int iov_cnt, + /** + * Set data bytes pointed out by iovec `iov' of size `iov_cnt' elements, + * starting at byte offset `start', to value `fillc', repeating it +- * `bytes' number of times. `Offset' must point to the inside of iovec. ++ * `bytes' number of times. + * If `bytes' is large enough, only last bytes portion of iovec, + * up to the end of it, will be filled with the specified value. + * Function return actual number of bytes processed, which is + * min(size, iov_size(iov) - offset). ++ * Returns 0 when `offset' points to the outside of iovec. + */ + size_t iov_memset(const struct iovec *iov, const unsigned int iov_cnt, + size_t offset, int fillc, size_t bytes); +diff --git a/util/iov.c b/util/iov.c +index 7e73948f5e..a523b406b7 100644 +--- a/util/iov.c ++++ b/util/iov.c +@@ -36,7 +36,6 @@ size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, + offset -= iov[i].iov_len; + } + } +- assert(offset == 0); + return done; + } + +@@ -55,7 +54,6 @@ size_t iov_to_buf_full(const struct iovec *iov, const unsigned int iov_cnt, + offset -= iov[i].iov_len; + } + } +- assert(offset == 0); + return done; + } + +@@ -74,7 +72,6 @@ size_t iov_memset(const struct iovec *iov, const unsigned int iov_cnt, + offset -= iov[i].iov_len; + } + } +- assert(offset == 0); + return done; + } + +@@ -266,7 +263,6 @@ unsigned iov_copy(struct iovec *dst_iov, unsigned int dst_iov_cnt, + bytes -= len; + offset = 0; + } +- assert(offset == 0); + return j; + } + +@@ -337,7 +333,6 @@ size_t qemu_iovec_concat_iov(QEMUIOVector *dst, + soffset -= src_iov[i].iov_len; + } + } +- assert(soffset == 0); /* offset beyond end of src */ + + return done; + } +-- +2.39.3 + diff --git a/0480-revert-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-.patch b/0480-revert-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-.patch new file mode 100644 index 0000000..080f797 --- /dev/null +++ b/0480-revert-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-.patch @@ -0,0 +1,42 @@ +From ea6b34115e0f3448a2ca366917c1830f26e1b7f3 Mon Sep 17 00:00:00 2001 +From: Akihiko Odaki +Date: Sun, 28 Apr 2024 20:11:23 +0900 +Subject: [PATCH] Revert "hw/net/net_tx_pkt: Fix overrun in + update_sctp_checksum()" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +commit 2938c36937559554a2408b008470c9a76cb9271a upstream. + +This reverts commit 83ddb3dbba2ee0f1767442ae6ee665058aeb1093. + +The added check is no longer necessary due to a change of +iov_from_buf(). + +Reviewed-by: Philippe Mathieu-Daudé +Signed-off-by: Akihiko Odaki +Signed-off-by: Jason Wang +Signed-off-by: Bin Guo +--- + hw/net/net_tx_pkt.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c +index d40d508a11..2e5f58b3c9 100644 +--- a/hw/net/net_tx_pkt.c ++++ b/hw/net/net_tx_pkt.c +@@ -141,10 +141,6 @@ bool net_tx_pkt_update_sctp_checksum(struct NetTxPkt *pkt) + uint32_t csum = 0; + struct iovec *pl_start_frag = pkt->vec + NET_TX_PKT_PL_START_FRAG; + +- if (iov_size(pl_start_frag, pkt->payload_frags) < 8 + sizeof(csum)) { +- return false; +- } +- + if (iov_from_buf(pl_start_frag, pkt->payload_frags, 8, &csum, sizeof(csum)) < sizeof(csum)) { + return false; + } +-- +2.39.3 + diff --git a/qemu.spec b/qemu.spec index 0b7f475..a0f6888 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,4 +1,4 @@ -%define anolis_release 31 +%define anolis_release 32 %bcond_with check %global all_system_emu_support 0 @@ -746,6 +746,26 @@ Patch0457: 0457-hw-virtio-introduce-virtio-bh-new-guarded-helper.patch Patch0458: 0458-hw-display-virtio-gpu-protect-from-dma-re-entrancy-b.patch Patch0459: 0459-hw-char-virtio-serial-bus-protect-from-dma-re-entran.patch Patch0460: 0460-hw-virtio-virtio-crypto-protect-from-dma-re-entrancy.patch +Patch0461: 0461-linux-headers-riscv-add-ptrace-h.patch +Patch0462: 0462-update-linux-headers-fix-forwarding-to-asm-generic-h.patch +Patch0463: 0463-update-linux-headers-move-pvpanic-h-to-correct-direc.patch +Patch0464: 0464-update-linux-headers-import-linux-kvm-para-h-header.patch +Patch0465: 0465-meson-fix-type-of-relocatable-option.patch +Patch0466: 0466-makefile-clean-qemu-iotests-output.patch +Patch0467: 0467-configure-remove-unnecessary-subshell.patch +Patch0468: 0468-configure-unify-again-the-case-arms-in-probe-target-.patch +Patch0469: 0469-meson-add-more-sections-to-main-meson-build.patch +Patch0470: 0470-meson-move-program-checks-together.patch +Patch0471: 0471-meson-move-option-validation-together.patch +Patch0472: 0472-meson-move-accelerator-dependency-checks-together.patch +Patch0473: 0473-meson-keep-subprojects-together.patch +Patch0474: 0474-meson-move-cfi-detection-code-with-other-compiler-fl.patch +Patch0475: 0475-meson-move-config-host-h-definitions-together.patch +Patch0476: 0476-meson-move-subdirs-to-collect-sources-section.patch +Patch0477: 0477-meson-always-probe-u2f-and-canokey-if-the-option-is-.patch +Patch0478: 0478-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-checksu.patch +Patch0479: 0479-util-iov-do-not-assert-offset-is-in-iov.patch +Patch0480: 0480-revert-hw-net-net-tx-pkt-fix-overrun-in-update-sctp-.patch ExclusiveArch: x86_64 aarch64 loongarch64 riscv64 @@ -2310,6 +2330,13 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog +* Fri Aug 15 2025 wh02252983 - 2:8.2.0-32 +- meson: move subdirs to "Collect sources" section +- meson: always probe u2f and canokey if the option is enabled +- hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum() +- util/iov: Do not assert offset is in iov +- Revert "hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()" + * Tue Jul 15 2025 wh02252983 - 2:8.2.0-31 - virtio-net: Ensure queue index fits with RSS - hw/virtio: Introduce virtio_bh_new_guarded() helper -- Gitee