Skip to contentSkip to conversation

DPDK with -fsanitize=thread failure

dpdk-dev Stephen Hemminger 1 participant 1 message Aug 1, 2020

lore
Share & tools
lore
#0 lore raw

Tried running DPDK under Address Sanitizer with the thread data race option, and ran into something that needs some discussion. Is this just an ASAN bug?

The fatal log is:

==================
WARNING: ThreadSanitizer: data race (pid=28275)

  Write of size 1 at 0xfffff5000580 by main thread:
    #0 pthread_barrier_destroy <null> (libtsan.so.0+0x314b3)
    #1 rte_ctrl_thread_create <null> (librte_eal.so.20.0+0x2f9db)
    #2 rte_eal_intr_init <null> (librte_eal.so.20.0+0x1e573)
    #3 rte_eal_init <null> (librte_eal.so.20.0+0xcb9b)
    #4 <null> <null> (dpdk-backplane+0xb2ab)
    #5 main <null> (dpdk-backplane+0xa1ab)

Previous read of size 1 at 0xfffff5000580 by thread T3:

    #0 pthread_barrier_wait <null> (libtsan.so.0+0x315cf)
    #1 rte_thread_init <null> (librte_eal.so.20.0+0x2f44f)
    #2 <null> <null> (libtsan.so.0+0x2cc63)

Location is heap block of size 48 at 0xfffff5000570 allocated by main thread:

    #0 malloc <null> (libtsan.so.0+0x2e4ef)
    #1 rte_ctrl_thread_create <null> (librte_eal.so.20.0+0x2f873)
    #2 rte_eal_intr_init <null> (librte_eal.so.20.0+0x1e573)
    #3 rte_eal_init <null> (librte_eal.so.20.0+0xcb9b)
    #4 <null> <null> (dpdk-backplane+0xb2ab)
    #5 main <null> (dpdk-backplane+0xa1ab)

Thread T3 'eal-intr-thread' (tid=28284, running) created by main thread at:

    #0 pthread_create <null> (libtsan.so.0+0x2f5a7)
    #1 rte_ctrl_thread_create <null> (librte_eal.so.20.0+0x2f8bb)
    #2 rte_eal_intr_init <null> (librte_eal.so.20.0+0x1e573)
    #3 rte_eal_init <null> (librte_eal.so.20.0+0xcb9b)
    #4 <null> <null> (dpdk-backplane+0xb2ab)
    #5 main <null> (dpdk-backplane+0xa1ab)

SUMMARY: ThreadSanitizer: data race (/lib/libtsan.so.0+0x314b3) in pthread_barrier_destroy
==================

The code is:

	pthread_barrier_init(&params->configured, NULL, 2);
	ret = pthread_create(thread, attr, ctrl_thread_init, (void *)params);
...
	ret = pthread_barrier_wait(&params->configured);
	if (ret == PTHREAD_BARRIER_SERIAL_THREAD) {
		pthread_barrier_destroy(&params->configured);