On 5/2/2018 6:08 PM, Olivier Matz wrote:
On Wed, May 02, 2018 at 06:01:20PM +0800, Tan, Jianfeng wrote:
Hi Olivier and Anatoly,

[...]

Below patch can fix another strange sigsegv issue in my VM. Please check
if it works for you. I doubt it's use-after-free problem which could
lead to different issues in different env. Please have a try.


diff --git a/lib/librte_eal/common/eal_common_thread.c
b/lib/librte_eal/common/eal_common_thread.c
index de69452..d91b67d 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -205,6 +205,7 @@ rte_ctrl_thread_create(pthread_t *thread, const char
*name,
                   goto fail;

           pthread_barrier_wait(&params->configured);
+       pthread_barrier_destroy(&params->configured);
           free(params);
Should destroy also be called in fail case?
Yes, and also pthread_barrier_wait().

I did a quick test simulating a failure of rte_thread_setname(), and
without the wait, the barrier in the child thread blocks forever.

v1 has been sent without seeing this email. You are right, I misunderstood
it. Will send a v2 based on this result.

Thanks,
Jianfeng
Thanks.

Not sure it should be in the same patch, however there is also
a memory leak here:

         ret = pthread_create(thread, attr, rte_thread_init, (void *)params);
         if (ret != 0)
                 return ret;

My bad, will fix it in a separate patch.

Thanks,
Jianfeng

Reply via email to