This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: When does pthread_create() return EINVAL?
To illustrate:
# unshare -p
call_rcu 0x6003a570 (nil) 0x7ffda2896610
qemu: qemu_thread_create pthread_create: Invalid argument
Manuel
On Sun, May 19, 2019 at 5:29 PM Manuel Lauss <manuel.lauss@gmail.com> wrote:
>
> Ok, nevermind: Newer versions of Gentoo's portage use PID namespaces
> by default. Disabling this feature
> gets rid of the pthread_create() failures.
>
> Sorry for the noise!
> Manuel
>
> On Sun, May 19, 2019 at 5:10 PM Manuel Lauss <manuel.lauss@gmail.com> wrote:
> >
> > Servus Florian,
> >
> > On Sun, May 19, 2019 at 3:35 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> > >
> > > * Manuel Lauss:
> > >
> > > > When does pthread_create() return EINVAL?
> > > > I use qemu-user for mipsel, and after updating a python package in the mipsel
> > > > userland, pthread_create() in qemu-user started returning EINVAL. I
> > > > looked through the source of pthread_create, but could not find an
> > > > explicit EINVAL anywhere.
> > >
> > > Do you know which system call fails? It's probably something coming
> > > from the Linux emulation, and not one of the glibc's stack-related
> > > checks (which can produce EINVAL as well).
> >
> > The failure comes from qemu's rcu (util/rcu.c):
> >
> > static void __attribute__((__constructor__)) rcu_init(void)
> > {
> > [...]
> > pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child);
> > [...]
> > }
> >
> > rcu_init_child() calls rcu_init_complete() which calls qemu_thread_create()
> > where then pthread_create() fails:
> >
> > qemu_thread_create(&thread, "call_rcu", call_rcu_thread,
> > NULL, QEMU_THREAD_DETACHED);
> > [..]
> > pthread_attr_init(&attr);
> > pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
> > pthread_create([..], &attr, call_rcu_thread, NULL);
> >
> > Here pthread_create() returns EINVAL.
> >
> > Do you have any idea what might cause this? I changed nothing but the
> > python script (Gentoo's portage)
> >
> > Thanks!
> > Manuel