[PATCH v5] lib/eal: fix segfaults in exiting

Stephen Hemminger stephen at networkplumber.org
Tue Sep 6 17:03:37 CEST 2022


On Tue,  6 Sep 2022 10:51:31 +0800
Zhichao Zeng <zhichaox.zeng at intel.com> wrote:

>  
> +static void mark_forked(void)
> +{
> +	is_forked++;
> +}
> +

This will end up counting application threads as well.

Also, it would need to be atomic.

>  /* Launch threads, called at application init(). */
>  int
>  rte_eal_init(int argc, char **argv)
> @@ -1324,6 +1331,8 @@ rte_eal_init(int argc, char **argv)
>  
>  	eal_mcfg_complete();
>  
> +	pthread_atfork(NULL, NULL, mark_forked);
> +
>  	return fctret;
>  }

>  int
>  rte_eal_cleanup(void)
>  {
> +	if (is_forked)
> +		return 0;
> +

rte_eal_cleanup is supposed to be called only once by application.


More information about the stable mailing list