qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael Ávila de Espíndola" <rafael.espindola@ic.unicamp.br>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] USE_CODE_COPY breaks clone
Date: Wed, 1 Sep 2004 14:32:40 -0300	[thread overview]
Message-ID: <200409011432.40742.rafael.espindola@ic.unicamp.br> (raw)

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

The cvs version of qemu (i386->i386) generates a segmentation fault in the 
emulated code of the attached test program. Commenting the definition of 
USE_CODE_COPY make the test execute successfully.

I think that the problem is in the fact that cpu_init is called in the parent 
process and this functions calls modify_ldt.

Where can I found some documentation about modify_ldt? What is USE_CODE_COPY 
supposed to do?

I will try to call cpu_init from within the new thread and see if it works.

One more question: What do you think about breaking the do_fork function in 
do_fork, do_clone and do_vfork? Presently it tries to guess if it should call 
fork or clone, but do_syscall knows the answer :)

Thanks for any comment,
Rafael

[-- Attachment #2: teste.c --]
[-- Type: text/x-csrc, Size: 487 bytes --]

#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

int f(void *oie) {
    printf("%s\n",(char *)oie);
    return 0;
}

int main() {
    const int stack_size = 8192;
    int ret;
    void *buf = malloc(stack_size);
    void *buff_end = buf + stack_size;
    unsigned int flags =CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND;
    char msg[] = "tata";
    ret = clone(f, buff_end, flags, (void *) msg);
    assert(ret != -1);
    printf("blit\n");
    return 0;
}

             reply	other threads:[~2004-09-01 17:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-01 17:32 Rafael Ávila de Espíndola [this message]
2004-09-01 23:17 ` [Qemu-devel] USE_CODE_COPY breaks clone Rafael Ávila de Espíndola

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=200409011432.40742.rafael.espindola@ic.unicamp.br \
    --to=rafael.espindola@ic.unicamp.br \
    --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).