[PATCH 05/11] nptl: Deallocate the thread stack on setup failure (BZ #19511)

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed May 26 19:26:51 GMT 2021



On 26/05/2021 13:57, Adhemerval Zanella wrote:
> @@ -435,10 +424,11 @@ start_thread (void *arg)
>  
>  	  /* And give it up right away.  */
>  	  lll_unlock (pd->lock, LLL_PRIVATE);
> -
> -	  LIBC_CANCEL_RESET (oldtype);
>  	}
>  
> +      if (pd->setup_failed == 1)
> +        __do_cancel ();
> +
>        LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg);
>  
>        /* Run the code the user provided.  */

And this is wrong, the created thread does not own the PD anymore
since for setup_failed == 1, pd->stopped_start will be true.

We need to call __do_cancel in the if above.


More information about the Libc-alpha mailing list