[PATCH v2 05/19] nptl: Move setxid flag out of cancelhandling

Florian Weimer fweimer@redhat.com
Thu Aug 26 11:34:27 GMT 2021


* Adhemerval Zanella:

> Now that the thread state is tracked by 'joinstate' field, there is no
> need to keep the setxid flag within the 'cancelhandling'.  It simplifies
> the atomic code to set and reset it (since there is no need to handle
> the thread state concurrent update).

Some of this functionality reimplements the tidlock.

There is some functionality around thread creation, but I do not know if
the synchronization is entirely correct.  This makes it rather difficult
to review changes.

It's also not clear to me if we need to do anything to prevent early
setxid calls:

>  	  /* Don't allow setxid until cloned.  */

I suspect this should just look at the TID instead.  We create the
thread with all signals blocked, so once there is a TID (and the thread
has not exited), it is safe to send the signal.

> diff --git a/nptl/descr.h b/nptl/descr.h
> index 4b2db6edab..563b152bff 100644
> --- a/nptl/descr.h
> +++ b/nptl/descr.h

> +  /* Indicate whether thread is supposed to change XID.  */
> +  int setxid_flag;

This should document the possible values.

Thanks,
Florian



More information about the Libc-alpha mailing list