From 092e092ee590ae268d1ebf34c09621fc826a6e10 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Thu, 5 May 2022 07:05:44 +0200 Subject: qemu: update 6.2.0 -> 7.0.0 Drop xfs/libxml2 options no longer offered upstream. Dropped patches all found their way upstream, particularly 0001-qemu-Add-missing-wacom-HID-descriptor.patch as well. (From OE-Core rev: ab6bd34a07d10583aeb9377a7fdb9392242b6a8c) Signed-off-by: Alexander Kanavin Signed-off-by: Luca Ceresoli Signed-off-by: Richard Purdie --- meta/conf/distro/include/tcmode-default.inc | 2 +- meta/recipes-devtools/qemu/qemu-native_6.2.0.bb | 9 - meta/recipes-devtools/qemu/qemu-native_7.0.0.bb | 9 + .../qemu/qemu-system-native_6.2.0.bb | 32 --- .../qemu/qemu-system-native_7.0.0.bb | 32 +++ meta/recipes-devtools/qemu/qemu.inc | 31 +-- ...SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch | 48 ---- ...Add-missing-device-identification-objects.patch | 83 ------- ...-asm-ptrace.h-for-pt_regs-struct-definiti.patch | 92 -------- ...dition-environment-space-to-boot-loader-q.patch | 36 +++ ...001-qemu-Add-missing-wacom-HID-descriptor.patch | 141 ------------ ...01-qemu-Do-not-include-file-if-not-exists.patch | 31 --- ...5.4-as-minimum-kernel-version-for-riscv32.patch | 40 ---- ....build-use-relative-path-to-refer-to-file.patch | 34 --- ...-detach-the-virqueue-element-in-case-of-e.patch | 60 ----- ...ardev-connect-socket-to-a-spawned-command.patch | 246 +++++++++++++++++++++ ...t-fix-map-leaking-on-error-during-receive.patch | 43 ---- .../qemu/0003-apic-fixup-fallthrough-to-PIC.patch | 47 ++++ ...dition-environment-space-to-boot-loader-q.patch | 33 --- ...ure-Add-pkg-config-handling-for-libgcrypt.patch | 32 +++ ...05-qemu-Do-not-include-file-if-not-exists.patch | 35 +++ ...ardev-connect-socket-to-a-spawned-command.patch | 243 -------------------- ...me-user-space-mmap-tweaks-to-address-musl.patch | 52 +++++ .../qemu/0007-apic-fixup-fallthrough-to-PIC.patch | 44 ---- .../qemu/qemu/0007-qemu-Determinism-fixes.patch | 34 +++ ....build-use-relative-path-to-refer-to-file.patch | 38 ++++ ...SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch | 49 ++++ ...ure-Add-pkg-config-handling-for-libgcrypt.patch | 29 --- ...rotect-against-buggy-or-malicious-guest-d.patch | 57 +++++ meta/recipes-devtools/qemu/qemu/cross.patch | 15 +- meta/recipes-devtools/qemu/qemu/determinism.patch | 22 -- meta/recipes-devtools/qemu/qemu/mmap2.patch | 39 ---- meta/recipes-devtools/qemu/qemu/no-ps2.patch | 123 ----------- meta/recipes-devtools/qemu/qemu/pvrdma.patch | 45 ---- meta/recipes-devtools/qemu/qemu_6.2.0.bb | 27 --- meta/recipes-devtools/qemu/qemu_7.0.0.bb | 27 +++ 36 files changed, 714 insertions(+), 1246 deletions(-) delete mode 100644 meta/recipes-devtools/qemu/qemu-native_6.2.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu-native_7.0.0.bb delete mode 100644 meta/recipes-devtools/qemu/qemu-system-native_6.2.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu-system-native_7.0.0.bb delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-acpi-tpm-Add-missing-device-identification-objects.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-ppc-Include-asm-ptrace.h-for-pt_regs-struct-definiti.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-qemu-Do-not-include-file-if-not-exists.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-tests-meson.build-use-relative-path-to-refer-to-file.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0001-vhost-vsock-detach-the-virqueue-element-in-case-of-e.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0002-virtio-net-fix-map-leaking-on-error-during-receive.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0003-apic-fixup-fallthrough-to-PIC.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0005-qemu-Do-not-include-file-if-not-exists.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0007-apic-fixup-fallthrough-to-PIC.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0007-qemu-Determinism-fixes.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/determinism.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/mmap2.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/no-ps2.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/pvrdma.patch delete mode 100644 meta/recipes-devtools/qemu/qemu_6.2.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu_7.0.0.bb diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc index 4064d84b32..e8ea7cc546 100644 --- a/meta/conf/distro/include/tcmode-default.inc +++ b/meta/conf/distro/include/tcmode-default.inc @@ -22,7 +22,7 @@ BINUVERSION ?= "2.38%" GDBVERSION ?= "11.%" GLIBCVERSION ?= "2.35" LINUXLIBCVERSION ?= "5.16%" -QEMUVERSION ?= "6.2%" +QEMUVERSION ?= "7.0%" GOVERSION ?= "1.18%" # This can not use wildcards like 8.0.% since it is also used in mesa to denote # llvm version being used, so always bump it with llvm recipe version bump diff --git a/meta/recipes-devtools/qemu/qemu-native_6.2.0.bb b/meta/recipes-devtools/qemu/qemu-native_6.2.0.bb deleted file mode 100644 index a94dc0b61e..0000000000 --- a/meta/recipes-devtools/qemu/qemu-native_6.2.0.bb +++ /dev/null @@ -1,9 +0,0 @@ -BPN = "qemu" - -DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" - -require qemu-native.inc - -EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "pie" diff --git a/meta/recipes-devtools/qemu/qemu-native_7.0.0.bb b/meta/recipes-devtools/qemu/qemu-native_7.0.0.bb new file mode 100644 index 0000000000..a94dc0b61e --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-native_7.0.0.bb @@ -0,0 +1,9 @@ +BPN = "qemu" + +DEPENDS = "glib-2.0-native zlib-native ninja-native meson-native" + +require qemu-native.inc + +EXTRA_OECONF:append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "pie" diff --git a/meta/recipes-devtools/qemu/qemu-system-native_6.2.0.bb b/meta/recipes-devtools/qemu/qemu-system-native_6.2.0.bb deleted file mode 100644 index bc5384d472..0000000000 --- a/meta/recipes-devtools/qemu/qemu-system-native_6.2.0.bb +++ /dev/null @@ -1,32 +0,0 @@ -BPN = "qemu" - -inherit python3-dir - -require qemu-native.inc - -# As some of the files installed by qemu-native and qemu-system-native -# are the same, we depend on qemu-native to get the full installation set -# and avoid file clashes -DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native meson-native ninja-native" - -EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm pie \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ -" - -# Handle distros such as CentOS 5 32-bit that do not have kvm support -PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -do_install:append() { - install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu - - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons/ - rm -rf ${D}${includedir}/qemu-plugin.h - - # Install qmp.py to be used with testimage - install -D ${S}/python/qemu/qmp/__init__.py ${D}${libdir}/qemu-python/qmp.py -} diff --git a/meta/recipes-devtools/qemu/qemu-system-native_7.0.0.bb b/meta/recipes-devtools/qemu/qemu-system-native_7.0.0.bb new file mode 100644 index 0000000000..bc5384d472 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-system-native_7.0.0.bb @@ -0,0 +1,32 @@ +BPN = "qemu" + +inherit python3-dir + +require qemu-native.inc + +# As some of the files installed by qemu-native and qemu-system-native +# are the same, we depend on qemu-native to get the full installation set +# and avoid file clashes +DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native meson-native ninja-native" + +EXTRA_OECONF:append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm pie \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ +" + +# Handle distros such as CentOS 5 32-bit that do not have kvm support +PACKAGECONFIG:remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +do_install:append() { + install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu + + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons/ + rm -rf ${D}${includedir}/qemu-plugin.h + + # Install qmp.py to be used with testimage + install -D ${S}/python/qemu/qmp/__init__.py ${D}${libdir}/qemu-python/qmp.py +} diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index 0aaeaa1cb5..5f303992be 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc @@ -17,27 +17,20 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://powerpc_rom.bin \ file://run-ptest \ - file://0001-qemu-Add-missing-wacom-HID-descriptor.patch \ - file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ - file://0006-chardev-connect-socket-to-a-spawned-command.patch \ - file://0007-apic-fixup-fallthrough-to-PIC.patch \ - file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ - file://0001-qemu-Do-not-include-file-if-not-exists.patch \ - file://mmap2.patch \ - file://determinism.patch \ - file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \ - file://0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch \ - file://0001-acpi-tpm-Add-missing-device-identification-objects.patch \ - file://0001-ppc-Include-asm-ptrace.h-for-pt_regs-struct-definiti.patch \ - file://0001-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ - file://0001-vhost-vsock-detach-the-virqueue-element-in-case-of-e.patch \ - file://0002-virtio-net-fix-map-leaking-on-error-during-receive.patch \ - file://pvrdma.patch \ - file://no-ps2.patch \ + file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ + file://0002-chardev-connect-socket-to-a-spawned-command.patch \ + file://0003-apic-fixup-fallthrough-to-PIC.patch \ + file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \ + file://0005-qemu-Do-not-include-file-if-not-exists.patch \ + file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ + file://0007-qemu-Determinism-fixes.patch \ + file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ + file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ + file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ " UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar" -SRC_URI[sha256sum] = "68e15d8e45ac56326e0b9a4afa8b49a3dfe8aba3488221d098c84698bca65b45" +SRC_URI[sha256sum] = "f6b375c7951f728402798b0baabb2d86478ca53d44cedbefabbe1c46bf46f839" SRC_URI:append:class-target = " file://cross.patch" SRC_URI:append:class-nativesdk = " file://cross.patch" @@ -152,7 +145,6 @@ PACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+" PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," -PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs," PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," @@ -185,7 +177,6 @@ PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev" -PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2" PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," diff --git a/meta/recipes-devtools/qemu/qemu/0001-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch b/meta/recipes-devtools/qemu/qemu/0001-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch deleted file mode 100644 index 4691a3672a..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 444e80e63d35006f41e7d658e2bf6d7c9f7641df Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 21 Mar 2022 10:09:38 -0700 -Subject: [PATCH] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux - systems - -linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures -which include asm-generic/mman.h and mips/powerpc are not including this -file in linux/mman.h, therefore these should be defined for such -architectures on Linux as well. This fixes build on mips/musl/linux - -Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05298.html] -Signed-off-by: Khem Raj -Cc: Zhang Yi -Cc: Michael S. Tsirkin ---- - util/mmap-alloc.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c -index 893d864354..86d3cda248 100644 ---- a/util/mmap-alloc.c -+++ b/util/mmap-alloc.c -@@ -10,14 +10,18 @@ - * later. See the COPYING file in the top-level directory. - */ - -+#include "qemu/osdep.h" - #ifdef CONFIG_LINUX - #include --#else /* !CONFIG_LINUX */ -+#endif /* CONFIG_LINUX */ -+ -+#ifndef MAP_SYNC - #define MAP_SYNC 0x0 -+#endif /* MAP_SYNC */ -+#ifndef MAP_SHARED_VALIDATE - #define MAP_SHARED_VALIDATE 0x0 --#endif /* CONFIG_LINUX */ -+#endif /* MAP_SHARED_VALIDATE */ - --#include "qemu/osdep.h" - #include "qemu/mmap-alloc.h" - #include "qemu/host-utils.h" - #include "qemu/cutils.h" --- -2.35.1 - diff --git a/meta/recipes-devtools/qemu/qemu/0001-acpi-tpm-Add-missing-device-identification-objects.patch b/meta/recipes-devtools/qemu/qemu/0001-acpi-tpm-Add-missing-device-identification-objects.patch deleted file mode 100644 index ff91674879..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-acpi-tpm-Add-missing-device-identification-objects.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 5903646d3913af6544680f6645fcb7296d0b3a1c Mon Sep 17 00:00:00 2001 -From: Stefan Berger -Date: Tue, 4 Jan 2022 12:58:05 -0500 -Subject: [PATCH] acpi: tpm: Add missing device identification objects - -Add missing TPM device identification objects _STR and _UID. They will -appear as files 'description' and 'uid' under Linux sysfs. - -Following inspection of sysfs entries for hardware TPMs we chose -uid '1'. - -Upstream-Status: Backport [5903646d3913af6544680f6645fcb7296d0b3a1c] - -Cc: Shannon Zhao -Cc: Michael S. Tsirkin -Cc: Igor Mammedov -Cc: Ani Sinha -Resolves: https://gitlab.com/qemu-project/qemu/-/issues/708 -Signed-off-by: Stefan Berger -Reviewed-by: Ani Sinha -Reviewed-by: Shannon Zhao -Message-id: 20211223022310.575496-3-stefanb@linux.ibm.com -Message-Id: <20220104175806.872996-3-stefanb@linux.ibm.com> -Reviewed-by: Michael S. Tsirkin -Signed-off-by: Michael S. Tsirkin -Reviewed-by: Igor Mammedov -Signed-off-by: Liwei Song ---- - hw/arm/virt-acpi-build.c | 1 + - hw/i386/acpi-build.c | 7 +++++++ - 2 files changed, 8 insertions(+) - -diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c -index d0f4867fdfe5..f2514ce77c0b 100644 ---- a/hw/arm/virt-acpi-build.c -+++ b/hw/arm/virt-acpi-build.c -@@ -229,6 +229,7 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms) - - Aml *dev = aml_device("TPM0"); - aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101"))); -+ aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device"))); - aml_append(dev, aml_name_decl("_UID", aml_int(0))); - - Aml *crs = aml_resource_template(); -diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c -index 0234fe7588b7..ce823e8fcb97 100644 ---- a/hw/i386/acpi-build.c -+++ b/hw/i386/acpi-build.c -@@ -1812,11 +1812,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, - dev = aml_device("TPM"); - aml_append(dev, aml_name_decl("_HID", - aml_string("MSFT0101"))); -+ aml_append(dev, -+ aml_name_decl("_STR", -+ aml_string("TPM 2.0 Device"))); - } else { - dev = aml_device("ISA.TPM"); - aml_append(dev, aml_name_decl("_HID", - aml_eisaid("PNP0C31"))); - } -+ aml_append(dev, aml_name_decl("_UID", aml_int(1))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xF))); - crs = aml_resource_template(); -@@ -1844,12 +1848,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, - if (TPM_IS_CRB(tpm)) { - dev = aml_device("TPM"); - aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101"))); -+ aml_append(dev, aml_name_decl("_STR", -+ aml_string("TPM 2.0 Device"))); - crs = aml_resource_template(); - aml_append(crs, aml_memory32_fixed(TPM_CRB_ADDR_BASE, - TPM_CRB_ADDR_SIZE, AML_READ_WRITE)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); -+ aml_append(dev, aml_name_decl("_UID", aml_int(1))); - - tpm_build_ppi_acpi(tpm, dev); - --- -2.17.1 - diff --git a/meta/recipes-devtools/qemu/qemu/0001-ppc-Include-asm-ptrace.h-for-pt_regs-struct-definiti.patch b/meta/recipes-devtools/qemu/qemu/0001-ppc-Include-asm-ptrace.h-for-pt_regs-struct-definiti.patch deleted file mode 100644 index e8e42007df..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-ppc-Include-asm-ptrace.h-for-pt_regs-struct-definiti.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 91e15627fd05d5a59fd2b88bc5c3491d3e0b56b0 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 14 Mar 2022 09:58:21 -0700 -Subject: [PATCH] ppc: Include asm/ptrace.h for pt_regs struct definition -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes -../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs' - return uc->uc_mcontext.regs->nip; - ~~~~~~~~~~~~~~~~~~~~^ - -Upstream-Status: Submitted [https://patchwork.kernel.org/project/qemu-devel/patch/20220314170223.554679-1-raj.khem@gmail.com/] - -Signed-off-by: Khem Raj -Cc: Peter Maydell -Cc: Philippe Mathieu-Daudé -Cc: Richard Henderson ---- - linux-user/include/host/ppc/host-signal.h | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/linux-user/host/ppc/host-signal.h -+++ /dev/null -@@ -1,30 +0,0 @@ --/* -- * host-signal.h: signal info dependent on the host architecture -- * -- * Copyright (c) 2003-2005 Fabrice Bellard -- * Copyright (c) 2021 Linaro Limited -- * -- * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. -- * See the COPYING file in the top-level directory. -- */ -- --#ifndef PPC_HOST_SIGNAL_H --#define PPC_HOST_SIGNAL_H -- --static inline uintptr_t host_signal_pc(ucontext_t *uc) --{ -- return uc->uc_mcontext.regs->nip; --} -- --static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) --{ -- uc->uc_mcontext.regs->nip = pc; --} -- --static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) --{ -- return uc->uc_mcontext.regs->trap != 0x400 -- && (uc->uc_mcontext.regs->dsisr & 0x02000000); --} -- --#endif ---- a/linux-user/host/ppc64/host-signal.h -+++ b/linux-user/host/ppc64/host-signal.h -@@ -1 +1,32 @@ --#include "../ppc/host-signal.h" -+/* -+ * host-signal.h: signal info dependent on the host architecture -+ * -+ * Copyright (c) 2003-2005 Fabrice Bellard -+ * Copyright (c) 2021 Linaro Limited -+ * -+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. -+ * See the COPYING file in the top-level directory. -+ */ -+ -+#ifndef PPC_HOST_SIGNAL_H -+#define PPC_HOST_SIGNAL_H -+ -+#include -+ -+static inline uintptr_t host_signal_pc(ucontext_t *uc) -+{ -+ return uc->uc_mcontext.gp_regs[PT_NIP]; -+} -+ -+static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) -+{ -+ uc->uc_mcontext.gp_regs[PT_NIP] = pc; -+} -+ -+static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) -+{ -+ return uc->uc_mcontext.gp_regs[PT_TRAP] != 0x400 -+ && (uc->uc_mcontext.gp_regs[PT_DSISR] & 0x02000000); -+} -+ -+#endif diff --git a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch new file mode 100644 index 0000000000..6fb160e6d3 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch @@ -0,0 +1,36 @@ +From de64af82950a6908f9407dfc92b83c17e2af3eab Mon Sep 17 00:00:00 2001 +From: Jason Wessel +Date: Fri, 28 Mar 2014 17:42:43 +0800 +Subject: [PATCH 01/12] qemu: Add addition environment space to boot loader + qemu-system-mips + +Upstream-Status: Inappropriate - OE uses deep paths + +If you create a project with very long directory names like 128 characters +deep and use NFS, the kernel arguments will be truncated. The kernel will +accept longer strings such as 1024 bytes, but the qemu boot loader defaulted +to only 256 bytes. This patch expands the limit. + +Signed-off-by: Jason Wessel +Signed-off-by: Roy Li + +--- + hw/mips/malta.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/mips/malta.c b/hw/mips/malta.c +index 628851172..12d37f35d 100644 +--- a/hw/mips/malta.c ++++ b/hw/mips/malta.c +@@ -61,7 +61,7 @@ + #define ENVP_PADDR 0x2000 + #define ENVP_VADDR cpu_mips_phys_to_kseg0(NULL, ENVP_PADDR) + #define ENVP_NB_ENTRIES 16 +-#define ENVP_ENTRY_SIZE 256 ++#define ENVP_ENTRY_SIZE 1024 + + /* Hardware addresses */ + #define FLASH_ADDRESS 0x1e000000ULL +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch deleted file mode 100644 index 2f2d19f536..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 883feb43129dc39b491e492c7ccfe89aefe53c44 Mon Sep 17 00:00:00 2001 -From: Richard Purdie -Date: Thu, 27 Nov 2014 14:04:29 +0000 -Subject: [PATCH] qemu: Add missing wacom HID descriptor - -The USB wacom device is missing a HID descriptor which causes it -to fail to operate with recent kernels (e.g. 3.17). - -This patch adds a HID desriptor to the device, based upon one from -real wcom device. - -Signed-off-by: Richard Purdie - -Upstream-Status: Submitted -2014/11/27 - -[update patch context] -Signed-off-by: Sakib Sajal ---- - hw/usb/dev-wacom.c | 94 +++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 93 insertions(+), 1 deletion(-) - -Index: qemu-6.0.0/hw/usb/dev-wacom.c -=================================================================== ---- qemu-6.0.0.orig/hw/usb/dev-wacom.c -+++ qemu-6.0.0/hw/usb/dev-wacom.c -@@ -69,6 +69,89 @@ static const USBDescStrings desc_strings - [STR_SERIALNUMBER] = "1", - }; - -+static const uint8_t qemu_tablet_hid_report_descriptor[] = { -+ 0x05, 0x01, /* Usage Page (Generic Desktop) */ -+ 0x09, 0x02, /* Usage (Mouse) */ -+ 0xa1, 0x01, /* Collection (Application) */ -+ 0x85, 0x01, /* Report ID (1) */ -+ 0x09, 0x01, /* Usage (Pointer) */ -+ 0xa1, 0x00, /* Collection (Physical) */ -+ 0x05, 0x09, /* Usage Page (Button) */ -+ 0x19, 0x01, /* Usage Minimum (1) */ -+ 0x29, 0x05, /* Usage Maximum (5) */ -+ 0x15, 0x00, /* Logical Minimum (0) */ -+ 0x25, 0x01, /* Logical Maximum (1) */ -+ 0x95, 0x05, /* Report Count (5) */ -+ 0x75, 0x01, /* Report Size (1) */ -+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */ -+ 0x95, 0x01, /* Report Count (1) */ -+ 0x75, 0x03, /* Report Size (3) */ -+ 0x81, 0x01, /* Input (Constant) */ -+ 0x05, 0x01, /* Usage Page (Generic Desktop) */ -+ 0x09, 0x30, /* Usage (X) */ -+ 0x09, 0x31, /* Usage (Y) */ -+ 0x15, 0x81, /* Logical Minimum (-127) */ -+ 0x25, 0x7f, /* Logical Maximum (127) */ -+ 0x75, 0x08, /* Report Size (8) */ -+ 0x95, 0x02, /* Report Count (2) */ -+ 0x81, 0x06, /* Input (Data, Variable, Relative) */ -+ 0xc0, /* End Collection */ -+ 0xc0, /* End Collection */ -+ 0x05, 0x0d, /* Usage Page (Digitizer) */ -+ 0x09, 0x01, /* Usage (Digitizer) */ -+ 0xa1, 0x01, /* Collection (Application) */ -+ 0x85, 0x02, /* Report ID (2) */ -+ 0xa1, 0x00, /* Collection (Physical) */ -+ 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */ -+ 0x09, 0x01, /* Usage (Digitizer) */ -+ 0x15, 0x00, /* Logical Minimum (0) */ -+ 0x26, 0xff, 0x00, /* Logical Maximum (255) */ -+ 0x75, 0x08, /* Report Size (8) */ -+ 0x95, 0x08, /* Report Count (8) */ -+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */ -+ 0xc0, /* End Collection */ -+ 0x09, 0x01, /* Usage (Digitizer) */ -+ 0x85, 0x02, /* Report ID (2) */ -+ 0x95, 0x01, /* Report Count (1) */ -+ 0xb1, 0x02, /* FEATURE (2) */ -+ 0xc0, /* End Collection */ -+ 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */ -+ 0x09, 0x01, /* Usage (Digitizer) */ -+ 0xa1, 0x01, /* Collection (Application) */ -+ 0x85, 0x02, /* Report ID (2) */ -+ 0x05, 0x0d, /* Usage Page (Digitizer) */ -+ 0x09, 0x22, /* Usage (Finger) */ -+ 0xa1, 0x00, /* Collection (Physical) */ -+ 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */ -+ 0x09, 0x01, /* Usage (Digitizer) */ -+ 0x15, 0x00, /* Logical Minimum (0) */ -+ 0x26, 0xff, 0x00, /* Logical Maximum */ -+ 0x75, 0x08, /* Report Size (8) */ -+ 0x95, 0x02, /* Report Count (2) */ -+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */ -+ 0x05, 0x01, /* Usage Page (Generic Desktop) */ -+ 0x09, 0x30, /* Usage (X) */ -+ 0x35, 0x00, /* Physical Minimum */ -+ 0x46, 0xe0, 0x2e, /* Physical Maximum */ -+ 0x26, 0xe0, 0x01, /* Logical Maximum */ -+ 0x75, 0x10, /* Report Size (16) */ -+ 0x95, 0x01, /* Report Count (1) */ -+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */ -+ 0x09, 0x31, /* Usage (Y) */ -+ 0x46, 0x40, 0x1f, /* Physical Maximum */ -+ 0x26, 0x40, 0x01, /* Logical Maximum */ -+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */ -+ 0x06, 0x00, 0xff, /* Usage Page (Vendor 0xff00) */ -+ 0x09, 0x01, /* Usage (Digitizer) */ -+ 0x26, 0xff, 0x00, /* Logical Maximum */ -+ 0x75, 0x08, /* Report Size (8) */ -+ 0x95, 0x0d, /* Report Count (13) */ -+ 0x81, 0x02, /* Input (Data, Variable, Absolute) */ -+ 0xc0, /* End Collection */ -+ 0xc0, /* End Collection */ -+}; -+ -+ - static const USBDescIface desc_iface_wacom = { - .bInterfaceNumber = 0, - .bNumEndpoints = 1, -@@ -86,7 +169,7 @@ static const USBDescIface desc_iface_wac - 0x00, /* u8 country_code */ - 0x01, /* u8 num_descriptors */ - USB_DT_REPORT, /* u8 type: Report */ -- 0x6e, 0, /* u16 len */ -+ sizeof(qemu_tablet_hid_report_descriptor), 0, /* u16 len */ - }, - }, - }, -@@ -266,6 +349,15 @@ static void usb_wacom_handle_control(USB - } - - switch (request) { -+ case InterfaceRequest | USB_REQ_GET_DESCRIPTOR: -+ switch (value >> 8) { -+ case 0x22: -+ memcpy(data, qemu_tablet_hid_report_descriptor, -+ sizeof(qemu_tablet_hid_report_descriptor)); -+ p->actual_length = sizeof(qemu_tablet_hid_report_descriptor); -+ break; -+ } -+ break; - case WACOM_SET_REPORT: - if (s->mouse_grabbed) { - qemu_remove_mouse_event_handler(s->eh_entry); diff --git a/meta/recipes-devtools/qemu/qemu/0001-qemu-Do-not-include-file-if-not-exists.patch b/meta/recipes-devtools/qemu/qemu/0001-qemu-Do-not-include-file-if-not-exists.patch deleted file mode 100644 index b8d288d3a2..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-qemu-Do-not-include-file-if-not-exists.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 34247f83095f8cdcdc1f9d7f0c6ffbd46b25d979 Mon Sep 17 00:00:00 2001 -From: Oleksiy Obitotskyy -Date: Wed, 25 Mar 2020 21:21:35 +0200 -Subject: [PATCH] qemu: Do not include file if not exists - -Script configure checks for if_alg.h and check failed but -if_alg.h still included. - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07188.html] -Signed-off-by: Oleksiy Obitotskyy - -[update patch context] -Signed-off-by: Sakib Sajal ---- - linux-user/syscall.c | 2 ++ - 1 file changed, 2 insertions(+) - -Index: qemu-6.0.0/linux-user/syscall.c -=================================================================== ---- qemu-6.0.0.orig/linux-user/syscall.c -+++ qemu-6.0.0/linux-user/syscall.c -@@ -113,7 +113,9 @@ - #include - #include - #include -+#if defined(CONFIG_AF_ALG) - #include -+#endif - #include - #include - #ifdef HAVE_BTRFS_H diff --git a/meta/recipes-devtools/qemu/qemu/0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch b/meta/recipes-devtools/qemu/qemu/0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch deleted file mode 100644 index ac4b6dcc44..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-riscv-Set-5.4-as-minimum-kernel-version-for-riscv32.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 359dc12eb32b2395cf10796157002024e6a58054 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 15 Dec 2021 23:31:11 -0800 -Subject: [PATCH] riscv: Set 5.4 as minimum kernel version for riscv32 - -5.4 is first stable API as far as rv32 is concerned see [1] - -[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=7a55dd3fb6d2c307a002a16776be84310b9c8989 - -Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2021-12/msg02495.html] - -Signed-off-by: Khem Raj -Cc: Palmer Dabbelt -Cc: Alistair Francis -Cc: Bin Meng -Signed-off-by: Matt Madison ---- - linux-user/riscv/target_syscall.h | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_syscall.h -index dc597c897..9b1316132 100644 ---- a/linux-user/riscv/target_syscall.h -+++ b/linux-user/riscv/target_syscall.h -@@ -45,10 +45,11 @@ struct target_pt_regs { - - #ifdef TARGET_RISCV32 - #define UNAME_MACHINE "riscv32" -+#define UNAME_MINIMUM_RELEASE "5.4.0" - #else - #define UNAME_MACHINE "riscv64" --#endif - #define UNAME_MINIMUM_RELEASE "4.15.0" -+#endif - - #define TARGET_MINSIGSTKSZ 2048 - #define TARGET_MCL_CURRENT 1 --- -2.32.0 - diff --git a/meta/recipes-devtools/qemu/qemu/0001-tests-meson.build-use-relative-path-to-refer-to-file.patch b/meta/recipes-devtools/qemu/qemu/0001-tests-meson.build-use-relative-path-to-refer-to-file.patch deleted file mode 100644 index fcef129181..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-tests-meson.build-use-relative-path-to-refer-to-file.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a4bdc0416134477e4eae386db04b1de7491163bb Mon Sep 17 00:00:00 2001 -From: Changqing Li -Date: Thu, 14 Jan 2021 06:33:04 +0000 -Subject: [PATCH] tests/meson.build: use relative path to refer to files - -Fix error like: -Fatal error: can't create tests/ptimer-test.p/..._qemu-5.2.0_hw_core_ptimer.c.o: File name too long - -when build path is too long, use meson.source_root() will make this -filename too long. Fixed by using relative path to refer to files - -Upstream-Status: Submitted [send to qemu-devel] - -Signed-off-by: Changqing Li ---- - tests/meson.build | 2 +- - 1 files changed, 1 insertions(+), 1 deletion(-) - -Index: qemu-6.2.0/tests/unit/meson.build -=================================================================== ---- qemu-6.2.0.orig/tests/unit/meson.build -+++ qemu-6.2.0/tests/unit/meson.build -@@ -44,9 +44,9 @@ tests = { - 'test-keyval': [testqapi], - 'test-logging': [], - 'test-uuid': [], -- 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], -+ 'ptimer-test': ['ptimer-test-stubs.c', '../../hw/core/ptimer.c'], - 'test-qapi-util': [], -- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], -+ 'test-smp-parse': [qom, '../../hw/core/machine-smp.c'], - } - - if have_system or have_tools diff --git a/meta/recipes-devtools/qemu/qemu/0001-vhost-vsock-detach-the-virqueue-element-in-case-of-e.patch b/meta/recipes-devtools/qemu/qemu/0001-vhost-vsock-detach-the-virqueue-element-in-case-of-e.patch deleted file mode 100644 index dcea9040c7..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0001-vhost-vsock-detach-the-virqueue-element-in-case-of-e.patch +++ /dev/null @@ -1,60 +0,0 @@ -CVE: CVE-2022-26354 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 0190d651a73463dc2b8f170b29326d1f38140a04 Mon Sep 17 00:00:00 2001 -From: Stefano Garzarella -Date: Mon, 28 Feb 2022 10:50:58 +0100 -Subject: [PATCH 1/2] vhost-vsock: detach the virqueue element in case of error - -In vhost_vsock_common_send_transport_reset(), if an element popped from -the virtqueue is invalid, we should call virtqueue_detach_element() to -detach it from the virtqueue before freeing its memory. - -Fixes: fc0b9b0e1c ("vhost-vsock: add virtio sockets device") -Fixes: CVE-2022-26354 -Cc: qemu-stable@nongnu.org -Reported-by: VictorV -Signed-off-by: Stefano Garzarella -Message-Id: <20220228095058.27899-1-sgarzare@redhat.com> -Reviewed-by: Stefan Hajnoczi -Reviewed-by: Michael S. Tsirkin -Signed-off-by: Michael S. Tsirkin ---- - hw/virtio/vhost-vsock-common.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c -index 3f3771274e..ed706681ac 100644 ---- a/hw/virtio/vhost-vsock-common.c -+++ b/hw/virtio/vhost-vsock-common.c -@@ -153,19 +153,23 @@ static void vhost_vsock_common_send_transport_reset(VHostVSockCommon *vvc) - if (elem->out_num) { - error_report("invalid vhost-vsock event virtqueue element with " - "out buffers"); -- goto out; -+ goto err; - } - - if (iov_from_buf(elem->in_sg, elem->in_num, 0, - &event, sizeof(event)) != sizeof(event)) { - error_report("vhost-vsock event virtqueue element is too short"); -- goto out; -+ goto err; - } - - virtqueue_push(vq, elem, sizeof(event)); - virtio_notify(VIRTIO_DEVICE(vvc), vq); - --out: -+ g_free(elem); -+ return; -+ -+err: -+ virtqueue_detach_element(vq, elem, 0); - g_free(elem); - } - --- -2.25.1 - diff --git a/meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch b/meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch new file mode 100644 index 0000000000..63a99c9620 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0002-chardev-connect-socket-to-a-spawned-command.patch @@ -0,0 +1,246 @@ +From 14cd62607c9de232edf0a9b8503bd02783e03411 Mon Sep 17 00:00:00 2001 +From: Alistair Francis +Date: Thu, 21 Dec 2017 11:35:16 -0800 +Subject: [PATCH 02/12] chardev: connect socket to a spawned command + +The command is started in a shell (sh -c) with stdin connect to QEMU +via a Unix domain stream socket. QEMU then exchanges data via its own +end of the socket, just like it normally does. + +"-chardev socket" supports some ways of connecting via protocols like +telnet, but that is only a subset of the functionality supported by +tools socat. To use socat instead, for example to connect via a socks +proxy, use: + + -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ + -device usb-serial,chardev=socat + +Beware that commas in the command must be escaped as double commas. + +Or interactively in the console: + (qemu) chardev-add socket,id=cat,cmd=cat + (qemu) device_add usb-serial,chardev=cat + ^ac + # cat >/dev/ttyUSB0 + hello + hello + +Another usage is starting swtpm from inside QEMU. swtpm will +automatically shut down once it looses the connection to the parent +QEMU, so there is no risk of lingering processes: + + -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ + -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ + -device tpm-tis,tpmdev=tpm0 + +The patch was discussed upstream, but QEMU developers believe that the +code calling QEMU should be responsible for managing additional +processes. In OE-core, that would imply enhancing runqemu and +oeqa. This patch is a simpler solution. + +Because it is not going upstream, the patch was written so that it is +as simple as possible. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Patrick Ohly + +--- + chardev/char-socket.c | 100 ++++++++++++++++++++++++++++++++++++++++++ + chardev/char.c | 3 ++ + qapi/char.json | 5 +++ + 3 files changed, 108 insertions(+) + +diff --git a/chardev/char-socket.c b/chardev/char-socket.c +index fab2d791d..c79641f24 100644 +--- a/chardev/char-socket.c ++++ b/chardev/char-socket.c +@@ -1315,6 +1315,67 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, + return true; + } + ++#ifndef _WIN32 ++static void chardev_open_socket_cmd(Chardev *chr, ++ const char *cmd, ++ Error **errp) ++{ ++ int fds[2] = { -1, -1 }; ++ QIOChannelSocket *sioc = NULL; ++ pid_t pid = -1; ++ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; ++ ++ /* ++ * We need a Unix domain socket for commands like swtpm and a single ++ * connection, therefore we cannot use qio_channel_command_new_spawn() ++ * without patching it first. Duplicating the functionality is easier. ++ */ ++ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { ++ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); ++ goto error; ++ } ++ ++ pid = qemu_fork(errp); ++ if (pid < 0) { ++ goto error; ++ } ++ ++ if (!pid) { ++ /* child */ ++ dup2(fds[1], STDIN_FILENO); ++ execv(argv[0], (char * const *)argv); ++ _exit(1); ++ } ++ ++ /* ++ * Hand over our end of the socket pair to the qio channel. ++ * ++ * We don't reap the child because it is expected to keep ++ * running. We also don't support the "reconnect" option for the ++ * same reason. ++ */ ++ sioc = qio_channel_socket_new_fd(fds[0], errp); ++ if (!sioc) { ++ goto error; ++ } ++ fds[0] = -1; ++ ++ g_free(chr->filename); ++ chr->filename = g_strdup_printf("cmd:%s", cmd); ++ tcp_chr_new_client(chr, sioc); ++ ++ error: ++ if (fds[0] >= 0) { ++ close(fds[0]); ++ } ++ if (fds[1] >= 0) { ++ close(fds[1]); ++ } ++ if (sioc) { ++ object_unref(OBJECT(sioc)); ++ } ++} ++#endif + + static void qmp_chardev_open_socket(Chardev *chr, + ChardevBackend *backend, +@@ -1323,6 +1384,9 @@ static void qmp_chardev_open_socket(Chardev *chr, + { + SocketChardev *s = SOCKET_CHARDEV(chr); + ChardevSocket *sock = backend->u.socket.data; ++#ifndef _WIN32 ++ const char *cmd = sock->cmd; ++#endif + bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; + bool is_listen = sock->has_server ? sock->server : true; + bool is_telnet = sock->has_telnet ? sock->telnet : false; +@@ -1393,6 +1457,14 @@ static void qmp_chardev_open_socket(Chardev *chr, + + update_disconnected_filename(s); + ++#ifndef _WIN32 ++ if (cmd) { ++ chardev_open_socket_cmd(chr, cmd, errp); ++ ++ /* everything ready (or failed permanently) before we return */ ++ *be_opened = true; ++ } else ++#endif + if (s->is_listen) { + if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, + is_waitconnect, errp) < 0) { +@@ -1412,6 +1484,9 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + const char *host = qemu_opt_get(opts, "host"); + const char *port = qemu_opt_get(opts, "port"); + const char *fd = qemu_opt_get(opts, "fd"); ++#ifndef _WIN32 ++ const char *cmd = qemu_opt_get(opts, "cmd"); ++#endif + #ifdef CONFIG_LINUX + bool tight = qemu_opt_get_bool(opts, "tight", true); + bool abstract = qemu_opt_get_bool(opts, "abstract", false); +@@ -1419,6 +1494,20 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + SocketAddressLegacy *addr; + ChardevSocket *sock; + ++#ifndef _WIN32 ++ if (cmd) { ++ /* ++ * Here we have to ensure that no options are set which are incompatible with ++ * spawning a command, otherwise unmodified code that doesn't know about ++ * command spawning (like socket_reconnect_timeout()) might get called. ++ */ ++ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { ++ error_setg(errp, "chardev: socket: cmd does not support any additional options"); ++ return; ++ } ++ } else ++#endif ++ + if ((!!path + !!fd + !!host) > 1) { + error_setg(errp, + "None or one of 'path', 'fd' or 'host' option required."); +@@ -1469,13 +1558,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds")); + sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); + sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); ++#ifndef _WIN32 ++ sock->cmd = g_strdup(cmd); ++#endif + + addr = g_new0(SocketAddressLegacy, 1); ++#ifndef _WIN32 ++ if (path || cmd) { ++#else + if (path) { ++#endif + UnixSocketAddress *q_unix; + addr->type = SOCKET_ADDRESS_TYPE_UNIX; + q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); ++#ifndef _WIN32 ++ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); ++#else + q_unix->path = g_strdup(path); ++#endif + #ifdef CONFIG_LINUX + q_unix->has_tight = true; + q_unix->tight = tight; +diff --git a/chardev/char.c b/chardev/char.c +index 0169d8dde..ce9a21f41 100644 +--- a/chardev/char.c ++++ b/chardev/char.c +@@ -835,6 +835,9 @@ QemuOptsList qemu_chardev_opts = { + },{ + .name = "path", + .type = QEMU_OPT_STRING, ++ },{ ++ .name = "cmd", ++ .type = QEMU_OPT_STRING, + },{ + .name = "host", + .type = QEMU_OPT_STRING, +diff --git a/qapi/char.json b/qapi/char.json +index 7b4215157..37feabdac 100644 +--- a/qapi/char.json ++++ b/qapi/char.json +@@ -250,6 +250,10 @@ + # + # @addr: socket address to listen on (server=true) + # or connect to (server=false) ++# @cmd: command to run via "sh -c" with stdin as one end of ++# a AF_UNIX SOCK_DSTREAM socket pair. The other end ++# is used by the chardev. Either an addr or a cmd can ++# be specified, but not both. + # @tls-creds: the ID of the TLS credentials object (since 2.6) + # @tls-authz: the ID of the QAuthZ authorization object against which + # the client's x509 distinguished name will be validated. This +@@ -276,6 +280,7 @@ + ## + { 'struct': 'ChardevSocket', + 'data': { 'addr': 'SocketAddressLegacy', ++ '*cmd': 'str', + '*tls-creds': 'str', + '*tls-authz' : 'str', + '*server': 'bool', +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0002-virtio-net-fix-map-leaking-on-error-during-receive.patch b/meta/recipes-devtools/qemu/qemu/0002-virtio-net-fix-map-leaking-on-error-during-receive.patch deleted file mode 100644 index 59ccfdd03c..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0002-virtio-net-fix-map-leaking-on-error-during-receive.patch +++ /dev/null @@ -1,43 +0,0 @@ -CVE: CVE-2022-26353 -Upstream-Status: Backport -Signed-off-by: Ross Burton - -From 4d65ecbddd16f38a8cf23b3053ca5c3594f8d4a4 Mon Sep 17 00:00:00 2001 -From: Jason Wang -Date: Tue, 8 Mar 2022 10:42:51 +0800 -Subject: [PATCH 2/2] virtio-net: fix map leaking on error during receive - -Commit bedd7e93d0196 ("virtio-net: fix use after unmap/free for sg") -tries to fix the use after free of the sg by caching the virtqueue -elements in an array and unmap them at once after receiving the -packets, But it forgot to unmap the cached elements on error which -will lead to leaking of mapping and other unexpected results. - -Fixing this by detaching the cached elements on error. This addresses -CVE-2022-26353. - -Reported-by: Victor Tom -Cc: qemu-stable@nongnu.org -Fixes: CVE-2022-26353 -Fixes: bedd7e93d0196 ("virtio-net: fix use after unmap/free for sg") -Reviewed-by: Michael S. Tsirkin -Signed-off-by: Jason Wang ---- - hw/net/virtio-net.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index f2014d5ea0..e1f4748831 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -1862,6 +1862,7 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, - - err: - for (j = 0; j < i; j++) { -+ virtqueue_detach_element(q->rx_vq, elems[j], lens[j]); - g_free(elems[j]); - } - --- -2.25.1 - diff --git a/meta/recipes-devtools/qemu/qemu/0003-apic-fixup-fallthrough-to-PIC.patch b/meta/recipes-devtools/qemu/qemu/0003-apic-fixup-fallthrough-to-PIC.patch new file mode 100644 index 0000000000..f350ffce47 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0003-apic-fixup-fallthrough-to-PIC.patch @@ -0,0 +1,47 @@ +From dc2a8ccd440ee3741b61606eafed3f7e092f4312 Mon Sep 17 00:00:00 2001 +From: Mark Asselstine +Date: Tue, 26 Feb 2013 11:43:28 -0500 +Subject: [PATCH 03/12] apic: fixup fallthrough to PIC + +Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC +interrupts through the local APIC if the local APIC config says so.] +missed a check to ensure the local APIC is enabled. Since if the local +APIC is disabled it doesn't matter what the local APIC config says. + +If this check isn't done and the guest has disabled the local APIC the +guest will receive a general protection fault, similar to what is seen +here: + +https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html + +The GPF is caused by an attempt to service interrupt 0xffffffff. This +comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() +(with the local APIC disabled apic_get_interrupt() returns -1). +apic_accept_pic_intr() returns 0 and thus the interrupt number which +is returned from cpu_get_pic_interrupt(), and which is attempted to be +serviced, is -1. + +Signed-off-by: Mark Asselstine +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] +Signed-off-by: He Zhe + +--- + hw/intc/apic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/intc/apic.c b/hw/intc/apic.c +index 3df11c34d..9506c88ce 100644 +--- a/hw/intc/apic.c ++++ b/hw/intc/apic.c +@@ -605,7 +605,7 @@ int apic_accept_pic_intr(DeviceState *dev) + APICCommonState *s = APIC(dev); + uint32_t lvt0; + +- if (!s) ++ if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) + return -1; + + lvt0 = s->lvt[APIC_LVT_LINT0]; +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch b/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch deleted file mode 100644 index 733789be29..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ce1eceab2350d27960ec254650717085f6a11c9a Mon Sep 17 00:00:00 2001 -From: Jason Wessel -Date: Fri, 28 Mar 2014 17:42:43 +0800 -Subject: [PATCH] qemu: Add addition environment space to boot loader - qemu-system-mips - -Upstream-Status: Inappropriate - OE uses deep paths - -If you create a project with very long directory names like 128 characters -deep and use NFS, the kernel arguments will be truncated. The kernel will -accept longer strings such as 1024 bytes, but the qemu boot loader defaulted -to only 256 bytes. This patch expands the limit. - -Signed-off-by: Jason Wessel -Signed-off-by: Roy Li - ---- - hw/mips/malta.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: qemu-6.0.0/hw/mips/malta.c -=================================================================== ---- qemu-6.0.0.orig/hw/mips/malta.c -+++ qemu-6.0.0/hw/mips/malta.c -@@ -65,7 +65,7 @@ - #define ENVP_PADDR 0x2000 - #define ENVP_VADDR cpu_mips_phys_to_kseg0(NULL, ENVP_PADDR) - #define ENVP_NB_ENTRIES 16 --#define ENVP_ENTRY_SIZE 256 -+#define ENVP_ENTRY_SIZE 1024 - - /* Hardware addresses */ - #define FLASH_ADDRESS 0x1e000000ULL diff --git a/meta/recipes-devtools/qemu/qemu/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch b/meta/recipes-devtools/qemu/qemu/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch new file mode 100644 index 0000000000..6faebd4e09 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0004-configure-Add-pkg-config-handling-for-libgcrypt.patch @@ -0,0 +1,32 @@ +From d8265abdce5dc2bf74b3fccdf2b7257b4f3894f0 Mon Sep 17 00:00:00 2001 +From: He Zhe +Date: Wed, 28 Aug 2019 19:56:28 +0800 +Subject: [PATCH 04/12] configure: Add pkg-config handling for libgcrypt + +libgcrypt may also be controlled by pkg-config, this patch adds pkg-config +handling for libgcrypt. + +Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html] + +Signed-off-by: He Zhe + +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 861de93c4..d45ff2d7c 100644 +--- a/meson.build ++++ b/meson.build +@@ -1063,7 +1063,7 @@ endif + if not gnutls_crypto.found() + if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() + gcrypt = dependency('libgcrypt', version: '>=1.8', +- method: 'config-tool', ++ method: 'pkg-config', + required: get_option('gcrypt'), + kwargs: static_kwargs) + # Debian has removed -lgpg-error from libgcrypt-config +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0005-qemu-Do-not-include-file-if-not-exists.patch b/meta/recipes-devtools/qemu/qemu/0005-qemu-Do-not-include-file-if-not-exists.patch new file mode 100644 index 0000000000..3f3c39f996 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0005-qemu-Do-not-include-file-if-not-exists.patch @@ -0,0 +1,35 @@ +From f39e7bfc5ed07b5ecaeb705c4eae4855ca120d47 Mon Sep 17 00:00:00 2001 +From: Oleksiy Obitotskyy +Date: Wed, 25 Mar 2020 21:21:35 +0200 +Subject: [PATCH 05/12] qemu: Do not include file if not exists + +Script configure checks for if_alg.h and check failed but +if_alg.h still included. + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07188.html] +Signed-off-by: Oleksiy Obitotskyy + +[update patch context] +Signed-off-by: Sakib Sajal + +--- + linux-user/syscall.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index f65045efe..340e0c6f0 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -113,7 +113,9 @@ + #include + #include + #include ++#if defined(CONFIG_AF_ALG) + #include ++#endif + #include + #include + #ifdef HAVE_BTRFS_H +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch b/meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch deleted file mode 100644 index cf8b0e7a45..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch +++ /dev/null @@ -1,243 +0,0 @@ -From bcc63f775e265df69963a4ad7805b8678ace68f0 Mon Sep 17 00:00:00 2001 -From: Alistair Francis -Date: Thu, 21 Dec 2017 11:35:16 -0800 -Subject: [PATCH] chardev: connect socket to a spawned command - -The command is started in a shell (sh -c) with stdin connect to QEMU -via a Unix domain stream socket. QEMU then exchanges data via its own -end of the socket, just like it normally does. - -"-chardev socket" supports some ways of connecting via protocols like -telnet, but that is only a subset of the functionality supported by -tools socat. To use socat instead, for example to connect via a socks -proxy, use: - - -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ - -device usb-serial,chardev=socat - -Beware that commas in the command must be escaped as double commas. - -Or interactively in the console: - (qemu) chardev-add socket,id=cat,cmd=cat - (qemu) device_add usb-serial,chardev=cat - ^ac - # cat >/dev/ttyUSB0 - hello - hello - -Another usage is starting swtpm from inside QEMU. swtpm will -automatically shut down once it looses the connection to the parent -QEMU, so there is no risk of lingering processes: - - -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ - -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ - -device tpm-tis,tpmdev=tpm0 - -The patch was discussed upstream, but QEMU developers believe that the -code calling QEMU should be responsible for managing additional -processes. In OE-core, that would imply enhancing runqemu and -oeqa. This patch is a simpler solution. - -Because it is not going upstream, the patch was written so that it is -as simple as possible. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Patrick Ohly - ---- - chardev/char-socket.c | 101 ++++++++++++++++++++++++++++++++++++++++++ - chardev/char.c | 3 ++ - qapi/char.json | 5 +++ - 3 files changed, 109 insertions(+) - -Index: qemu-6.2.0/chardev/char-socket.c -=================================================================== ---- qemu-6.2.0.orig/chardev/char-socket.c -+++ qemu-6.2.0/chardev/char-socket.c -@@ -1362,6 +1362,67 @@ static bool qmp_chardev_validate_socket( - return true; - } - -+#ifndef _WIN32 -+static void chardev_open_socket_cmd(Chardev *chr, -+ const char *cmd, -+ Error **errp) -+{ -+ int fds[2] = { -1, -1 }; -+ QIOChannelSocket *sioc = NULL; -+ pid_t pid = -1; -+ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; -+ -+ /* -+ * We need a Unix domain socket for commands like swtpm and a single -+ * connection, therefore we cannot use qio_channel_command_new_spawn() -+ * without patching it first. Duplicating the functionality is easier. -+ */ -+ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { -+ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); -+ goto error; -+ } -+ -+ pid = qemu_fork(errp); -+ if (pid < 0) { -+ goto error; -+ } -+ -+ if (!pid) { -+ /* child */ -+ dup2(fds[1], STDIN_FILENO); -+ execv(argv[0], (char * const *)argv); -+ _exit(1); -+ } -+ -+ /* -+ * Hand over our end of the socket pair to the qio channel. -+ * -+ * We don't reap the child because it is expected to keep -+ * running. We also don't support the "reconnect" option for the -+ * same reason. -+ */ -+ sioc = qio_channel_socket_new_fd(fds[0], errp); -+ if (!sioc) { -+ goto error; -+ } -+ fds[0] = -1; -+ -+ g_free(chr->filename); -+ chr->filename = g_strdup_printf("cmd:%s", cmd); -+ tcp_chr_new_client(chr, sioc); -+ -+ error: -+ if (fds[0] >= 0) { -+ close(fds[0]); -+ } -+ if (fds[1] >= 0) { -+ close(fds[1]); -+ } -+ if (sioc) { -+ object_unref(OBJECT(sioc)); -+ } -+} -+#endif - - static void qmp_chardev_open_socket(Chardev *chr, - ChardevBackend *backend, -@@ -1370,6 +1431,9 @@ static void qmp_chardev_open_socket(Char - { - SocketChardev *s = SOCKET_CHARDEV(chr); - ChardevSocket *sock = backend->u.socket.data; -+#ifndef _WIN32 -+ const char *cmd = sock->cmd; -+#endif - bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; - bool is_listen = sock->has_server ? sock->server : true; - bool is_telnet = sock->has_telnet ? sock->telnet : false; -@@ -1440,6 +1504,14 @@ static void qmp_chardev_open_socket(Char - - update_disconnected_filename(s); - -+#ifndef _WIN32 -+ if (cmd) { -+ chardev_open_socket_cmd(chr, cmd, errp); -+ -+ /* everything ready (or failed permanently) before we return */ -+ *be_opened = true; -+ } else -+#endif - if (s->is_listen) { - if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, - is_waitconnect, errp) < 0) { -@@ -1459,6 +1531,9 @@ static void qemu_chr_parse_socket(QemuOp - const char *host = qemu_opt_get(opts, "host"); - const char *port = qemu_opt_get(opts, "port"); - const char *fd = qemu_opt_get(opts, "fd"); -+#ifndef _WIN32 -+ const char *cmd = qemu_opt_get(opts, "cmd"); -+#endif - #ifdef CONFIG_LINUX - bool tight = qemu_opt_get_bool(opts, "tight", true); - bool abstract = qemu_opt_get_bool(opts, "abstract", false); -@@ -1466,6 +1541,20 @@ static void qemu_chr_parse_socket(QemuOp - SocketAddressLegacy *addr; - ChardevSocket *sock; - -+#ifndef _WIN32 -+ if (cmd) { -+ /* -+ * Here we have to ensure that no options are set which are incompatible with -+ * spawning a command, otherwise unmodified code that doesn't know about -+ * command spawning (like socket_reconnect_timeout()) might get called. -+ */ -+ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { -+ error_setg(errp, "chardev: socket: cmd does not support any additional options"); -+ return; -+ } -+ } else -+#endif -+ - if ((!!path + !!fd + !!host) != 1) { - error_setg(errp, - "Exactly one of 'path', 'fd' or 'host' required"); -@@ -1516,13 +1605,24 @@ static void qemu_chr_parse_socket(QemuOp - sock->tls_creds = g_strdup(qemu_opt_get(opts, "tls-creds")); - sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); - sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); -+#ifndef _WIN32 -+ sock->cmd = g_strdup(cmd); -+#endif - - addr = g_new0(SocketAddressLegacy, 1); -+#ifndef _WIN32 -+ if (path || cmd) { -+#else - if (path) { -+#endif - UnixSocketAddress *q_unix; - addr->type = SOCKET_ADDRESS_TYPE_UNIX; - q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); -+#ifndef _WIN32 -+ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); -+#else - q_unix->path = g_strdup(path); -+#endif - #ifdef CONFIG_LINUX - q_unix->has_tight = true; - q_unix->tight = tight; -Index: qemu-6.2.0/chardev/char.c -=================================================================== ---- qemu-6.2.0.orig/chardev/char.c -+++ qemu-6.2.0/chardev/char.c -@@ -836,6 +836,9 @@ QemuOptsList qemu_chardev_opts = { - .name = "path", - .type = QEMU_OPT_STRING, - },{ -+ .name = "cmd", -+ .type = QEMU_OPT_STRING, -+ },{ - .name = "host", - .type = QEMU_OPT_STRING, - },{ -Index: qemu-6.2.0/qapi/char.json -=================================================================== ---- qemu-6.2.0.orig/qapi/char.json -+++ qemu-6.2.0/qapi/char.json -@@ -250,6 +250,10 @@ - # - # @addr: socket address to listen on (server=true) - # or connect to (server=false) -+# @cmd: command to run via "sh -c" with stdin as one end of -+# a AF_UNIX SOCK_DSTREAM socket pair. The other end -+# is used by the chardev. Either an addr or a cmd can -+# be specified, but not both. - # @tls-creds: the ID of the TLS credentials object (since 2.6) - # @tls-authz: the ID of the QAuthZ authorization object against which - # the client's x509 distinguished name will be validated. This -@@ -276,6 +280,7 @@ - ## - { 'struct': 'ChardevSocket', - 'data': { 'addr': 'SocketAddressLegacy', -+ '*cmd': 'str', - '*tls-creds': 'str', - '*tls-authz' : 'str', - '*server': 'bool', diff --git a/meta/recipes-devtools/qemu/qemu/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch b/meta/recipes-devtools/qemu/qemu/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch new file mode 100644 index 0000000000..75c0369318 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch @@ -0,0 +1,52 @@ +From 375cae3dd6151ef33cae8f243f6a2c2da6c0c356 Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Fri, 8 Jan 2021 17:27:06 +0000 +Subject: [PATCH 06/12] qemu: Add some user space mmap tweaks to address musl + 32 bit + +When using qemu-i386 to build qemux86 webkitgtk on musl, it sits in an +infinite loop of mremap calls of ever decreasing/increasing addresses. + +I suspect something in the musl memory allocation code loops indefinitely +if it only sees ENOMEM and only exits when it hits EFAULT. + +According to the docs, trying to mremap outside the address space +can/should return EFAULT and changing this allows the build to succeed. + +A better return value for the other cases of invalid addresses is EINVAL +rather than ENOMEM so adjust the other part of the test to this. + +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html] +Signed-off-by: Richard Purdie -Date: Tue, 26 Feb 2013 11:43:28 -0500 -Subject: [PATCH] apic: fixup fallthrough to PIC - -Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC -interrupts through the local APIC if the local APIC config says so.] -missed a check to ensure the local APIC is enabled. Since if the local -APIC is disabled it doesn't matter what the local APIC config says. - -If this check isn't done and the guest has disabled the local APIC the -guest will receive a general protection fault, similar to what is seen -here: - -https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html - -The GPF is caused by an attempt to service interrupt 0xffffffff. This -comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() -(with the local APIC disabled apic_get_interrupt() returns -1). -apic_accept_pic_intr() returns 0 and thus the interrupt number which -is returned from cpu_get_pic_interrupt(), and which is attempted to be -serviced, is -1. - -Signed-off-by: Mark Asselstine -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] -Signed-off-by: He Zhe - ---- - hw/intc/apic.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: qemu-6.0.0/hw/intc/apic.c -=================================================================== ---- qemu-6.0.0.orig/hw/intc/apic.c -+++ qemu-6.0.0/hw/intc/apic.c -@@ -606,7 +606,7 @@ int apic_accept_pic_intr(DeviceState *de - APICCommonState *s = APIC(dev); - uint32_t lvt0; - -- if (!s) -+ if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) - return -1; - - lvt0 = s->lvt[APIC_LVT_LINT0]; diff --git a/meta/recipes-devtools/qemu/qemu/0007-qemu-Determinism-fixes.patch b/meta/recipes-devtools/qemu/qemu/0007-qemu-Determinism-fixes.patch new file mode 100644 index 0000000000..0d7dae3689 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0007-qemu-Determinism-fixes.patch @@ -0,0 +1,34 @@ +From 50bab5c2605b609ea7ea154f57a9be96d656725a Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Mon, 1 Mar 2021 13:00:47 +0000 +Subject: [PATCH 07/12] qemu: Determinism fixes + +When sources are included within debug information, a couple of areas of the +qemu build are not reproducible due to either full buildpaths or timestamps. + +Replace the full paths with relative ones. I couldn't figure out how to get +meson to pass relative paths but we can fix that in the script. + +Upstream-Status: Pending [some version of all/part of this may be accepted] +RP 2021/3/1 + +--- + scripts/decodetree.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/decodetree.py b/scripts/decodetree.py +index a03dc6b5e..4ea24c1f3 100644 +--- a/scripts/decodetree.py ++++ b/scripts/decodetree.py +@@ -1328,7 +1328,7 @@ def main(): + toppat = ExcMultiPattern(0) + + for filename in args: +- input_file = filename ++ input_file = os.path.relpath(filename) + f = open(filename, 'rt', encoding='utf-8') + parse_file(f, toppat) + f.close() +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch b/meta/recipes-devtools/qemu/qemu/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch new file mode 100644 index 0000000000..43d3c7cf1f --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0008-tests-meson.build-use-relative-path-to-refer-to-file.patch @@ -0,0 +1,38 @@ +From 2bf9388b801d4389e2d57e95a7897bfc1c42786e Mon Sep 17 00:00:00 2001 +From: Changqing Li +Date: Thu, 14 Jan 2021 06:33:04 +0000 +Subject: [PATCH 08/12] tests/meson.build: use relative path to refer to files + +Fix error like: +Fatal error: can't create tests/ptimer-test.p/..._qemu-5.2.0_hw_core_ptimer.c.o: File name too long + +when build path is too long, use meson.source_root() will make this +filename too long. Fixed by using relative path to refer to files + +Upstream-Status: Submitted [send to qemu-devel] + +Signed-off-by: Changqing Li + +--- + tests/unit/meson.build | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/unit/meson.build b/tests/unit/meson.build +index 96b295263..e4c3246dc 100644 +--- a/tests/unit/meson.build ++++ b/tests/unit/meson.build +@@ -44,9 +44,9 @@ tests = { + 'test-keyval': [testqapi], + 'test-logging': [], + 'test-uuid': [], +- 'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'], ++ 'ptimer-test': ['ptimer-test-stubs.c', '../../hw/core/ptimer.c'], + 'test-qapi-util': [], +- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'], ++ 'test-smp-parse': [qom, '../../hw/core/machine-smp.c'], + } + + if have_system or have_tools +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch b/meta/recipes-devtools/qemu/qemu/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch new file mode 100644 index 0000000000..23d0a69802 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch @@ -0,0 +1,49 @@ +From ebf4bb2f51da83af0c61480414cfa156f7308b34 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 21 Mar 2022 10:09:38 -0700 +Subject: [PATCH 09/12] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux + systems + +linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures +which include asm-generic/mman.h and mips/powerpc are not including this +file in linux/mman.h, therefore these should be defined for such +architectures on Linux as well. This fixes build on mips/musl/linux + +Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05298.html] +Signed-off-by: Khem Raj +Cc: Zhang Yi +Cc: Michael S. Tsirkin + +--- + util/mmap-alloc.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c +index 893d86435..86d3cda24 100644 +--- a/util/mmap-alloc.c ++++ b/util/mmap-alloc.c +@@ -10,14 +10,18 @@ + * later. See the COPYING file in the top-level directory. + */ + ++#include "qemu/osdep.h" + #ifdef CONFIG_LINUX + #include +-#else /* !CONFIG_LINUX */ ++#endif /* CONFIG_LINUX */ ++ ++#ifndef MAP_SYNC + #define MAP_SYNC 0x0 ++#endif /* MAP_SYNC */ ++#ifndef MAP_SHARED_VALIDATE + #define MAP_SHARED_VALIDATE 0x0 +-#endif /* CONFIG_LINUX */ ++#endif /* MAP_SHARED_VALIDATE */ + +-#include "qemu/osdep.h" + #include "qemu/mmap-alloc.h" + #include "qemu/host-utils.h" + #include "qemu/cutils.h" +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch b/meta/recipes-devtools/qemu/qemu/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch deleted file mode 100644 index 4298964dfa..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0010-configure-Add-pkg-config-handling-for-libgcrypt.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b51e6dd833172954c718bd600d846540eeb07220 Mon Sep 17 00:00:00 2001 -From: He Zhe -Date: Wed, 28 Aug 2019 19:56:28 +0800 -Subject: [PATCH] configure: Add pkg-config handling for libgcrypt - -libgcrypt may also be controlled by pkg-config, this patch adds pkg-config -handling for libgcrypt. - -Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html] - -Signed-off-by: He Zhe - ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index b3e7ec0e9..4cbe715b7 100644 ---- a/meson.build -+++ b/meson.build -@@ -874,7 +874,7 @@ endif - if not gnutls_crypto.found() - if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() - gcrypt = dependency('libgcrypt', version: '>=1.8', -- method: 'config-tool', -+ method: 'pkg-config', - required: get_option('gcrypt'), - kwargs: static_kwargs) - # Debian has removed -lgpg-error from libgcrypt-config diff --git a/meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch b/meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch new file mode 100644 index 0000000000..826d42fc20 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch @@ -0,0 +1,57 @@ +From 52c38fa9f3a790a7c2805e7d8cce3ea9262d6ae2 Mon Sep 17 00:00:00 2001 +From: Yuval Shaia +Date: Tue, 12 Apr 2022 11:01:51 +0100 +Subject: [PATCH 10/12] hw/pvrdma: Protect against buggy or malicious guest + driver + +Guest driver might execute HW commands when shared buffers are not yet +allocated. +This might happen on purpose (malicious guest) or because some other +guest/host address mapping. +We need to protect againts such case. + +Reported-by: Mauro Matteo Cascella +Signed-off-by: Yuval Shaia + +CVE: CVE-2022-1050 +Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05197.html] + +--- + hw/rdma/vmw/pvrdma_cmd.c | 6 ++++++ + hw/rdma/vmw/pvrdma_main.c | 3 ++- + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c +index da7ddfa54..89db963c4 100644 +--- a/hw/rdma/vmw/pvrdma_cmd.c ++++ b/hw/rdma/vmw/pvrdma_cmd.c +@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev) + + dsr_info = &dev->dsr_info; + ++ if (!dsr_info->dsr) { ++ /* Buggy or malicious guest driver */ ++ rdma_error_report("Exec command without dsr, req or rsp buffers"); ++ goto out; ++ } ++ + if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) / + sizeof(struct cmd_handler)) { + rdma_error_report("Unsupported command"); +diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c +index 91206dbb8..0b7d908e2 100644 +--- a/hw/rdma/vmw/pvrdma_main.c ++++ b/hw/rdma/vmw/pvrdma_main.c +@@ -249,7 +249,8 @@ static void init_dsr_dev_caps(PVRDMADev *dev) + { + struct pvrdma_device_shared_region *dsr; + +- if (dev->dsr_info.dsr == NULL) { ++ if (!dev->dsr_info.dsr) { ++ /* Buggy or malicious guest driver */ + rdma_error_report("Can't initialized DSR"); + return; + } +-- +2.30.2 + diff --git a/meta/recipes-devtools/qemu/qemu/cross.patch b/meta/recipes-devtools/qemu/qemu/cross.patch index bdb77ec7d0..d1256a1229 100644 --- a/meta/recipes-devtools/qemu/qemu/cross.patch +++ b/meta/recipes-devtools/qemu/qemu/cross.patch @@ -1,7 +1,7 @@ -From f51ece86f84c877f255746cba22a6745f37d2b7f Mon Sep 17 00:00:00 2001 +From 76c3fc4c87231bed32974ebbbdb5079cff45a6b7 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 5 Jan 2021 23:00:14 +0000 -Subject: [PATCH] qemu: Upgrade 5.1.0->5.2.0 +Subject: [PATCH 12/12] qemu: Upgrade 5.1.0->5.2.0 We need to be able to trigger configure's cross code but we don't want to set cross_prefix as it does other things we don't want. Patch things @@ -9,23 +9,24 @@ so we can do what we need in the target config case. Upstream-Status: Inappropriate [may be rewritten in a way upstream may accept?] Signed-off-by: Richard Purdie + --- configure | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configure b/configure -index 9a79a004d..563b7827f 100755 +index 7c08c1835..0613279f9 100755 --- a/configure +++ b/configure -@@ -5128,7 +5128,6 @@ if test "$skip_meson" = no; then +@@ -3118,7 +3118,6 @@ if test "$skip_meson" = no; then fi echo "strip = [$(meson_quote $strip)]" >> $cross echo "windres = [$(meson_quote $windres)]" >> $cross - if test "$cross_compile" = "yes"; then cross_arg="--cross-file config-meson.cross" echo "[host_machine]" >> $cross - if test "$mingw32" = "yes" ; then -@@ -5160,9 +5159,6 @@ if test "$skip_meson" = no; then + echo "system = '$targetos'" >> $cross +@@ -3136,9 +3135,6 @@ if test "$skip_meson" = no; then else echo "endian = 'little'" >> $cross fi @@ -36,5 +37,5 @@ index 9a79a004d..563b7827f 100755 rm -rf meson-private meson-info meson-logs -- -2.17.1 +2.30.2 diff --git a/meta/recipes-devtools/qemu/qemu/determinism.patch b/meta/recipes-devtools/qemu/qemu/determinism.patch deleted file mode 100644 index 330a31204d..0000000000 --- a/meta/recipes-devtools/qemu/qemu/determinism.patch +++ /dev/null @@ -1,22 +0,0 @@ -When sources are included within debug information, a couple of areas of the -qemu build are not reproducible due to either full buildpaths or timestamps. - -Replace the full paths with relative ones. I couldn't figure out how to get -meson to pass relative paths but we can fix that in the script. - -Upstream-Status: Pending [some version of all/part of this may be accepted] -RP 2021/3/1 - -Index: qemu-6.0.0/scripts/decodetree.py -=================================================================== ---- qemu-6.0.0.orig/scripts/decodetree.py -+++ qemu-6.0.0/scripts/decodetree.py -@@ -1304,7 +1304,7 @@ def main(): - toppat = ExcMultiPattern(0) - - for filename in args: -- input_file = filename -+ input_file = os.path.relpath(filename) - f = open(filename, 'rt', encoding='utf-8') - parse_file(f, toppat) - f.close() diff --git a/meta/recipes-devtools/qemu/qemu/mmap2.patch b/meta/recipes-devtools/qemu/qemu/mmap2.patch deleted file mode 100644 index e115473b70..0000000000 --- a/meta/recipes-devtools/qemu/qemu/mmap2.patch +++ /dev/null @@ -1,39 +0,0 @@ -When using qemu-i386 to build qemux86 webkitgtk on musl, it sits in an -infinite loop of mremap calls of ever decreasing/increasing addresses. - -I suspect something in the musl memory allocation code loops indefinitely -if it only sees ENOMEM and only exits when it hits EFAULT. - -According to the docs, trying to mremap outside the address space -can/should return EFAULT and changing this allows the build to succeed. - -A better return value for the other cases of invalid addresses is EINVAL -rather than ENOMEM so adjust the other part of the test to this. - -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html] -Signed-off-by: Richard Purdie - -From ec2d4aa7ca28127faa7ccdbf89d2bf5a4984b62f Mon Sep 17 00:00:00 2001 -From: Joelle van Dyne -Date: Sun, 27 Feb 2022 13:06:55 -0800 -Subject: [PATCH] pc: add option to disable PS/2 mouse/keyboard - -On some older software like Windows 7 installer, having both a PS/2 -mouse and USB mouse results in only one device working property (which -might be a different device each boot). While the workaround to not use -a USB mouse with such software is valid, it creates an inconsistent -experience if the user wishes to always use a USB mouse. - -This introduces a new machine property to inhibit the creation of the -i8042 PS/2 controller. - -Signed-off-by: Joelle van Dyne -Message-Id: <20220227210655.45592-1-j@getutm.app> -Reviewed-by: Michael S. Tsirkin -Signed-off-by: Michael S. Tsirkin ---- - hw/i386/pc.c | 28 ++++++++++++++++++++++++++-- - include/hw/i386/pc.h | 2 ++ - 2 files changed, 28 insertions(+), 2 deletions(-) - -diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index a2ef40ecbc..8a6a089ee2 100644 ---- a/hw/i386/pc.c -+++ b/hw/i386/pc.c -@@ -1008,7 +1008,8 @@ static const MemoryRegionOps ioportF0_io_ops = { - }, - }; - --static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) -+static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, -+ bool create_i8042, bool no_vmport) - { - int i; - DriveInfo *fd[MAX_FD]; -@@ -1030,6 +1031,10 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) - } - } - -+ if (!create_i8042) { -+ return; -+ } -+ - i8042 = isa_create_simple(isa_bus, "i8042"); - if (!no_vmport) { - isa_create_simple(isa_bus, TYPE_VMPORT); -@@ -1125,7 +1130,8 @@ void pc_basic_device_init(struct PCMachineState *pcms, - i8257_dma_init(isa_bus, 0); - - /* Super I/O */ -- pc_superio_init(isa_bus, create_fdctrl, pcms->vmport != ON_OFF_AUTO_ON); -+ pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled, -+ pcms->vmport != ON_OFF_AUTO_ON); - } - - void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) -@@ -1506,6 +1512,20 @@ static void pc_machine_set_hpet(Object *obj, bool value, Error **errp) - pcms->hpet_enabled = value; - } - -+static bool pc_machine_get_i8042(Object *obj, Error **errp) -+{ -+ PCMachineState *pcms = PC_MACHINE(obj); -+ -+ return pcms->i8042_enabled; -+} -+ -+static void pc_machine_set_i8042(Object *obj, bool value, Error **errp) -+{ -+ PCMachineState *pcms = PC_MACHINE(obj); -+ -+ pcms->i8042_enabled = value; -+} -+ - static bool pc_machine_get_default_bus_bypass_iommu(Object *obj, Error **errp) - { - PCMachineState *pcms = PC_MACHINE(obj); -@@ -1616,6 +1636,7 @@ static void pc_machine_initfn(Object *obj) - pcms->smbus_enabled = true; - pcms->sata_enabled = true; - pcms->pit_enabled = true; -+ pcms->i8042_enabled = true; - pcms->max_fw_size = 8 * MiB; - #ifdef CONFIG_HPET - pcms->hpet_enabled = true; -@@ -1744,6 +1765,9 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) - object_class_property_add_bool(oc, "hpet", - pc_machine_get_hpet, pc_machine_set_hpet); - -+ object_class_property_add_bool(oc, PC_MACHINE_I8042, -+ pc_machine_get_i8042, pc_machine_set_i8042); -+ - object_class_property_add_bool(oc, "default-bus-bypass-iommu", - pc_machine_get_default_bus_bypass_iommu, - pc_machine_set_default_bus_bypass_iommu); -diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h -index 9ab39e428f..642c915aa3 100644 ---- a/include/hw/i386/pc.h -+++ b/include/hw/i386/pc.h -@@ -46,6 +46,7 @@ typedef struct PCMachineState { - bool sata_enabled; - bool pit_enabled; - bool hpet_enabled; -+ bool i8042_enabled; - bool default_bus_bypass_iommu; - uint64_t max_fw_size; - -@@ -62,6 +63,7 @@ typedef struct PCMachineState { - #define PC_MACHINE_SMBUS "smbus" - #define PC_MACHINE_SATA "sata" - #define PC_MACHINE_PIT "pit" -+#define PC_MACHINE_I8042 "i8042" - #define PC_MACHINE_MAX_FW_SIZE "max-fw-size" - /** - * PCMachineClass: --- -2.25.1 - diff --git a/meta/recipes-devtools/qemu/qemu/pvrdma.patch b/meta/recipes-devtools/qemu/qemu/pvrdma.patch deleted file mode 100644 index 7b0335b1dc..0000000000 --- a/meta/recipes-devtools/qemu/qemu/pvrdma.patch +++ /dev/null @@ -1,45 +0,0 @@ -hw/pvrdma: Protect against buggy or malicious guest driver - -Guest driver might execute HW commands when shared buffers are not yet -allocated. -This might happen on purpose (malicious guest) or because some other -guest/host address mapping. -We need to protect againts such case. - -Reported-by: Mauro Matteo Cascella -Signed-off-by: Yuval Shaia - -CVE: CVE-2022-1050 -Upstream-Status: Submitted [https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg05197.html] - -Index: qemu-6.2.0/hw/rdma/vmw/pvrdma_cmd.c -=================================================================== ---- qemu-6.2.0.orig/hw/rdma/vmw/pvrdma_cmd.c -+++ qemu-6.2.0/hw/rdma/vmw/pvrdma_cmd.c -@@ -796,6 +796,12 @@ int pvrdma_exec_cmd(PVRDMADev *dev) - - dsr_info = &dev->dsr_info; - -+ if (!dsr_info->dsr) { -+ /* Buggy or malicious guest driver */ -+ rdma_error_report("Exec command without dsr, req or rsp buffers"); -+ goto out; -+ } -+ - if (dsr_info->req->hdr.cmd >= sizeof(cmd_handlers) / - sizeof(struct cmd_handler)) { - rdma_error_report("Unsupported command"); -Index: qemu-6.2.0/hw/rdma/vmw/pvrdma_main.c -=================================================================== ---- qemu-6.2.0.orig/hw/rdma/vmw/pvrdma_main.c -+++ qemu-6.2.0/hw/rdma/vmw/pvrdma_main.c -@@ -249,7 +249,8 @@ static void init_dsr_dev_caps(PVRDMADev - { - struct pvrdma_device_shared_region *dsr; - -- if (dev->dsr_info.dsr == NULL) { -+ if (!dev->dsr_info.dsr) { -+ /* Buggy or malicious guest driver */ - rdma_error_report("Can't initialized DSR"); - return; - } diff --git a/meta/recipes-devtools/qemu/qemu_6.2.0.bb b/meta/recipes-devtools/qemu/qemu_6.2.0.bb deleted file mode 100644 index 9f7fad9886..0000000000 --- a/meta/recipes-devtools/qemu/qemu_6.2.0.bb +++ /dev/null @@ -1,27 +0,0 @@ -BBCLASSEXTEND = "nativesdk" - -require qemu.inc - -DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" - -DEPENDS:append:libc-musl = " libucontext" - -CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" - -RDEPENDS:${PN}:class-target += "bash" - -EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" -EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" - -PACKAGECONFIG ??= " \ - fdt sdl kvm pie \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ - ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ -" -PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm pie \ - ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ -" -# ppc32 hosts are no longer supported in qemu -COMPATIBLE_HOST:powerpc = "null" diff --git a/meta/recipes-devtools/qemu/qemu_7.0.0.bb b/meta/recipes-devtools/qemu/qemu_7.0.0.bb new file mode 100644 index 0000000000..9f7fad9886 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu_7.0.0.bb @@ -0,0 +1,27 @@ +BBCLASSEXTEND = "nativesdk" + +require qemu.inc + +DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native meson-native" + +DEPENDS:append:libc-musl = " libucontext" + +CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" + +RDEPENDS:${PN}:class-target += "bash" + +EXTRA_OECONF:append:class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF:append:class-target:mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" +EXTRA_OECONF:append:class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" + +PACKAGECONFIG ??= " \ + fdt sdl kvm pie \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \ +" +PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm pie \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer epoxy', '', d)} \ +" +# ppc32 hosts are no longer supported in qemu +COMPATIBLE_HOST:powerpc = "null" -- cgit v1.2.3-54-g00ecf