Received: from [140.186.70.92] (port=56222 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGDsY-0006WH-J4 for qemu-devel@nongnu.org; Wed, 10 Nov 2010 11:50:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGDsX-0006eT-1O for qemu-devel@nongnu.org; Wed, 10 Nov 2010 11:50:34 -0500 Received: from adelie.canonical.com ([91.189.90.139]:35102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGDsW-0006eI-PT for qemu-devel@nongnu.org; Wed, 10 Nov 2010 11:50:32 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1PGDsV-0007Rg-Cp for ; Wed, 10 Nov 2010 16:50:31 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 52BC52E8056 for ; Wed, 10 Nov 2010 16:50:31 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 10 Nov 2010 16:43:46 -0000 From: Wolfgang Schildbach <673613@bugs.launchpad.net> Sender: bounces@canonical.com References: <20101110164346.8483.20908.malonedeb@palladium.canonical.com> Message-Id: <20101110164346.8483.20908.malonedeb@palladium.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 673613] [NEW] ARM semihosting SYS_GET_CMDLINE does not return arguments Reply-To: Bug 673613 <673613@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Public bug reported: I have downloaded version 0.13.0 of the code, configured with: './configure' '--prefix=3D/tmp/qemu-0.13.0' '--interp- prefix=3D/tmp/qemu-0.13.0/usr/local/gnemul/qemu-%M' '--target-list=3Darm- softmmu arm-linux-user armeb-linux-user' and built using gcc version 4.3.2 (Debian 4.3.2-1.1). Execution environment is Debian, kernel 2.6.26-2-686. I am running a barebone helloworld.c which echoes its commandline arguments, compiled with ADS1.2 from ARM. The arguments never get echoed back. I have found the culprit in the source code, lines 3020 and 3022 of linux-user/main.c which free target_argv[]. However, loader_exec(), which is called a couple lines above, records the pointer to target_argv[]. So, when the data is accessed in arm-semi.c, it is actually trying to load from memory that has been free()d already. This bug manifests itself for baremetal simulation, but I suspect it hits other platforms as well. ** Affects: qemu Importance: Undecided Status: New -- = ARM semihosting SYS_GET_CMDLINE does not return arguments https://bugs.launchpad.net/bugs/673613 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: New Bug description: I have downloaded version 0.13.0 of the code, configured with: './configure= ' '--prefix=3D/tmp/qemu-0.13.0' '--interp-prefix=3D/tmp/qemu-0.13.0/usr/loc= al/gnemul/qemu-%M' '--target-list=3Darm-softmmu arm-linux-user armeb-linux-= user' and built using gcc version 4.3.2 (Debian 4.3.2-1.1). Execution environment= is Debian, kernel 2.6.26-2-686. I am running a barebone helloworld.c which echoes its commandline arguments= , compiled with ADS1.2 from ARM. The arguments never get echoed back. I have found the culprit in the source code, lines 3020 and 3022 of linux-u= ser/main.c which free target_argv[]. However, loader_exec(), which is calle= d a couple lines above, records the pointer to target_argv[]. So, when the = data is accessed in arm-semi.c, it is actually trying to load from memory t= hat has been free()d already. This bug manifests itself for baremetal simulation, but I suspect it hits o= ther platforms as well.