clone bug (glibc?) (Was: clone-multi-ptrace test failure)
Oleg Nesterov
oleg at redhat.com
Tue Dec 1 16:58:45 UTC 2009
On 11/30, Oleg Nesterov wrote:
>
> On 11/29, Roland McGrath wrote:
> >
> > Please file this test case on bugzilla.redhat.com for Fedora 12 glibc.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=542731
It was closed as NOTABUG, Andreas Schwab wrote:
>
> If you call clone directly you are responsible for setting up
> the TLS area yourself.
<troll mode>
Very nice. If I understand correctly, this means clone(CLONE_VM)
must not be used without CLONE_SETTLS, right?
This in turn means clone(CLONE_VM) is not useable, afaics it is not
possible to use CLONE_SETTLS in a more or less portable manner.
Even arch/x86/ needs "struct user_desc *" or "long addr" depending
on CONFIG_X86_32.
And it used to work? I downloaded glibc-2.11, and afaics this was
broken by
Preserve SSE registers in runtime relocations on x86-64.
commit: b48a267b8fbb885191a04cffdb4050a4d4c8a20b
I do not understand glibc even remotely, but this lools like
regression to me. I see nothing in the changelog or man page
which explains that CLONE_VM requires CLONE_SETTLS now.
</troll mode>
So. Any ptrace test which uses clone() is broken, at least on x86_64.
Jan, Roland, how should we fix this? We can rewrite the code to use
pthread_create(), this should be trivial. Unfortunately, libpthread
is not trivial, it can shadow the problem and complicate the testing.
And the stupid question. If I create the subthread via pthread_create(),
how can I know its tid? I grepped glibc-2.11, and afaics pthread_create
returns the pointer to "struct pthread" which has "pid_t tid" but I can
not find the helper which returns ->tid and "struct pthread" is not
exported.
Oleg.
More information about the utrace-devel
mailing list