qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs
@ 2005-10-22  1:09 Josh Triplett
  2005-10-22  6:54 ` [Qemu-devel] " Josh Triplett
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Triplett @ 2005-10-22  1:09 UTC (permalink / raw)
  To: qemu-devel


[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-10-24 11:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Qemu-devel] " Josh Triplett
2005-10-23  4:21   ` Mulyadi Santosa
2005-10-24 11:32     ` Josh Triplett

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).