From a815c92a45c4dcd6e37e99a2a7c3a25e91d913a2557de639e488c3724c3d0b88 Mon Sep 17 00:00:00 2001 From: Dario Faggioli Date: Wed, 5 Oct 2022 11:19:47 +0000 Subject: [PATCH] Accepting request 1008185 from home:dfaggioli:devel:Virtualization - The old qemu-binfmt weappers around the various qemu-$ARCH Linux user emulation binaries (see, e.g., bsc#1186256) are not necessary any longer, and bsc#1143725 can now be considered fixed. * Patches dropped: linux-user-add-binfmt-wrapper-for-argv-0.patch linux-user-binfmt-support-host-binaries.patch OBS-URL: https://build.opensuse.org/request/show/1008185 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=736 --- bundles.tar.xz | 4 +- ...x-user-add-binfmt-wrapper-for-argv-0.patch | 99 ------------------- linux-user-binfmt-support-host-binaries.patch | 56 ----------- ...n-enforce-a-minimum-Linux-kernel-hea.patch | 2 +- ...n-remove-pkgversion-from-CONFIG_STAM.patch | 2 +- qemu.changes | 10 ++ qemu.spec | 92 +++++------------ qemu.spec.in | 36 ------- 8 files changed, 41 insertions(+), 260 deletions(-) delete mode 100644 linux-user-add-binfmt-wrapper-for-argv-0.patch delete mode 100644 linux-user-binfmt-support-host-binaries.patch diff --git a/bundles.tar.xz b/bundles.tar.xz index 2ef4b38a..f94d6061 100644 --- a/bundles.tar.xz +++ b/bundles.tar.xz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16313b28799b38f8a397b8c3886445780eaff2dc86234f366d8ee5fdfcdb5046 -size 44932 +oid sha256:04241a8192981377e1baa044d408dd6f38295f292af74a34a247d14f2aa1845f +size 42692 diff --git a/linux-user-add-binfmt-wrapper-for-argv-0.patch b/linux-user-add-binfmt-wrapper-for-argv-0.patch deleted file mode 100644 index fc4c70e1..00000000 --- a/linux-user-add-binfmt-wrapper-for-argv-0.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Alexander Graf -Date: Fri, 30 Sep 2011 19:40:36 +0200 -Subject: linux-user: add binfmt wrapper for argv[0] handling -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When using qemu's linux-user binaries through binfmt, argv[0] gets lost -along the execution because qemu only gets passed in the full file name -to the executable while argv[0] can be something completely different. - -This breaks in some subtile situations, such as the grep and make test -suites. - -This patch adds a wrapper binary called qemu-$TARGET-binfmt that can be -used with binfmt's P flag which passes the full path _and_ argv[0] to -the binfmt handler. - -The binary would be smart enough to be versatile and only exist in the -system once, creating the qemu binary path names from its own argv[0]. -However, this seemed like it didn't fit the make system too well, so -we're currently creating a new binary for each target archictecture. - -CC: Reinhard Max -Signed-off-by: Alexander Graf -[AF: Rebased onto new Makefile infrastructure, twice] -[AF: Updated for aarch64 for v2.0.0-rc1] -[AF: Rebased onto Makefile changes for v2.1.0-rc0] -[AF: Rebased onto script rewrite for v2.7.0-rc2 - to be fixed] -Signed-off-by: Andreas Färber ---- - linux-user/binfmt.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - meson.build | 5 +++++ - 2 files changed, 47 insertions(+) - -diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c -new file mode 100644 -index 0000000000000000000000000000000000000000..cd1f513b334f3b263d9e4b5adb1981e376429fa6 ---- /dev/null -+++ b/linux-user/binfmt.c -@@ -0,0 +1,42 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+ -+int main(int argc, char **argv, char **envp) -+{ -+ char *binfmt; -+ char **new_argv; -+ -+ /* -+ * Check if our file name ends with -binfmt -+ */ -+ binfmt = argv[0] + strlen(argv[0]) - strlen("-binfmt"); -+ if (strcmp(binfmt, "-binfmt")) { -+ fprintf(stderr, "%s: Invalid executable name\n", argv[0]); -+ exit(1); -+ } -+ if (argc < 3) { -+ fprintf(stderr, "%s: Please use me through binfmt with P flag\n", -+ argv[0]); -+ exit(1); -+ } -+ -+ binfmt[0] = '\0'; -+ /* Now argv[0] is the real qemu binary name */ -+ -+ new_argv = (char **)malloc((argc + 2) * sizeof(*new_argv)); -+ if (argc > 3) { -+ memcpy(&new_argv[4], &argv[3], (argc - 3) * sizeof(*new_argv)); -+ } -+ new_argv[0] = argv[0]; -+ new_argv[1] = (char *)"-0"; -+ new_argv[2] = argv[2]; -+ new_argv[3] = argv[1]; -+ new_argv[argc + 1] = NULL; -+ -+ return execve(new_argv[0], new_argv, envp); -+} -diff --git a/meson.build b/meson.build -index 20fddbd707c91c1baee604202fb1..ce227b6c25e3c71f16416f0a8f25 100644 ---- a/meson.build -+++ b/meson.build -@@ -3585,6 +3585,11 @@ endforeach - - # Other build targets - -+if 'CONFIG_LINUX_USER' in config_target -+ executable('qemu-binfmt', files('linux-user/binfmt.c'), -+ install: true) -+endif -+ - if 'CONFIG_PLUGIN' in config_host - install_headers('include/qemu/qemu-plugin.h') - endif diff --git a/linux-user-binfmt-support-host-binaries.patch b/linux-user-binfmt-support-host-binaries.patch deleted file mode 100644 index 7b25b748..00000000 --- a/linux-user-binfmt-support-host-binaries.patch +++ /dev/null @@ -1,56 +0,0 @@ -From: Alexander Graf -Date: Thu, 2 Feb 2012 18:02:33 +0100 -Subject: linux-user: binfmt: support host binaries - -When we have a working host binary equivalent for the guest binary we're -trying to run, let's just use that instead as it will be a lot faster. - -Signed-off-by: Alexander Graf ---- - linux-user/binfmt.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c -index cd1f513b334f3b263d9e4b5adb19..458f136fb41727702854cae4e542 100644 ---- a/linux-user/binfmt.c -+++ b/linux-user/binfmt.c -@@ -5,6 +5,9 @@ - #include - #include - -+#ifdef __x86_64__ -+#define ARCH_NAME "x86_64" -+#endif - - int main(int argc, char **argv, char **envp) - { -@@ -28,6 +31,29 @@ int main(int argc, char **argv, char **envp) - binfmt[0] = '\0'; - /* Now argv[0] is the real qemu binary name */ - -+#ifdef ARCH_NAME -+ { -+ char *hostbin; -+ char *guestarch; -+ int r; -+ -+ guestarch = strrchr(argv[0], '-') ; -+ if (!guestarch) { -+ goto skip; -+ } -+ guestarch++; -+ r = asprintf(&hostbin, "/emul/" ARCH_NAME "-for-%s/%s", guestarch, argv[1]); -+ if ((r > 0) && !access(hostbin, X_OK)) { -+ /* -+ * We found a host binary replacement for the non-host binary. Let's -+ * use that instead! -+ */ -+ return execve(hostbin, &argv[2], envp); -+ } -+ } -+skip: -+#endif -+ - new_argv = (char **)malloc((argc + 2) * sizeof(*new_argv)); - if (argc > 3) { - memcpy(&new_argv[4], &argv[3], (argc - 3) * sizeof(*new_argv)); diff --git a/meson-enforce-a-minimum-Linux-kernel-hea.patch b/meson-enforce-a-minimum-Linux-kernel-hea.patch index 244127db..4b830322 100644 --- a/meson-enforce-a-minimum-Linux-kernel-hea.patch +++ b/meson-enforce-a-minimum-Linux-kernel-hea.patch @@ -38,7 +38,7 @@ Signed-off-by: Dario Faggioli 1 file changed, 12 insertions(+) diff --git a/meson.build b/meson.build -index 09145d35aa3e684e92da7895ac67..a923eedefd56bc1401a111d6d8f7 100644 +index 41f693a822a7ec58085bb53a8518..6641e86c0107906bb07d6b35d54a 100644 --- a/meson.build +++ b/meson.build @@ -248,6 +248,18 @@ if targetos == 'linux' diff --git a/meson-remove-pkgversion-from-CONFIG_STAM.patch b/meson-remove-pkgversion-from-CONFIG_STAM.patch index 43267696..e90604fd 100644 --- a/meson-remove-pkgversion-from-CONFIG_STAM.patch +++ b/meson-remove-pkgversion-from-CONFIG_STAM.patch @@ -21,7 +21,7 @@ Signed-off-by: Dario Faggioli 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build -index ce227b6c25e3c71f16416f0a8f25..09145d35aa3e684e92da7895ac67 100644 +index 20fddbd707c91c1baee604202fb1..41f693a822a7ec58085bb53a8518 100644 --- a/meson.build +++ b/meson.build @@ -1736,7 +1736,7 @@ config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_opti diff --git a/qemu.changes b/qemu.changes index 3a8060fa..aba4c561 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Oct 4 13:49:43 UTC 2022 - Dario Faggioli + +- The old qemu-binfmt weappers around the various qemu-$ARCH Linux + user emulation binaries (see, e.g., bsc#1186256) are not necessary + any longer, and bsc#1143725 can now be considered fixed. +* Patches dropped: + linux-user-add-binfmt-wrapper-for-argv-0.patch + linux-user-binfmt-support-host-binaries.patch + ------------------------------------------------------------------- Tue Oct 4 11:49:53 UTC 2022 - Dario Faggioli diff --git a/qemu.spec b/qemu.spec index 08915fa2..5dc53c91 100644 --- a/qemu.spec +++ b/qemu.spec @@ -165,35 +165,33 @@ Patch00002: roms-Makefile-add-cross-file-to-qboot-me.patch Patch00003: hw-smbios-handle-both-file-formats-regar.patch Patch00004: Revert-roms-efirom-tests-uefi-test-tools.patch Patch00005: qemu-binfmt-conf-Modify-default-path.patch -Patch00006: linux-user-add-binfmt-wrapper-for-argv-0.patch -Patch00007: linux-user-binfmt-support-host-binaries.patch -Patch00008: linux-user-Fake-proc-cpuinfo.patch -Patch00009: linux-user-use-target_ulong.patch -Patch00010: linux-user-lseek-explicitly-cast-non-set.patch -Patch00011: PPC-KVM-Disable-mmu-notifier-check.patch -Patch00012: Make-char-muxer-more-robust-wrt-small-FI.patch -Patch00013: qemu-bridge-helper-reduce-security-profi.patch -Patch00014: Raise-soft-address-space-limit-to-hard-l.patch -Patch00015: increase-x86_64-physical-bits-to-42.patch -Patch00016: xen_disk-Add-suse-specific-flush-disable.patch -Patch00017: xen-add-block-resize-support-for-xen-dis.patch -Patch00018: xen-ignore-live-parameter-from-xen-save-.patch -Patch00019: scsi-generic-replace-logical-block-count.patch -Patch00020: hw-scsi-megasas-check-for-NULL-frame-in-.patch -Patch00021: scsi-generic-check-for-additional-SG_IO-.patch -Patch00022: Revert-tests-qtest-enable-more-vhost-use.patch -Patch00023: tests-change-error-message-in-test-162.patch -Patch00024: tests-qemu-iotests-Triple-timeout-of-i-o.patch -Patch00025: Disable-some-tests-that-have-problems-in.patch -Patch00026: Make-installed-scripts-explicitly-python.patch -Patch00027: meson-install-ivshmem-client-and-ivshmem.patch -Patch00028: meson-remove-pkgversion-from-CONFIG_STAM.patch -Patch00029: linux-user-use-max-as-default-CPU-model-.patch -Patch00030: net-tulip-Restrict-DMA-engine-to-memorie.patch -Patch00031: linux-user-add-more-compat-ioctl-definit.patch -Patch00032: linux-user-remove-conditionals-for-many-.patch -Patch00033: meson-enforce-a-minimum-Linux-kernel-hea.patch -Patch00034: linux-user-drop-conditionals-for-obsolet.patch +Patch00006: linux-user-Fake-proc-cpuinfo.patch +Patch00007: linux-user-use-target_ulong.patch +Patch00008: linux-user-lseek-explicitly-cast-non-set.patch +Patch00009: PPC-KVM-Disable-mmu-notifier-check.patch +Patch00010: Make-char-muxer-more-robust-wrt-small-FI.patch +Patch00011: qemu-bridge-helper-reduce-security-profi.patch +Patch00012: Raise-soft-address-space-limit-to-hard-l.patch +Patch00013: increase-x86_64-physical-bits-to-42.patch +Patch00014: xen_disk-Add-suse-specific-flush-disable.patch +Patch00015: xen-add-block-resize-support-for-xen-dis.patch +Patch00016: xen-ignore-live-parameter-from-xen-save-.patch +Patch00017: scsi-generic-replace-logical-block-count.patch +Patch00018: hw-scsi-megasas-check-for-NULL-frame-in-.patch +Patch00019: scsi-generic-check-for-additional-SG_IO-.patch +Patch00020: Revert-tests-qtest-enable-more-vhost-use.patch +Patch00021: tests-change-error-message-in-test-162.patch +Patch00022: tests-qemu-iotests-Triple-timeout-of-i-o.patch +Patch00023: Disable-some-tests-that-have-problems-in.patch +Patch00024: Make-installed-scripts-explicitly-python.patch +Patch00025: meson-install-ivshmem-client-and-ivshmem.patch +Patch00026: meson-remove-pkgversion-from-CONFIG_STAM.patch +Patch00027: linux-user-use-max-as-default-CPU-model-.patch +Patch00028: net-tulip-Restrict-DMA-engine-to-memorie.patch +Patch00029: linux-user-add-more-compat-ioctl-definit.patch +Patch00030: linux-user-remove-conditionals-for-many-.patch +Patch00031: meson-enforce-a-minimum-Linux-kernel-hea.patch +Patch00032: linux-user-drop-conditionals-for-obsolet.patch # Patches applied in roms/seabios/: Patch01000: seabios-switch-to-python3-as-needed.patch Patch01001: enable-cross-compilation-on-ARM.patch @@ -467,8 +465,6 @@ syscall layer occurs on the native hardware and operating system. %_bindir/qemu-x86_64 %_bindir/qemu-xtensa %_bindir/qemu-xtensaeb -%_bindir/qemu-binfmt -%_bindir/qemu-*-binfmt %_sbindir/qemu-binfmt-conf.sh # End of description and files for qemu-linux-user @@ -2186,40 +2182,6 @@ rm -rf %{buildroot}%_datadir/qemu/keymaps unlink %{buildroot}%_datadir/qemu/trace-events-all install -d -m 755 %{buildroot}%_sbindir install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64_be-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-alpha-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-armeb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-cris-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hexagon-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hppa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-i386-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-m68k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblaze-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblazeel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-nios2-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-or1k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64le-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-s390x-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4eb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc32plus-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-x86_64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt # End of additional installation steps for qemu-linux-user %else diff --git a/qemu.spec.in b/qemu.spec.in index 251d7d63..97ecc103 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -408,8 +408,6 @@ syscall layer occurs on the native hardware and operating system. %_bindir/qemu-x86_64 %_bindir/qemu-xtensa %_bindir/qemu-xtensaeb -%_bindir/qemu-binfmt -%_bindir/qemu-*-binfmt %_sbindir/qemu-binfmt-conf.sh # End of description and files for qemu-linux-user @@ -2127,40 +2125,6 @@ rm -rf %{buildroot}%_datadir/qemu/keymaps unlink %{buildroot}%_datadir/qemu/trace-events-all install -d -m 755 %{buildroot}%_sbindir install -m 755 scripts/qemu-binfmt-conf.sh %{buildroot}%_sbindir -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-aarch64_be-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-alpha-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-arm-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-armeb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-cris-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hexagon-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-hppa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-i386-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-m68k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblaze-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-microblazeel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mips64el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsel-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-mipsn32el-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-nios2-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-or1k-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-ppc64le-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv32-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-riscv64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-s390x-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sh4eb-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc32plus-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-sparc64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-x86_64-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensa-binfmt -ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt # End of additional installation steps for qemu-linux-user %else