From: Josh Triplett <josh@psas.pdx.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs
Date: Fri, 21 Oct 2005 23:54:34 -0700 [thread overview]
Message-ID: <4359E22A.2090904@psas.pdx.edu> (raw)
In-Reply-To: <43599151.90802@psas.pdx.edu>
[-- Attachment #1.1: Type: text/plain, Size: 1096 bytes --]
Josh Triplett wrote:
> 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 worked with pbrook on #qemu to debug this issue. The problem turns
out to be that qemu's do_fork function on PowerPC zeroes out r7-r31 in
the new CPU state structure after a clone, which it should not do, as
the child's registers should match the parent; it also does not zero
register r3, which holds the return value and should be zero in the
child. I've prepared and attached a patch which should solve this problem.
- Josh Triplett
[-- Attachment #1.2: qemu-powerpc-clone.patch --]
[-- Type: text/x-patch, Size: 536 bytes --]
diff -Naur qemu-0.7.0.orig/linux-user/syscall.c qemu-0.7.0/linux-user/syscall.c
--- qemu-0.7.0.orig/linux-user/syscall.c 2005-10-21 19:56:04.000000000 -0700
+++ qemu-0.7.0/linux-user/syscall.c 2005-10-21 20:02:20.000000000 -0700
@@ -1560,11 +1560,7 @@
if (!newsp)
newsp = env->gpr[1];
new_env->gpr[1] = newsp;
- {
- int i;
- for (i = 7; i < 32; i++)
- new_env->gpr[i] = 0;
- }
+ new_env->gpr[3] = 0;
#else
#error unsupported target CPU
#endif
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]
next prev parent reply other threads:[~2005-10-22 6:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-22 1:09 [Qemu-devel] qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs Josh Triplett
2005-10-22 6:54 ` Josh Triplett [this message]
2005-10-23 4:21 ` [Qemu-devel] " Mulyadi Santosa
2005-10-24 11:32 ` Josh Triplett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4359E22A.2090904@psas.pdx.edu \
--to=josh@psas.pdx.edu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.