Debian Bug report logs - #924667
qemu-user-static: setting up of binfmt_misc is slightly naive about cpu features

version graph

Package: qemu-user-static; Maintainer for qemu-user-static is Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>; Source for qemu-user-static is src:qemu (PTS, buildd, popcon).

Reported by: Alex Bennée <alex.bennee@linaro.org>

Date: Fri, 15 Mar 2019 15:54:05 UTC

Severity: normal

Tags: moreinfo

Found in version qemu/1:3.1+dfsg-4

Fixed in versions qemu/1:8.0+dfsg-1, 1:8.0+dfsg-1

Done: Michael Tokarev <mjt@tls.msk.ru>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, alex.bennee@linaro.org, Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>:
Bug#924667; Package qemu-user-static. (Fri, 15 Mar 2019 15:54:07 GMT) (full text, mbox, link).


Acknowledgement sent to Alex Bennée <alex.bennee@linaro.org>:
New Bug report received and forwarded. Copy sent to alex.bennee@linaro.org, Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>. (Fri, 15 Mar 2019 15:54:07 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Alex Bennée <alex.bennee@linaro.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: qemu-user-static: setting up of binfmt_misc is slightly naive about cpu features
Date: Fri, 15 Mar 2019 15:52:44 +0000
Package: qemu-user-static
Version: 1:3.1+dfsg-4
Severity: normal

Dear Maintainer,

Trying to build gitlab-runner on an ThunderX arm64 box it tries to run a
docker image with armhf binaries which fails:

  standard_init_linux.go:207: exec user process caused "exec format error"

You can replicate by running:

  14:30:41 [root@qemu-test:/v/l/d/info] 1 # uname -a
  Linux qemu-test 4.20.0 #5 SMP Tue Jan 8 10:57:44 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
  14:30:46 [root@qemu-test:/v/l/d/info] # arch-test -n armhf
  armhf: not supported on this machine/kernel

The underlying reason is because binfmt_misc isn't set up for armhf
binaries because qemu-user-static.postinst does:

  # find which fmts needs to be filtered out, which is arch-dependent.
  # Drop support for emulating amd64 on i386, http://bugs.debian.org/604712
  case "$DPKG_MAINTSCRIPT_ARCH" in
    amd64 | i386) omit="i386|x86_64" ;;
    arm | armel | armhf | arm64) omit="arm|aarch64" ;;
    mips | mipsel) omit="$DPKG_MAINTSCRIPT_ARCH" ;;
    ppc64 | powerpc) omit="ppc|ppc64|ppc64abi32" ;;
    ppc64el) omit="ppc64le" ;;
    s390x) omit="s390x" ;;
    sparc | sparc64) omit="sparc|sparc32plus|sparc64" ;;
    *) omit="$DPKG_MAINTSCRIPT_ARCH" ;;
  esac

Which is certainly not true for all aarch64 CPUs. Some do not support
aarch32. The following change makes it work but requires arch-test as a
dependency:

  # find which fmts needs to be filtered out, which is arch-dependent.
  # Drop support for emulating amd64 on i386, http://bugs.debian.org/604712
  case "$DPKG_MAINTSCRIPT_ARCH" in
    amd64 | i386) omit="i386|x86_64" ;;
    arm | armel | armhf) omit="arm" ;;
    arm64 )
        if arch-test -n armhf > /dev/null; then
            omit="arm|aarch64"
        else
            omit="aarch64"
        fi
        ;;
    mips | mipsel) omit="$DPKG_MAINTSCRIPT_ARCH" ;;
    ppc64 | powerpc) omit="ppc|ppc64|ppc64abi32" ;;
    ppc64el) omit="ppc64le" ;;
    s390x) omit="s390x" ;;
    sparc | sparc64) omit="sparc|sparc32plus|sparc64" ;;
    *) omit="$DPKG_MAINTSCRIPT_ARCH" ;;
  esac

This logic is repeated in the prerm script so there is probably some
scope in cleaning up and sharing the logic.

-- System Information:
Ubuntu Release: bionic
Debian Release: buster/sid
Architecture: arm64

I found this on bionic but the bug exists upstream as well:

binfmt-support/bionic,now 2.1.8-2 arm64 [installed,automatic]
qemu-user-static/bionic-updates,now 1:2.11+dfsg-1ubuntu7.10 arm64 [installed]

-- no debconf information

--
Alex Bennée



Information forwarded to debian-bugs-dist@lists.debian.org, Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>:
Bug#924667; Package qemu-user-static. (Sun, 01 May 2022 15:33:02 GMT) (full text, mbox, link).


Acknowledgement sent to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list. Copy sent to Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>. (Sun, 01 May 2022 15:33:02 GMT) (full text, mbox, link).


Message #10 received at 924667@bugs.debian.org (full text, mbox, reply):

From: Michael Tokarev <mjt@tls.msk.ru>
To: 924667@bugs.debian.org
Subject: Re: Bug#924667: qemu-user-static: setting up of binfmt_misc is slightly naive about cpu features
Date: Sun, 1 May 2022 18:28:02 +0300
Control: tag -1 + moreinfo

On Fri, 15 Mar 2019 15:52:44 +0000 Alex Bennée <alex.bennee@linaro.org> wrote:
> Package: qemu-user-static
> Version: 1:3.1+dfsg-4
> Severity: normal
> 
> Dear Maintainer,
> 
> Trying to build gitlab-runner on an ThunderX arm64 box it tries to run a
> docker image with armhf binaries which fails:
> 
>   standard_init_linux.go:207: exec user process caused "exec format error"
> 
> You can replicate by running:
> 
>   14:30:41 [root@qemu-test:/v/l/d/info] 1 # uname -a
>   Linux qemu-test 4.20.0 #5 SMP Tue Jan 8 10:57:44 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
>   14:30:46 [root@qemu-test:/v/l/d/info] # arch-test -n armhf
>   armhf: not supported on this machine/kernel
> 
> The underlying reason is because binfmt_misc isn't set up for armhf
> binaries because qemu-user-static.postinst does:
> 
>   # find which fmts needs to be filtered out, which is arch-dependent.
>   case "$DPKG_MAINTSCRIPT_ARCH" in
...
>     arm | armel | armhf | arm64) omit="arm|aarch64" ;;
>   esac
> 
> Which is certainly not true for all aarch64 CPUs. Some do not support
> aarch32. The following change makes it work but requires arch-test as a
> dependency:
> 
...
>     arm | armel | armhf) omit="arm" ;;
>     arm64 )
>         if arch-test -n armhf > /dev/null; then
>             omit="arm|aarch64"
>         else
>             omit="aarch64"
>         fi
>         ;;
> 
> This logic is repeated in the prerm script so there is probably some
> scope in cleaning up and sharing the logic.

Hi Alex!

This should be a runtime test on the installed system, I guess.
It is more: you might install the system on one hardware but but
later run it on a different hardware.

So this becomes, I guess, a startup script or a service which checks
things at boot and enables/disables this particular format according
to arch-test

How do you think if this is worth the effort to implement?

I understand the basics here (without any knowlege whatsoewer about
various arm hardware), but the solution seem to be a bit difficult.

FWIW, I'm enabling binfmt.d/ support for binfmt-misc format registration
(as an alternative to binfmt-support), - not that it makes it more difficult,
just one more condition to check.

Thank you for the bugreport!

/mjt



Added tag(s) moreinfo. Request was from Michael Tokarev <mjt@tls.msk.ru> to 924667-submit@bugs.debian.org. (Sun, 01 May 2022 15:33:03 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>:
Bug#924667; Package qemu-user-static. (Tue, 18 Apr 2023 14:24:05 GMT) (full text, mbox, link).


Acknowledgement sent to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list. Copy sent to Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>. (Tue, 18 Apr 2023 14:24:05 GMT) (full text, mbox, link).


Message #17 received at 924667@bugs.debian.org (full text, mbox, reply):

From: Michael Tokarev <mjt@tls.msk.ru>
To: 924667@bugs.debian.org, 1027781@bugs.debian.org, 1016810@bugs.debian.org
Subject: Re: Bug#924667: qemu-user-static: setting up of binfmt_misc is slightly naive about cpu features
Date: Tue, 18 Apr 2023 17:21:18 +0300
Replying to 3 different bug reports all about the same theme.

With the upcoming version of qemu-user[-static] package, I'm shipping all
available binfmt entries, including the ones for the same-family arch and
even for native arch.

But the same-family-arch entries will go into /usr/share/doc/qemu-user-static/,
not to /usr/lib/binfmt.d/ where all other entries reside.

This way, the system will automatically enable only entirely foreign binfmt
formats by default, just like it does now.  But it is possible to symlink,
say, /usr/share/doc/qemu-user-static/qemu-x86_64.conf to
/etc/binfmt.d/qemu-x86_64.conf, and it will be enabled on a i386 system.

You have to be careful though, and not enable native format this way, as
it will break your system.

Thanks,

/mjt



Added tag(s) pending. Request was from Michael Tokarev <mjt@tls.msk.ru> to control@bugs.debian.org. (Tue, 18 Apr 2023 17:42:03 GMT) (full text, mbox, link).


Reply sent to Michael Tokarev <mjt@tls.msk.ru>:
You have taken responsibility. (Thu, 20 Apr 2023 02:57:10 GMT) (full text, mbox, link).


Notification sent to Alex Bennée <alex.bennee@linaro.org>:
Bug acknowledged by developer. (Thu, 20 Apr 2023 02:57:10 GMT) (full text, mbox, link).


Message #24 received at 924667-close@bugs.debian.org (full text, mbox, reply):

From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
To: 924667-close@bugs.debian.org
Subject: Bug#924667: fixed in qemu 1:8.0+dfsg-1
Date: Thu, 20 Apr 2023 02:54:25 +0000
Source: qemu
Source-Version: 1:8.0+dfsg-1
Done: Michael Tokarev <mjt@tls.msk.ru>

We believe that the bug you reported is fixed in the latest version of
qemu, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 924667@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Tokarev <mjt@tls.msk.ru> (supplier of updated qemu package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 20 Apr 2023 04:19:06 +0300
Source: qemu
Architecture: source
Version: 1:8.0+dfsg-1
Distribution: experimental
Urgency: medium
Maintainer: Debian QEMU Team <pkg-qemu-devel@lists.alioth.debian.org>
Changed-By: Michael Tokarev <mjt@tls.msk.ru>
Closes: 924667 1016810 1027447 1027781
Changes:
 qemu (1:8.0+dfsg-1) experimental; urgency=medium
 .
   * New qemu release 8.0.0.
   * remove binfmt-support registration, use systemd binfmd.d/ only
     No more binfmt-support support. Unregister any entries on upgrades.
   * binfmt: ship (but not enable) entries for all arches, do not omit native
     Ship all really-foreign binfmt entries in /usr/lib/binfmt.d/ as usual,
     to be enable automatically at package install. Also ship the
     same-cpu-family entries in /usr/share/doc/qemu-user-static/qemu-foo.conf -
     this way it will not be enabled automatically but it will be possible to
     (carefully) symlink the needed additional entries to /etc/binfmt.d/.
     (Closes: #924667, #1016810, #1027781)
   * qemu-system-*: add extra names to use as qemu-system-${DEB_HOST_ARCH_CPU},
     for both the Provides: line and executable file names. See
     /usr/share/doc/qemu-system-common/README.Debian.
   * qemu-system-*: also Provides: qemu-system-any
   * qemu-system-ppc: provide qemu-kvm on ppc64el too, the same as ppc64
   * qemu-user, qemu-user-static: provide qemu-${DEB_HOST_ARCH}[-static]
     aliases too, when qemu arch is different from debian arch. See
     /usr/share/doc/qemu-user[-static]/README.Debian.
   * d/binfmt-install: fix disabled .conf entries install for qemu-user-binfmt
     (those goes to qemu-user doc dir, not qemu-user-binfmt doc dir)
   * d/control: remove old (pre-bullseye) Breaks/Replaces
   * qemu-bridge-helper-path.patch: use the right path for qemu-bridge-helper
     in docs (Closes: #1027447)
   * d/qemu-system-common.NEWS: document dropping of virtiofsd
   * d/rules: add comment saying why savemoddir block needs to be generated
   * stop trying to provide os-specific qemu-ifup
   * two more spelling fixes for mistyped "information"
Checksums-Sha1:
 47944aac1af41e1ea7a3a868517ea53e2b2e85b0 6490 qemu_8.0+dfsg-1.dsc
 a8959f799ef13568b232fb70b498622d7d7b2341 38440800 qemu_8.0+dfsg.orig.tar.xz
 2ba436c1030c73138b26341a5c7f5c035ee63077 104052 qemu_8.0+dfsg-1.debian.tar.xz
 b6c3b54ab628fdb530b1e656fdeae30385a73536 11137 qemu_8.0+dfsg-1_source.buildinfo
Checksums-Sha256:
 81ccddbba439526488dbc80bc646ee638fc56c3463745bf0857e42d4384f5670 6490 qemu_8.0+dfsg-1.dsc
 48cdafeecd8335e0f977dcf9715f836725e5d0134853e9629011309c5dc3335a 38440800 qemu_8.0+dfsg.orig.tar.xz
 3cc2fa5e687e0c2fade40f25d011f7093f667222e8fd03a1e51f543309068ef4 104052 qemu_8.0+dfsg-1.debian.tar.xz
 370e900f2dc5c2e750a7a593426b2d01cec9ecd332270d98feead6bf155f4ab8 11137 qemu_8.0+dfsg-1_source.buildinfo
Files:
 c871ad3fa4d8e228dc121c30ef636394 6490 otherosfs optional qemu_8.0+dfsg-1.dsc
 2395d3e282fb044bfbf7b41020ed8370 38440800 otherosfs optional qemu_8.0+dfsg.orig.tar.xz
 d8acf43adf80b33e7143dca5b3e16f1f 104052 otherosfs optional qemu_8.0+dfsg-1.debian.tar.xz
 6215374ecd95d95f73ea00be9b6ed37f 11137 otherosfs optional qemu_8.0+dfsg-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQFDBAEBCgAtFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmRAlGoPHG1qdEB0bHMu
bXNrLnJ1AAoJEHAbT2saaT5ZyrcH/1grjvHGNn2lZalrz8MB1JwCUF8/Tca5MKx3
tj7glJuTpAJeCXMDWHhLK1gxxyeIJvLgZi+dDKcH7om/QZuST9XDvrqg7wd2xU+7
O4uA566dAWN1ajNpwb/ft0k50h8xlCOtC/DSdzfx/S8ad2MRLWNRrSrDtE9IKeHq
ExFX/t+Mdep9idGppyZD/YGH1FB+rCr8OdBp316CVmOHGsGKyZtb8/QzPR/iXMEH
bxnYHiaJusD0Xn7dYz9KAqLOs6dc71wiPplG4h/iYqBxqLUX+kFUYWvBayU8fs5d
8MsoC7/spbXLyBXm7DglNNQrhtG7Mu/VQY2vXiR7Wn0p2+rrroA=
=ZAcX
-----END PGP SIGNATURE-----




Reply sent to Michael Tokarev <mjt@tls.msk.ru>:
You have taken responsibility. (Fri, 21 Apr 2023 09:51:10 GMT) (full text, mbox, link).


Notification sent to Alex Bennée <alex.bennee@linaro.org>:
Bug acknowledged by developer. (Fri, 21 Apr 2023 09:51:10 GMT) (full text, mbox, link).


Message #29 received at 924667-done@bugs.debian.org (full text, mbox, reply):

From: Michael Tokarev <mjt@tls.msk.ru>
To: 924667-done@bugs.debian.org, 1016810-done@bugs.debian.org, 1027447-done@bugs.debian.org, 1027781-done@bugs.debian.org
Subject: Closing 924667 1016810 1027447 1027781
Date: Fri, 21 Apr 2023 12:48:49 +0300
Version: 1:8.0+dfsg-1

This is closed in
https://tracker.debian.org/news/1429476/accepted-qemu-180dfsg-1-source-into-experimental/
but somehow the bts didn't work.

/mjt



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 12 Jul 2023 07:27:34 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Nov 23 20:40:57 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.