Accepting request 914657 from home:jziviani:branches:Virtualization

- Fix hardcoded binfmt handler doesn't play well with containers
  (bsc#1186256)
* Patches added:
  qemu-binfmt-conf.sh-allow-overriding-SUS.patch

OBS-URL: https://build.opensuse.org/request/show/914657
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=666
This commit is contained in:
José Ricardo Ziviani 2021-08-27 17:25:34 +00:00 committed by Git OBS Bridge
parent 7f46c79c5d
commit 71af037cf1
4 changed files with 76 additions and 2 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dec6079cff29a3ea44da20e33d71df94105052e298a696c986edeefd7b77b869
size 33352
oid sha256:6c7cd08fed3f27504bf167bf5e157f1368c41b7d0882b42d3d0c0c53794a4029
size 33996

View File

@ -0,0 +1,64 @@
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 19 May 2021 17:24:45 +0200
Subject: qemu-binfmt-conf.sh: allow overriding SUSE-specific argv[0] handling
Git-commit: 0000000000000000000000000000000000000000
References: bsc#1186256
Since abbc0ce ("qemu-binfmt-conf: use qemu-ARCH-binfmt"),
qemu-binfmt-conf.sh automatically replaces the default qemu binfmt wrapper
qemu-$ARCH with qemu-$ARCH-binfmt in order to ensure that argv[0] is
preserved; qemu-$ARCH-binfmt is a link to qemu-binfmt, which is just a
simple wrapper that mangles argv to achieve the desired result.
This is inconvenient in some situations. In particular for running
foreign-arch containers, it's useful to use the binfmt_misc "F" ("fix
binary") flag to pre-load the qemu wrapper in the kernel. That way,
foreign-arch containers can be run just like native containers, without
having to bind-mount interpreters into the container. But that's impossible
with the SUSE binfmt wrapper that needs to exec() a different (native)
executable.
As the qemu-binfmt-conf script supports the --qemu-suffix option anyway,
use it to set the "-binfmt" suffix, thus allowing admins to override the
SUSE default with the option "--qemu-suffix ''".
Signed-off-by: Martin Wilck <mwilck@suse.com>
Acked-by: Jose R Ziviani <jose.ziviani@suse.com>
---
scripts/qemu-binfmt-conf.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index c46e604fa6ef3faaecccaae835ba..76c96815c350d7646aca7877587a 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -185,6 +185,7 @@ Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
--help: display this usage
--qemu-path: set path to qemu interpreter ($QEMU_PATH)
--qemu-suffix: add a suffix to the default interpreter name
+ (default: "-binfmt")
--debian: don't write into /proc,
instead generate update-binfmts templates
--systemd: don't write into /proc,
@@ -316,9 +317,9 @@ qemu_set_binfmts() {
continue
fi
- qemu="$QEMU_PATH/qemu-$cpu-binfmt"
+ qemu="$QEMU_PATH/qemu-$cpu"
if [ "$cpu" = "i486" ] ; then
- qemu="$QEMU_PATH/qemu-i386-binfmt"
+ qemu="$QEMU_PATH/qemu-i386"
fi
qemu="$qemu$QEMU_SUFFIX"
@@ -338,7 +339,7 @@ QEMU_PATH=/usr/bin
CREDENTIAL=no
PERSISTENT=no
PRESERVE_ARG0=no
-QEMU_SUFFIX=""
+QEMU_SUFFIX="-binfmt"
options=$(getopt -o ds:Q:S:e:hc:p:g: -l debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,persistent:,preserve-argv0: -- "$@")
eval set -- "$options"

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Aug 27 17:16:51 UTC 2021 - José Ricardo Ziviani <jose.ziviani@suse.com>
- Fix hardcoded binfmt handler doesn't play well with containers
(bsc#1186256)
* Patches added:
qemu-binfmt-conf.sh-allow-overriding-SUS.patch
-------------------------------------------------------------------
Thu Aug 26 03:35:03 UTC 2021 - José Ricardo Ziviani <jose.ziviani@suse.com>

View File

@ -176,6 +176,7 @@ Patch00040: roms-Makefile-add-cross-file-to-qboot-me.patch
Patch00041: usb-Help-compiler-out-to-avoid-a-warning.patch
Patch00042: qom-handle-case-of-chardev-spice-module-.patch
Patch00043: doc-add-our-support-doc-to-the-main-proj.patch
Patch00044: qemu-binfmt-conf.sh-allow-overriding-SUS.patch
# Patches applied in roms/seabios/:
Patch01000: seabios-use-python2-explicitly-as-needed.patch
Patch01001: seabios-switch-to-python3-as-needed.patch
@ -1110,6 +1111,7 @@ This package records qemu testsuite results and represents successful testing.
%if %{legacy_qemu_kvm}
%patch00043 -p1
%endif
%patch00044 -p1
%patch01000 -p1
%patch01001 -p1
%patch01002 -p1