[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] User mode emulation's clone does not seem to work with glib
From: |
Lubomir Kundrak |
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 |
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)
- [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork,
Lubomir Kundrak <=