This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: When does pthread_create() return EINVAL?
- From: Manuel Lauss <manuel dot lauss at gmail dot com>
- To: Florian Weimer <fw at deneb dot enyo dot de>
- Cc: libc-help at sourceware dot org
- Date: Sun, 19 May 2019 17:10:26 +0200
- Subject: Re: When does pthread_create() return EINVAL?
- References: <CAOLZvyHW9JRcSXQTCC9gNdTxNVJ69mE2mhLg5wyC9SiukX=R-Q@mail.gmail.com> <87lfz2pnwt.fsf@mid.deneb.enyo.de>
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