Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1025348

Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries

From Thorsten Glaser <tg@mirbsd.de>
Newsgroups linux.debian.bugs.dist, linux.debian.ports.68k
Subject Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries
Date 2020-09-16 19:00 +0200
Message-ID <APIWK-6uw-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Package: qemu-user
Version: 1:5.1+dfsg-4
Severity: important
X-Debbugs-Cc: tg@mirbsd.de, debian-68k@lists.debian.org

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

Back to linux.debian.bugs.dist | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Thorsten Glaser <tg@mirbsd.de> - 2020-09-16 19:00 +0200
  Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> - 2020-09-16 19:20 +0200
    Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Michael Tokarev <mjt@tls.msk.ru> - 2020-09-16 20:00 +0200
    Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Thorsten Glaser <tg@mirbsd.de> - 2020-09-16 21:00 +0200
  Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Andreas Schwab <schwab@linux-m68k.org> - 2020-09-16 21:20 +0200
    Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Michael Tokarev <mjt@tls.msk.ru> - 2020-09-16 21:30 +0200
      Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Thorsten Glaser <tg@mirbsd.de> - 2020-09-16 21:50 +0200
  Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Michael Tokarev <mjt@tls.msk.ru> - 2020-09-16 22:10 +0200
  Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Michael Tokarev <mjt@tls.msk.ru> - 2020-09-17 10:00 +0200
    Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Thorsten Glaser <tg@mirbsd.de> - 2020-09-17 23:50 +0200
      Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Finn Thain <fthain@telegraphics.com.au> - 2020-09-18 01:40 +0200
      Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Thorsten Glaser <tg@debian.org> - 2020-09-19 22:10 +0200
  Bug#970460: qemu-user: trashes argv[0] breaking multi-call binaries Michael Tokarev <mjt@tls.msk.ru> - 2020-09-17 10:20 +0200
  Bug#970460: [Bug libc/23960] [2.28 Regression]: New getdents{64} implementation breaks qemu-user Thorsten Glaser <tg@mirbsd.de> - 2020-10-03 01:30 +0200

csiph-web