[PATCH v2 17/19] nptl: Use tidlock when accessing TID on pthread_sigqueue

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Aug 26 17:49:32 GMT 2021



On 26/08/2021 11:43, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> +  /* Block all signal, since the lock is recursive and used on pthread_cancel
>> +     (which should be async-signal-safe).  */
>> +  sigset_t oldmask;
>> +  __libc_signal_block_all (&oldmask);
>> +  lll_lock (pd->tidlock, LLL_PRIVATE);
>> +
>> +  int res;
>> +  if (pd->tid == 0)
>> +    {
>> +      pid_t pid = getpid ();
> 
> Huh, that can't be right, should be pd->tid != 0.
>

It is definitely not, I have fixed.

 
> Don't we have test coverage for this?

Nops, I will add one in the next version.

> 
>> +  else
>> +    res = -ESRCH;
> 
> We can return 0 in this case, I think.

No sure about this, we can return 0 but it means signal won't be potentially
delivered.

> 
> It's possibly that the same issue regarding synchronous signal delivery
> for pthread_jill applies here.
> 
> Thanks,
> Florian
> 


More information about the Libc-alpha mailing list