Your message dated Sun, 14 Feb 2021 14:16:44 +0000
with message-id <[email protected]>
and subject line Bug#970460: fixed in qemu 1:5.2+dfsg-4
has caused the Debian Bug report #970460,
regarding qemu-user: trashes argv[0] breaking multi-call binaries
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
970460: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970460
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: qemu-user
Version: 1:5.1+dfsg-4
Severity: important
X-Debbugs-Cc: [email protected], [email protected]

I’m attaching a test program that does the following:

• if argv[1] is "-" it just outputs argv[0] and argv[1]
• otherwise it also execve(2)s argv[1] with its argv[0] set to "meow"

I’ve installed the extra packages:
• gcc-arm-linux-gnueabi
• libc6-dev-armel-cross


tglase@tglase-nb:~ $ gcc -Wall -Wextra -o native tst.c
1|tglase@tglase-nb:~ $ ./native ./native
argv[0]: ./native
argv[1]: ./native
calling...
argv[0]: meow
argv[1]: -
not calling
tglase@tglase-nb:~ $ arm-linux-gnueabi-gcc -o cross tst.c -static
tglase@tglase-nb:~ $ ./cross ./cross
argv[0]: ./cross
argv[1]: ./cross
calling...
argv[0]: ./cross
argv[1]: -
not calling
tglase@tglase-nb:~ $ ./cross ./native
argv[0]: ./cross
argv[1]: ./native
calling...
argv[0]: meow
argv[1]: -
not calling
tglase@tglase-nb:~ $ ./native ./cross
argv[0]: ./native
argv[1]: ./cross
calling...
argv[0]: ./cross
argv[1]: -
not calling


As you can see, if the callee of an exec is a qemu-user target,
argv[0] is trashed.

This, among other things, makes qemu-user-static-based buildds unworkable.

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'oldstable-updates'), (500, 
'buildd-unstable'), (500, 'unstable'), (500, 'oldstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.7.0-2-amd64 (SMP w/2 CPU threads)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)

Versions of packages qemu-user depends on:
ii  libc6         2.31-3
ii  libcapstone3  4.0.1+really+3.0.5-2
ii  libgcc-s1     10.2.0-7
ii  libglib2.0-0  2.66.0-1
ii  libgnutls30   3.6.15-2
ii  libstdc++6    10.2.0-7
ii  zlib1g        1:1.2.11.dfsg-2

Versions of packages qemu-user recommends:
ii  qemu-user-static [qemu-user-binfmt]  1:5.1+dfsg-4

Versions of packages qemu-user suggests:
ii  sudo  1.9.1-2

-- no debconf information
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int
main(int argc, char *argv[], char *envp[])
{
        char *newargv[3];

        if (argc != 2) {
                fprintf(stderr, "usage: %s <program-to-call>\n", argv[0]);
                return (1);
        }

        printf("argv[%d]: %s\n", 0, argv[0]);
        printf("argv[%d]: %s\n", 1, argv[1]);

        if (strcmp(argv[1], "-") != 0) {
                printf("calling...\n");
                newargv[0] = "meow";
                newargv[1] = "-";
                newargv[2] = NULL;
                execve(argv[1], newargv, envp);
                err(1, "exec");
        }
        printf("not calling\n");
        return (0);
}

--- End Message ---
--- Begin Message ---
Source: qemu
Source-Version: 1:5.2+dfsg-4
Done: Michael Tokarev <[email protected]>

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 [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Tokarev <[email protected]> (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 [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 14 Feb 2021 16:52:10 +0300
Source: qemu
Architecture: source
Version: 1:5.2+dfsg-4
Distribution: unstable
Urgency: medium
Maintainer: Debian QEMU Team <[email protected]>
Changed-By: Michael Tokarev <[email protected]>
Closes: 956377 959530 970460
Changes:
 qemu (1:5.2+dfsg-4) unstable; urgency=medium
 .
   [ Michael Tokarev ]
   * require libfdt >= 1.5.0-2 due to #931046
   * qemu-user: attempt to preserve argv[0] when run under binfmt
     (Closes: #970460, #959530)
     This changes the enterpreter name for all linux-user registered
     binfmts, so it potentially can break stuff.  The actual binary
     being registered now is /usr/libexec/qemu-binfmt/foo-binfmt-P,
     which is a symlink to actual /usr/lib/qemu-foo[-static].
   * ignore .git-submodule-status when building source
   * some security fixes from upstream:
     o arm_gic-fix-interrupt-ID-in-GICD_SGIR-CVE-2021-20221.patch
       Closes: CVE-2021-20221
       GIC (armv7): out-of-bound heap buffer access via an interrupt ID field
     o 9pfs-Fully-restart-unreclaim-loop-CVE-2021-20181.patch
       Closes: CVE-2021-20181
   * non-security fixes from upstream:
     pc-bios-descriptors-fix-paths-in-json-files.patch - fixes wrong paths
     in edk2-firmware-related json files introduced in 5.2
 .
   [ Christian Ehrhardt ]
   * d/control-in: avoid version mismatch of installed binaries
     (Closes: #956377)
 .
   [ Dan Streetman ]
   * Backport configure param --with-git-submodules and set to 'ignore'
Checksums-Sha1:
 816f1682c4f54ef9e0b77e959c5c77f8460db94a 6597 qemu_5.2+dfsg-4.dsc
 99f4aeddc6f5ed0c1f4ee84da22a591d32dff623 99408 qemu_5.2+dfsg-4.debian.tar.xz
 11aae2831edfc5fa28a51506a6ac7b47737c25c4 9102 qemu_5.2+dfsg-4_source.buildinfo
Checksums-Sha256:
 7841e5dc1b7e286b6efb901ca6d440cccb39e1624c6311a10b1fef0ca2f6bf65 6597 
qemu_5.2+dfsg-4.dsc
 c4439a4130efa9eb37664e04e9d93722d37a2b3c836dd107240d372e72947899 99408 
qemu_5.2+dfsg-4.debian.tar.xz
 18c4557a95b45b1ccd56325aab3de78744a4c217869604c256e2bed411c084dc 9102 
qemu_5.2+dfsg-4_source.buildinfo
Files:
 4349e64c2a2f579dcc52eb4cdfe7e142 6597 otherosfs optional qemu_5.2+dfsg-4.dsc
 8e4239a97dd4fd18c47151393a39ae29 99408 otherosfs optional 
qemu_5.2+dfsg-4.debian.tar.xz
 4a7e8f8261142b4b7943369734938de0 9102 otherosfs optional 
qemu_5.2+dfsg-4_source.buildinfo

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

iQFDBAEBCAAtFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmApK1MPHG1qdEB0bHMu
bXNrLnJ1AAoJEHAbT2saaT5ZcuMH+gJbgCItoTfYCaJtKtiiS5mt2wQJH9pwCs8Z
GTLU8TA9t4l4SQ8JebpfWFNgeCJnz4fiTR9S7d35JBJewcb9yvLWZ0/0X7aPTdO2
xWWzdjfLm/DPcmGenQd1FTmrsObVNrgzaqOLBLCm/67vHqwk1mBqJQgEt4Il+ZR8
yKNMsykk8hyun1AxZ8pZRyriT6njKLAvD50uA9sW0j7G0REgr1JvkJWOPLEpkk98
KxSC56CvAA5HOuFJvHuPDOIOAgrU4KNB0n4bTSj8ewehZT7MgF1/S0nBS3R4DBST
SNaRPY7O0AiCAC+0GpEyppw3/feYgu5ImGaWWz7G1684eXxDf1E=
=969T
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to