From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:38068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvpKH-0001xH-3y for qemu-devel@nongnu.org; Mon, 18 Feb 2019 15:15:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvpKF-00023L-OU for qemu-devel@nongnu.org; Mon, 18 Feb 2019 15:15:41 -0500 Received: from indium.canonical.com ([91.189.90.7]:48950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gvpKD-00020A-Hz for qemu-devel@nongnu.org; Mon, 18 Feb 2019 15:15:39 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.86_2 #2 (Debian)) id 1gvpKB-00073X-Cl for ; Mon, 18 Feb 2019 20:15:35 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 5BAB42E80CB for ; Mon, 18 Feb 2019 20:15:35 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Feb 2019 20:09:11 -0000 From: =?utf-8?b?Q2lybyBTYW50aWxsaSDlha3lm5vkuovku7Yg5rOV6L2u5Yqf?= Reply-To: Bug 1701798 <1701798@bugs.launchpad.net> Sender: bounces@canonical.com References: <149890819992.24827.8096984642709091835.malonedeb@soybean.canonical.com> Message-Id: <155052055164.4150.11929122124941692896.malone@wampee.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1701798] Re: dynamically linked binaries crash for big-endian targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Did we open a precise glibc upstream bug for this so I can go upvote it? :-) Workaround from #12 also worked for me. Tested on Buildroot with this precise setup: https://github.com/cirosantilli/linux-kernel-module- cheat/tree/e855a262fd872171156894e9045814cb0f346dab#stack-smashing- detected For Google, the error message in that setup is: *** stack smashing detected ***: terminated qemu: uncaught target signal 6 (Aborted) - core dumped but must be the same as reported here just with a different glibc setup leading to slightly different crash. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1701798 Title: dynamically linked binaries crash for big-endian targets Status in QEMU: New Bug description: On the targets hppa m68k mips mips64 powerpc powerpc64 s390x sparc64 dynamically linked binaries crash, but statically linked binaries work. On the targets aarch64 alpha armhf powerpc64le sh4 both dynamically linked and statically linked binaries work. How to reproduce: 1) On Ubuntu 16.04, install the packages g++-5-aarch64-linux-gnu g++-5-alpha-linux-gnu g++-5-arm-linux-gnueabihf g++-5-hppa-linux-gnu g++-5-m68k-linux-gnu g++-5-mips-linux-gnu g++-5-mips64-linux-gnuabi64 g++-5-powerpc-linux-gnu g++-5-powerpc64-linux-gnu g++-5-powerpc64le-linux-gnu g++-5-s390x-linux-gnu g++-5-sh4-linux-gnu g++-5-sparc64-linux-gnu 2) Install qemu 2.9.0 from source (for m68k, use the 2.7.0-m68k code from https://github.com/vivier/qemu-m68k.git): $ ../configure --prefix=3D/home/bruno/inst-qemu/2.9.0 --target-list=3Daar= ch64-softmmu,alpha-softmmu,arm-softmmu,i386-softmmu,m68k-softmmu,mips-softm= mu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu,ppc-softmmu,ppc64-softmmu= ,s390x-softmmu,sh4-softmmu,sparc-softmmu,sparc64-softmmu,x86_64-softmmu,aar= ch64-linux-user,alpha-linux-user,arm-linux-user,hppa-linux-user,m68k-linux-= user,mips-linux-user,mipsel-linux-user,mips64-linux-user,mips64el-linux-use= r,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,s390x-linux-user,sh4-l= inux-user,sparc-linux-user,sparc64-linux-user --disable-strip --disable-wer= ror --enable-gtk --enable-vnc $ make $ make install 3) Cross-compile the programs: $ aarch64-linux-gnu-gcc-5 -O hello.c -o hello.aarch64 $ alpha-linux-gnu-gcc-5 -O hello.c -o hello.alpha $ arm-linux-gnueabihf-gcc-5 -O hello.c -o hello.armhf $ hppa-linux-gnu-gcc-5 -O hello.c -o hello.hppa $ m68k-linux-gnu-gcc-5 -O hello.c -o hello.m68k $ mips-linux-gnu-gcc-5 -O hello.c -o hello.mips $ mips64-linux-gnuabi64-gcc-5 -O hello.c -o hello.mips64 $ powerpc-linux-gnu-gcc-5 -O hello.c -o hello.powerpc $ powerpc64-linux-gnu-gcc-5 -O hello.c -o hello.powerpc64 $ powerpc64le-linux-gnu-gcc-5 -O hello.c -o hello.powerpc64le $ s390x-linux-gnu-gcc-5 -O hello.c -o hello.s390x $ sh4-linux-gnu-gcc-5 -O hello.c -o hello.sh4 $ sparc64-linux-gnu-gcc-5 -O hello.c -o hello.sparc64 4) Run the programs: * aarch64 works: $ QEMU_LD_PREFIX=3D/usr/aarch64-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-aarc= h64 hello.aarch64 Hello world * alpha works: $ QEMU_LD_PREFIX=3D/usr/alpha-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-alpha = hello.alpha = Hello world * armhf works: $ QEMU_LD_PREFIX=3D/usr/arm-linux-gnueabihf ~/inst-qemu/2.9.0/bin/qemu-ar= m hello.armhf Hello world * powerpc64le works: $ QEMU_LD_PREFIX=3D/usr/powerpc64le-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-= ppc64le hello.powerpc64le Hello world * sh4 works: $ QEMU_LD_PREFIX=3D/usr/sh4-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-sh4 hell= o.sh4 Hello world * =3D=3D=3D=3D=3D sparc64 does not work: $ QEMU_LD_PREFIX=3D/usr/sparc64-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-spar= c64 hello.sparc64 Segmentation fault (core dumped) When I copy the file to a machine with `uname -srm` =3D "Linux 4.5.0-2-sp= arc64 sparc64", it works: $ ./hello.sparc64 Hello world When I copy the file and its execution environment /usr/sparc64-linux-gnu= to the same machine and run the binary in a chroot environment: # /bin/hello.sparc64 = Hello world * =3D=3D=3D=3D=3D mips does not work: $ QEMU_LD_PREFIX=3D/usr/mips-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-mips he= llo.mips qemu: uncaught target signal 11 (Segmentation fault) - core dumped When I copy the file to a machine with `uname -srm` =3D "Linux 3.16.0-4-4= kc-malta mips", it works: $ ./hello.mips Hello world When I copy the file and its execution environment /usr/mips-linux-gnu to= the same machine and run the binary in a chroot environment: # /bin/hello.mips = Hello world * =3D=3D=3D=3D=3D mips64 does not work: $ QEMU_LD_PREFIX=3D/usr/mips64-linux-gnuabi64 ~/inst-qemu/2.9.0/bin/qemu-= mips64 hello.mips64 qemu: uncaught target signal 11 (Segmentation fault) - core dumped When I copy the file to a machine with `uname -srm` =3D "Linux 3.16.0-4-5= kc-malta mips64", it works: $ ./hello.mips64 Hello world * =3D=3D=3D=3D=3D powerpc does not work: $ QEMU_LD_PREFIX=3D/usr/powerpc-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-ppc = hello.powerpc qemu: uncaught target signal 11 (Segmentation fault) - core dumped When I copy the file to a machine with `uname -srm` =3D "Linux 3.17.2-200= .fc20.ppc64p7 ppc64", it works: $ ./hello.powerpc Hello world * =3D=3D=3D=3D=3D powerpc64 does not work: $ QEMU_LD_PREFIX=3D/usr/powerpc64-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-pp= c64 hello.powerpc64 qemu: uncaught target signal 11 (Segmentation fault) - core dumped When I copy the file to a machine with `uname -srm` =3D "Linux 3.17.2-200= .fc20.ppc64p7 ppc64", it works: $ ./hello.powerpc64 Hello world * =3D=3D=3D=3D=3D s390x does not work: $ QEMU_LD_PREFIX=3D/usr/s390x-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-s390x = hello.s390x $ QEMU_LD_PREFIX=3D/usr/s390x-linux-gnu ~/inst-qemu/2.8.1/bin/qemu-s390x = hello.s390x qemu-s390x: /media/develdata/devel/build/qemu-2.8.1/translate-all.c:175: = tb_lock: Assertion `!have_tb_lock' failed. Segmentation fault (core dumped) When I copy the file to a machine with `uname -srm` =3D "Linux 3.16.0-4-s= 390x s390x", it works: $ ./hello.s390x Hello world * =3D=3D=3D=3D=3D hppa does not work: $ QEMU_LD_PREFIX=3D/usr/hppa-linux-gnu ~/inst-qemu/2.9.0/bin/qemu-hppa he= llo.hppa Segmentation fault (core dumped) * =3D=3D=3D=3D=3D m68k does not work: $ QEMU_LD_PREFIX=3D/usr/m68k-linux-gnu QEMU_CPU=3Dm68020 ~/inst-qemu/2.9.= 0/bin/qemu-m68k hello.m68k qemu: uncaught target signal 4 (Illegal instruction) - core dumped $ QEMU_LD_PREFIX=3D/usr/m68k-linux-gnu QEMU_CPU=3Dm68020 ~/inst-qemu/2.7.= 0-m68k/bin/qemu-m68k hello.m68k qemu: uncaught target signal 11 (Segmentation fault) - core dumped = The set of targets where it does not work is exactly the big-endian targe= ts. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1701798/+subscriptions