This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RFC: clone with CLONE_VM behavior
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 13 Apr 2016 10:26:32 -0300
- Subject: RFC: clone with CLONE_VM behavior
- Authentication-results: sourceware.org; auth=none
Hi all,
Szabolcs has brought to my attention that the new posix_spawn is showing
some issue on his aarch64 [1], but it is not limited to aarch64.
The problem is due the fact GLIBC clone implementation resets both
THREAD_SELF pid and tid when CLONE_VM is specified. This leads to
inconsistency since the value is not restored back in parent and
thus INVALID_TD_P and INVALID_NOT_TERMINATED_TD_P (used in pthread
implementations) will bail with an error handler.
Previous posix_spawn uses vfork which only interferes with THREAD_SELF
pid field by negating it before the syscall and restoring the value
after it.
I am trying to came up with the best solution for this, since both
pid and tid is used in both pthread_{join,cancel} and also on raise
(which also have another issue somewhat related [2]) and I am inclined
to just remove the CLONE_VM changes to pid/tid fields in the syscall
itself and moving it to START_THREAD_DEFN instead.
Any better ideas, tips, advices?
[1] https://sourceware.org/ml/libc-alpha/2016-04/msg00274.html
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=15368