[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] qemu-ppc fails to run clone with CLONE_VM, threaded program

From: Josh Triplett
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
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007 Debian/1.7.12-1


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

- Josh Triplett

#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)
        return 1;

    printf("parent: clone successful; child pid is %d\n", pid);
    printf("parent: sleeping a bit\n");


/*    printf("parent: value is %d\n", i); */
    printf("parent: killing process\n");

    kill(pid, SIGTERM);

    return 0;

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]