qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@psas.pdx.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs
Date: Fri, 21 Oct 2005 18:09:37 -0700	[thread overview]
Message-ID: <43599151.90802@psas.pdx.edu> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1817 bytes --]

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



[-- Attachment #1.2: hello-clone.c --]
[-- Type: text/x-csrc, Size: 706 bytes --]

#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>

/* 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;
}


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

             reply	other threads:[~2005-10-22  1:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-22  1:09 Josh Triplett [this message]
2005-10-22  6:54 ` [Qemu-devel] Re: qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs Josh Triplett
2005-10-23  4:21   ` 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=43599151.90802@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).