* [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork
@ 2008-04-29 13:10 Lubomir Kundrak
2008-04-29 13:55 ` Paul Brook
0 siblings, 1 reply; 5+ messages in thread
From: Lubomir Kundrak @ 2008-04-29 13:10 UTC (permalink / raw)
To: qemu-devel
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork
2008-04-29 13:10 [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork Lubomir Kundrak
@ 2008-04-29 13:55 ` Paul Brook
2008-06-30 16:57 ` [Qemu-devel] " michael
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Paul Brook @ 2008-04-29 13:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Lubomir Kundrak
On Tuesday 29 April 2008, Lubomir Kundrak wrote:
> I tried to run SH4 binaries linked with glibc-2.8 with qemu-sh4. fork()
> system call was always returning with "Invalid argument".
qemu doesn't currently support NPTL. I'm working on it.
Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: User mode emulation's clone does not seem to work with glibc >= 2.4's fork
2008-04-29 13:55 ` Paul Brook
@ 2008-06-30 16:57 ` michael
2008-06-30 19:23 ` michael
2008-06-30 19:55 ` michael
2 siblings, 0 replies; 5+ messages in thread
From: michael @ 2008-06-30 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Lubomir Kundrak
Hi,
Paul Brook wrote:
> On Tuesday 29 April 2008, Lubomir Kundrak wrote:
>> I tried to run SH4 binaries linked with glibc-2.8 with qemu-sh4. fork()
>> system call was always returning with "Invalid argument".
>
> qemu doesn't currently support NPTL. I'm working on it.
>
> Paul
>
>
>
I'm working on sh4 to provide an NPTL support. I just force the
NPTL support of sh4 in the configuration and add the cpu_set_tls
using the env->gbr. I have sh:
../nptl/sysdeps/unix/sysv/linux/sh/../fork.c:138: __libc_fork: Assertion
`(self->tid) != ppid this assertion in tforhe libc code. The
child_tidptr is nil, so I can't set the tid for the child. I don't want
to fix this issue but just understand what happen.
Regards Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: User mode emulation's clone does not seem to work with glibc >= 2.4's fork
2008-04-29 13:55 ` Paul Brook
2008-06-30 16:57 ` [Qemu-devel] " michael
@ 2008-06-30 19:23 ` michael
2008-06-30 19:55 ` michael
2 siblings, 0 replies; 5+ messages in thread
From: michael @ 2008-06-30 19:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Lubomir Kundrak
Hi,
Paul Brook wrote:
> On Tuesday 29 April 2008, Lubomir Kundrak wrote:
>> I tried to run SH4 binaries linked with glibc-2.8 with qemu-sh4. fork()
>> system call was always returning with "Invalid argument".
>
> qemu doesn't currently support NPTL. I'm working on it.
>
> Paul
>
>
>
I'm working on sh4 to provide an NPTL support. I just force the
NPTL support of sh4 in the configuration and add the cpu_set_tls
using the env->gbr. I have sh:
../nptl/sysdeps/unix/sysv/linux/sh/../fork.c:138: __libc_fork: Assertion
`(self->tid) != ppid this assertion in tforhe libc code. The
child_tidptr is nil, so I can't set the tid for the child. I don't want
to fix this issue but just understand what happen.
Regards Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: User mode emulation's clone does not seem to work with glibc >= 2.4's fork
2008-04-29 13:55 ` Paul Brook
2008-06-30 16:57 ` [Qemu-devel] " michael
2008-06-30 19:23 ` michael
@ 2008-06-30 19:55 ` michael
2 siblings, 0 replies; 5+ messages in thread
From: michael @ 2008-06-30 19:55 UTC (permalink / raw)
To: qemu-devel; +Cc: Lubomir Kundrak, paul
Hi,
Paul Brook wrote:
> On Tuesday 29 April 2008, Lubomir Kundrak wrote:
>> I tried to run SH4 binaries linked with glibc-2.8 with qemu-sh4. fork()
>> system call was always returning with "Invalid argument".
>
> qemu doesn't currently support NPTL. I'm working on it.
>
> Paul
>
>
>
I'm working on sh4 to provide an NPTL support. I just force the
NPTL support of sh4 in the configuration and add the cpu_set_tls
using the env->gbr. I have sh:
../nptl/sysdeps/unix/sysv/linux/sh/../fork.c:138: __libc_fork: Assertion
`(self->tid) != ppid this assertion in tforhe libc code. The
child_tidptr is nil, so I can't set the tid for the child. I change
the code of the fork like this:
#if !defined(TARGET_SH4)
ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5));
#else
ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4));
#endif
An know seem to work the sh4 target. I think that is not the only
change. Is it right?
Regards Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-30 19:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-29 13:10 [Qemu-devel] User mode emulation's clone does not seem to work with glibc >= 2.4's fork Lubomir Kundrak
2008-04-29 13:55 ` Paul Brook
2008-06-30 16:57 ` [Qemu-devel] " michael
2008-06-30 19:23 ` michael
2008-06-30 19:55 ` michael
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).