From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ET7tG-0003lw-9Z for qemu-devel@nongnu.org; Fri, 21 Oct 2005 21:09:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ET7tD-0003lk-RG for qemu-devel@nongnu.org; Fri, 21 Oct 2005 21:09:42 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ET7tD-0003lh-Os for qemu-devel@nongnu.org; Fri, 21 Oct 2005 21:09:39 -0400 Received: from [206.46.252.40] (helo=vms040pub.verizon.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ET7tD-0005rA-PC for qemu-devel@nongnu.org; Fri, 21 Oct 2005 21:09:39 -0400 Received: from [127.0.0.1] ([131.252.214.11]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IOQ009YKLW0M0H1@vms040.mailsrvcs.net> for qemu-devel@nongnu.org; Fri, 21 Oct 2005 20:09:37 -0500 (CDT) Date: Fri, 21 Oct 2005 18:09:37 -0700 From: Josh Triplett Message-id: <43599151.90802@psas.pdx.edu> MIME-version: 1.0 Content-type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary=------------enig228066991782A9C3733EC8A5 Subject: [Qemu-devel] qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig228066991782A9C3733EC8A5 Content-Type: multipart/mixed; boundary="------------040406040407090703060409" This is a multi-part message in MIME format. --------------040406040407090703060409 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, I'm attempting to run cross-compiled programs with qemu-ppc. Basic statically-linked programs work perfectly. However, if I attempt to run non-static programs or threaded programs, or if I attempt to call clone() with the CLONE_VM flag set, I get an invalid data memory access. Threaded programs get an error when calling pthread_create, with an invalid data memory access at 0x00000018. A simple test program using clone with CLONE_VM gets an invalid data memory access at 0x00000008. Non-static programs get an invalid data memory access at various addresses around 0x0de00000, before ever reaching main(). I've attached the test program I used to test clone(), as it seems to be the simplest test case which fails. I'd be happy to help with debugging this problem; if you need any more information or you'd like me to run additional tests, please let me know. I've tested both the Debian-packaged qemu-7.0 and an unmodified qemu-0.7.2 from qemu.org ; with the latter, all of the above tests still fail, but I get a few more error messages along the lines of "Invalid segfault errno (a000000)" and "qemu: uncaught target signal 11 (Segmentation fault) - exiting". In addition, when I run the hello-clone program under qemu-7.2, the parent also experiences an "invalid data memory access" error and segfaults, whereas with 7.0 the parent ran fine and only the child had an "invalid data memory access" error and segfault. Some background: I'm a member of the Portland State Aerospace Society, and we're in the process of switching our rocket's flight computer (which runs Debian GNU/Linux) over to PowerPC. I'm attempting to get our flight-control software to run under qemu-ppc so that I can test it under simulation; the flight-control software currently makes use of pthreads. - Josh Triplett --------------040406040407090703060409 Content-Type: text/x-csrc; name="hello-clone.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="hello-clone.c" #include #include #include #include /* int i = 0; */ int thread_main(void *arg) { printf("child: Hello world!\n"); while(1) /* i++ */; return 0; } unsigned long stack[8192]; int main() { int pid; printf("About to clone: thread_main=%p\n", thread_main); pid = clone(thread_main, stack+4096, CLONE_VM, NULL); if(pid == -1) { perror("clone"); return 1; } printf("parent: clone successful; child pid is %d\n", pid); printf("parent: sleeping a bit\n"); sleep(2); /* printf("parent: value is %d\n", i); */ printf("parent: killing process\n"); kill(pid, SIGTERM); return 0; } --------------040406040407090703060409-- --------------enig228066991782A9C3733EC8A5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Debian - http://enigmail.mozdev.org iD8DBQFDWZFRGJuZRtD+evsRAkGXAKC/VtnSXemqtoA9zMDsCpF2IyXYZgCeOdNY 6lQlp4SNRxpE9W3x3c005pI= =xoOk -----END PGP SIGNATURE----- --------------enig228066991782A9C3733EC8A5--