From: Lubomir Kundrak <lkundrak@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork
Date: Tue, 29 Apr 2008 15:10:08 +0200 [thread overview]
Message-ID: <1209474608.5892.9.camel@localhost.localdomain> (raw)
I tried to run SH4 binaries linked with glibc-2.8 with qemu-sh4. fork()
system call was always returning with "Invalid argument".
Post glibc 2.3 fork() on Linux seems to call clone():
glibc-2.4/nptl/sysdeps/unix/sysv/linux/sh/fork.c:
24 /* TLS pointer argument is passed as the 5-th argument. */
25 #define ARCH_FORK() \
26 INLINE_SYSCALL (clone, 5, \
27 CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
28 NULL, &THREAD_SELF->tid, NULL)
qemu/linux-user/syscall.c:
2713 int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp)
...
2720 if (flags & CLONE_VM) {
...
2794 } else {
2795 /* if no CLONE_VM, we consider it is a fork */
2796 if ((flags & ~CSIGNAL) != 0)
2797 return -EINVAL;
2798 ret = fork();
2799 }
2800 return ret;
Here CLONE_CHILD_SETTID and CLONE_CHILD_CLEARTID being set cause the
~CSIGNAL conditional to fail. If the test is omited, some assertion fail
in glibc's fork() implementation is triggered.
--
Lubomir Kundrak (Red Hat Security Response Team)
next reply other threads:[~2008-04-29 13:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 13:10 Lubomir Kundrak [this message]
2008-04-29 13:55 ` [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork Paul Brook
2008-06-30 16:57 ` [Qemu-devel] " michael
2008-06-30 19:23 ` michael
2008-06-30 19:55 ` michael
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=1209474608.5892.9.camel@localhost.localdomain \
--to=lkundrak@redhat.com \
--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.