[PATCH] eal: fix segment fault when exit trace

fengchengwen fengchengwen at huawei.com
Tue Jun 7 14:26:08 CEST 2022


Hi Bruce,

  Could you please test freebsd platform? I think it also have
the same problem, but I hasn't freebsd enviorment.

Thanks

On 2022/6/7 20:00, Chengwen Feng wrote:
> Bug scenario:
> 1. start testpmd:
> 	dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* -- -i
> 2. quit testpmd and then observed segment fault:
> 	Bye...
> 	Segmentation fault (core dumped)
> 
> The root cause is that rte_trace_save() and eal_trace_fini() access
> the huge pages which were cleanup by rte_eal_memory_detach().
> 
> This patch moves rte_trace_save() and eal_trace_fini() before
> rte_eal_memory_detach() to fix the bug.
> 
> Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> ---
>  lib/eal/linux/eal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index 1ef263434a..c6f2056197 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -1266,13 +1266,13 @@ rte_eal_cleanup(void)
>  	vfio_mp_sync_cleanup();
>  #endif
>  	rte_mp_channel_cleanup();
> +	rte_trace_save();
> +	eal_trace_fini();
>  	/* after this point, any DPDK pointers will become dangling */
>  	rte_eal_memory_detach();
>  	eal_mp_dev_hotplug_cleanup();
>  	rte_eal_malloc_heap_cleanup();
>  	rte_eal_alarm_cleanup();
> -	rte_trace_save();
> -	eal_trace_fini();
>  	eal_cleanup_config(internal_conf);
>  	rte_eal_log_cleanup();
>  	return 0;
> 



More information about the dev mailing list