ThreadSanitizer: data race lib/dns/rbtdb.c:1545 in mark_header_stale and check_stale_header
Found in zero
test:
WARNING: ThreadSanitizer: data race (pid=7941)
Read of size 2 at 0x7b3000026adc by thread T2 (mutexes: read M633172806149932752, read M641898633507182144):
#0 mark_header_stale /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1545 (libdns.so.1505+0x10bd0b)
#1 check_stale_header /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4345 (libdns.so.1505+0x10bd0b)
#2 cache_find /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4797 (libdns.so.1505+0x122c03)
#3 dns_db_findext /home/ondrej/Projects/bind9/lib/dns/db.c:551 (libdns.so.1505+0x6673c)
#4 query_lookup /home/ondrej/Projects/bind9/lib/ns/query.c:5515 (libns.so.1502+0x3f6a0)
#5 ns__query_start /home/ondrej/Projects/bind9/lib/ns/query.c:5441 (libns.so.1502+0x40209)
#6 query_setup /home/ondrej/Projects/bind9/lib/ns/query.c:5162 (libns.so.1502+0x48c13)
#7 ns_query_start /home/ondrej/Projects/bind9/lib/ns/query.c:11239 (libns.so.1502+0x49444)
#8 ns__client_request /home/ondrej/Projects/bind9/lib/ns/client.c:2157 (libns.so.1502+0x15890)
#9 udp_recv_cb /home/ondrej/Projects/bind9/lib/isc/netmgr/udp.c:317 (libisc.so.1504+0x46926)
#10 <null> <null> (libuv.so.1+0x1d6d4)
#11 <null> <null> (libtsan.so.0+0x29b3d)
Previous write of size 2 at 0x7b3000026adc by thread T6 (mutexes: read M633172806149932752, read M641898633507182144):
#0 mark_header_stale /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1557 (libdns.so.1505+0x10bd67)
#1 check_stale_header /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4345 (libdns.so.1505+0x10bd67)
#2 cache_find /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4797 (libdns.so.1505+0x122c03)
#3 dns_db_findext /home/ondrej/Projects/bind9/lib/dns/db.c:551 (libdns.so.1505+0x6673c)
#4 query_lookup /home/ondrej/Projects/bind9/lib/ns/query.c:5515 (libns.so.1502+0x3f6a0)
#5 ns__query_start /home/ondrej/Projects/bind9/lib/ns/query.c:5441 (libns.so.1502+0x40209)
#6 query_setup /home/ondrej/Projects/bind9/lib/ns/query.c:5162 (libns.so.1502+0x48c13)
#7 ns_query_start /home/ondrej/Projects/bind9/lib/ns/query.c:11239 (libns.so.1502+0x49444)
#8 ns__client_request /home/ondrej/Projects/bind9/lib/ns/client.c:2157 (libns.so.1502+0x15890)
#9 udp_recv_cb /home/ondrej/Projects/bind9/lib/isc/netmgr/udp.c:317 (libisc.so.1504+0x46926)
#10 <null> <null> (libuv.so.1+0x1d6d4)
#11 <null> <null> (libtsan.so.0+0x29b3d)
Location is heap block of size 181 at 0x7b3000026ac0 allocated by thread T11:
#0 malloc <null> (libtsan.so.0+0x2b1a3)
#1 default_memalloc /home/ondrej/Projects/bind9/lib/isc/mem.c:685 (libisc.so.1504+0x33fee)
#2 mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:598 (libisc.so.1504+0x34c7e)
#3 mem_allocateunlocked /home/ondrej/Projects/bind9/lib/isc/mem.c:1222 (libisc.so.1504+0x34c7e)
#4 isc___mem_allocate /home/ondrej/Projects/bind9/lib/isc/mem.c:1242 (libisc.so.1504+0x34c7e)
#5 isc__mem_allocate /home/ondrej/Projects/bind9/lib/isc/mem.c:2387 (libisc.so.1504+0x3be64)
#6 isc___mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:1007 (libisc.so.1504+0x3c6ca)
#7 isc__mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:2365 (libisc.so.1504+0x3aef1)
#8 dns_rdataslab_fromrdataset /home/ondrej/Projects/bind9/lib/dns/rdataslab.c:266 (libdns.so.1505+0x17a212)
#9 addrdataset /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:6461 (libdns.so.1505+0x119b45)
#10 dns_db_addrdataset /home/ondrej/Projects/bind9/lib/dns/db.c:744 (libdns.so.1505+0x673cf)
#11 cache_name /home/ondrej/Projects/bind9/lib/dns/resolver.c:6316 (libdns.so.1505+0x19404b)
#12 cache_message /home/ondrej/Projects/bind9/lib/dns/resolver.c:6413 (libdns.so.1505+0x1ae663)
#13 resquery_response /home/ondrej/Projects/bind9/lib/dns/resolver.c:7631 (libdns.so.1505+0x1ae663)
#14 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56fa6)
#15 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56fa6)
#16 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M633172806149932752 is already destroyed.
Mutex M641898633507182144 is already destroyed.
Thread T2 'isc-net-0001' (tid=7987, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_nm_start /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:149 (libisc.so.1504+0x3ec7a)
#3 create_managers main.c:895 (named+0x1ae90)
#4 setup main.c:1235 (named+0x1ae90)
#5 main main.c:1515 (named+0x1ae90)
Thread T6 'isc-net-0005' (tid=8016, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_nm_start /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:149 (libisc.so.1504+0x3ec7a)
#3 create_managers main.c:895 (named+0x1ae90)
#4 setup main.c:1235 (named+0x1ae90)
#5 main main.c:1515 (named+0x1ae90)
Thread T11 'isc-worker0002' (tid=8040, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410 (libisc.so.1504+0x59d63)
#3 create_managers main.c:902 (named+0x1aeec)
#4 setup main.c:1235 (named+0x1aeec)
#5 main main.c:1515 (named+0x1aeec)
SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1545 in mark_header_stale
WARNING: ThreadSanitizer: data race (pid=7941)
Read of size 2 at 0x7b340000271c by thread T3 (mutexes: read M633172806149932752, read M641617158530471408):
#0 mark_header_stale /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1545 (libdns.so.1505+0x10bd0b)
#1 check_stale_header /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4345 (libdns.so.1505+0x10bd0b)
#2 find_deepest_zonecut /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4503 (libdns.so.1505+0x10eed1)
#3 cache_find /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4758 (libdns.so.1505+0x1236b0)
#4 dns_db_findext /home/ondrej/Projects/bind9/lib/dns/db.c:551 (libdns.so.1505+0x6673c)
#5 query_lookup /home/ondrej/Projects/bind9/lib/ns/query.c:5515 (libns.so.1502+0x3f6a0)
#6 ns__query_start /home/ondrej/Projects/bind9/lib/ns/query.c:5441 (libns.so.1502+0x40209)
#7 query_setup /home/ondrej/Projects/bind9/lib/ns/query.c:5162 (libns.so.1502+0x48c13)
#8 ns_query_start /home/ondrej/Projects/bind9/lib/ns/query.c:11239 (libns.so.1502+0x49444)
#9 ns__client_request /home/ondrej/Projects/bind9/lib/ns/client.c:2157 (libns.so.1502+0x15890)
#10 udp_recv_cb /home/ondrej/Projects/bind9/lib/isc/netmgr/udp.c:317 (libisc.so.1504+0x46926)
#11 <null> <null> (libuv.so.1+0x1d6d4)
#12 <null> <null> (libtsan.so.0+0x29b3d)
Previous write of size 2 at 0x7b340000271c by thread T5 (mutexes: read M633172806149932752, read M641617158530471408):
#0 mark_header_stale /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1557 (libdns.so.1505+0x10bd67)
#1 check_stale_header /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4345 (libdns.so.1505+0x10bd67)
#2 find_deepest_zonecut /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4503 (libdns.so.1505+0x10eed1)
#3 cache_find /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4758 (libdns.so.1505+0x1236b0)
#4 dns_db_findext /home/ondrej/Projects/bind9/lib/dns/db.c:551 (libdns.so.1505+0x6673c)
#5 query_lookup /home/ondrej/Projects/bind9/lib/ns/query.c:5515 (libns.so.1502+0x3f6a0)
#6 ns__query_start /home/ondrej/Projects/bind9/lib/ns/query.c:5441 (libns.so.1502+0x40209)
#7 query_setup /home/ondrej/Projects/bind9/lib/ns/query.c:5162 (libns.so.1502+0x48c13)
#8 ns_query_start /home/ondrej/Projects/bind9/lib/ns/query.c:11239 (libns.so.1502+0x49444)
#9 ns__client_request /home/ondrej/Projects/bind9/lib/ns/client.c:2157 (libns.so.1502+0x15890)
#10 udp_recv_cb /home/ondrej/Projects/bind9/lib/isc/netmgr/udp.c:317 (libisc.so.1504+0x46926)
#11 <null> <null> (libuv.so.1+0x1d6d4)
#12 <null> <null> (libtsan.so.0+0x29b3d)
Location is heap block of size 197 at 0x7b3400002700 allocated by thread T11:
#0 malloc <null> (libtsan.so.0+0x2b1a3)
#1 default_memalloc /home/ondrej/Projects/bind9/lib/isc/mem.c:685 (libisc.so.1504+0x33fee)
#2 mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:598 (libisc.so.1504+0x34c7e)
#3 mem_allocateunlocked /home/ondrej/Projects/bind9/lib/isc/mem.c:1222 (libisc.so.1504+0x34c7e)
#4 isc___mem_allocate /home/ondrej/Projects/bind9/lib/isc/mem.c:1242 (libisc.so.1504+0x34c7e)
#5 isc__mem_allocate /home/ondrej/Projects/bind9/lib/isc/mem.c:2387 (libisc.so.1504+0x3be64)
#6 isc___mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:1007 (libisc.so.1504+0x3c6ca)
#7 isc__mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:2365 (libisc.so.1504+0x3aef1)
#8 dns_rdataslab_fromrdataset /home/ondrej/Projects/bind9/lib/dns/rdataslab.c:266 (libdns.so.1505+0x17a212)
#9 addrdataset /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:6461 (libdns.so.1505+0x119b45)
#10 dns_db_addrdataset /home/ondrej/Projects/bind9/lib/dns/db.c:744 (libdns.so.1505+0x673cf)
#11 cache_name /home/ondrej/Projects/bind9/lib/dns/resolver.c:6316 (libdns.so.1505+0x19404b)
#12 cache_message /home/ondrej/Projects/bind9/lib/dns/resolver.c:6413 (libdns.so.1505+0x1ae663)
#13 resquery_response /home/ondrej/Projects/bind9/lib/dns/resolver.c:7631 (libdns.so.1505+0x1ae663)
#14 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56fa6)
#15 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56fa6)
#16 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M633172806149932752 is already destroyed.
Mutex M641617158530471408 is already destroyed.
Thread T3 'isc-net-0002' (tid=7993, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_nm_start /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:149 (libisc.so.1504+0x3ec7a)
#3 create_managers main.c:895 (named+0x1ae90)
#4 setup main.c:1235 (named+0x1ae90)
#5 main main.c:1515 (named+0x1ae90)
Thread T5 'isc-net-0004' (tid=8008, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_nm_start /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:149 (libisc.so.1504+0x3ec7a)
#3 create_managers main.c:895 (named+0x1ae90)
#4 setup main.c:1235 (named+0x1ae90)
#5 main main.c:1515 (named+0x1ae90)
Thread T11 'isc-worker0002' (tid=8040, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410 (libisc.so.1504+0x59d63)
#3 create_managers main.c:902 (named+0x1aeec)
#4 setup main.c:1235 (named+0x1aeec)
#5 main main.c:1515 (named+0x1aeec)
SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1545 in mark_header_stale
WARNING: ThreadSanitizer: data race (pid=7941)
Read of size 2 at 0x7b34000310fc by thread T5 (mutexes: read M633172806149932752, read M641617158530471408):
#0 check_stale_header /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4336 (libdns.so.1505+0x10bceb)
#1 find_deepest_zonecut /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4503 (libdns.so.1505+0x10eed1)
#2 cache_find /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4758 (libdns.so.1505+0x1236b0)
#3 dns_db_findext /home/ondrej/Projects/bind9/lib/dns/db.c:551 (libdns.so.1505+0x6673c)
#4 query_lookup /home/ondrej/Projects/bind9/lib/ns/query.c:5515 (libns.so.1502+0x3f6a0)
#5 ns__query_start /home/ondrej/Projects/bind9/lib/ns/query.c:5441 (libns.so.1502+0x40209)
#6 query_setup /home/ondrej/Projects/bind9/lib/ns/query.c:5162 (libns.so.1502+0x48c13)
#7 ns_query_start /home/ondrej/Projects/bind9/lib/ns/query.c:11239 (libns.so.1502+0x49444)
#8 ns__client_request /home/ondrej/Projects/bind9/lib/ns/client.c:2157 (libns.so.1502+0x15890)
#9 udp_recv_cb /home/ondrej/Projects/bind9/lib/isc/netmgr/udp.c:317 (libisc.so.1504+0x46926)
#10 <null> <null> (libuv.so.1+0x1d6d4)
#11 <null> <null> (libtsan.so.0+0x29b3d)
Previous write of size 2 at 0x7b34000310fc by thread T11 (mutexes: write M57556908275267488, read M633172806149932752, read M641617158530471408):
#0 mark_header_stale /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:1557 (libdns.so.1505+0x10bd67)
#1 check_stale_header /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4345 (libdns.so.1505+0x10bd67)
#2 find_deepest_zonecut /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4503 (libdns.so.1505+0x10eed1)
#3 cache_find /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4758 (libdns.so.1505+0x1236b0)
#4 dns_db_find /home/ondrej/Projects/bind9/lib/dns/db.c:511 (libdns.so.1505+0x6648d)
#5 dns_view_find /home/ondrej/Projects/bind9/lib/dns/view.c:1019 (libdns.so.1505+0x1f6fdd)
#6 dbfind_name /home/ondrej/Projects/bind9/lib/dns/adb.c:3678 (libdns.so.1505+0x3f65f)
#7 dns_adb_createfind /home/ondrej/Projects/bind9/lib/dns/adb.c:3070 (libdns.so.1505+0x529ad)
#8 findname /home/ondrej/Projects/bind9/lib/dns/resolver.c:3382 (libdns.so.1505+0x186a47)
#9 fctx_getaddresses /home/ondrej/Projects/bind9/lib/dns/resolver.c:3669 (libdns.so.1505+0x19a933)
#10 fctx_try /home/ondrej/Projects/bind9/lib/dns/resolver.c:4029 (libdns.so.1505+0x1a1a94)
#11 fctx_start /home/ondrej/Projects/bind9/lib/dns/resolver.c:4651 (libdns.so.1505+0x1a5a0b)
#12 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56fa6)
#13 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56fa6)
#14 <null> <null> (libtsan.so.0+0x29b3d)
Location is heap block of size 197 at 0x7b34000310e0 allocated by thread T10:
#0 malloc <null> (libtsan.so.0+0x2b1a3)
#1 default_memalloc /home/ondrej/Projects/bind9/lib/isc/mem.c:685 (libisc.so.1504+0x33fee)
#2 mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:598 (libisc.so.1504+0x34c7e)
#3 mem_allocateunlocked /home/ondrej/Projects/bind9/lib/isc/mem.c:1222 (libisc.so.1504+0x34c7e)
#4 isc___mem_allocate /home/ondrej/Projects/bind9/lib/isc/mem.c:1242 (libisc.so.1504+0x34c7e)
#5 isc__mem_allocate /home/ondrej/Projects/bind9/lib/isc/mem.c:2387 (libisc.so.1504+0x3be64)
#6 isc___mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:1007 (libisc.so.1504+0x3c6ca)
#7 isc__mem_get /home/ondrej/Projects/bind9/lib/isc/mem.c:2365 (libisc.so.1504+0x3aef1)
#8 dns_rdataslab_fromrdataset /home/ondrej/Projects/bind9/lib/dns/rdataslab.c:266 (libdns.so.1505+0x17a212)
#9 addrdataset /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:6461 (libdns.so.1505+0x119b45)
#10 dns_db_addrdataset /home/ondrej/Projects/bind9/lib/dns/db.c:744 (libdns.so.1505+0x673cf)
#11 cache_name /home/ondrej/Projects/bind9/lib/dns/resolver.c:6316 (libdns.so.1505+0x19404b)
#12 cache_message /home/ondrej/Projects/bind9/lib/dns/resolver.c:6413 (libdns.so.1505+0x1ae663)
#13 resquery_response /home/ondrej/Projects/bind9/lib/dns/resolver.c:7631 (libdns.so.1505+0x1ae663)
#14 dispatch /home/ondrej/Projects/bind9/lib/isc/task.c:1134 (libisc.so.1504+0x56fa6)
#15 run /home/ondrej/Projects/bind9/lib/isc/task.c:1319 (libisc.so.1504+0x56fa6)
#16 <null> <null> (libtsan.so.0+0x29b3d)
Mutex M633172806149932752 is already destroyed.
Mutex M641617158530471408 is already destroyed.
Mutex M57556908275267488 is already destroyed.
Thread T5 'isc-net-0004' (tid=8008, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_nm_start /home/ondrej/Projects/bind9/lib/isc/netmgr/netmgr.c:149 (libisc.so.1504+0x3ec7a)
#3 create_managers main.c:895 (named+0x1ae90)
#4 setup main.c:1235 (named+0x1ae90)
#5 main main.c:1515 (named+0x1ae90)
Thread T11 'isc-worker0002' (tid=8040, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410 (libisc.so.1504+0x59d63)
#3 create_managers main.c:902 (named+0x1aeec)
#4 setup main.c:1235 (named+0x1aeec)
#5 main main.c:1515 (named+0x1aeec)
Thread T10 'isc-worker0001' (tid=8038, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 isc_thread_create /home/ondrej/Projects/bind9/lib/isc/pthreads/thread.c:75 (libisc.so.1504+0x7bcc4)
#2 isc_taskmgr_create /home/ondrej/Projects/bind9/lib/isc/task.c:1410 (libisc.so.1504+0x59d63)
#3 create_managers main.c:902 (named+0x1aeec)
#4 setup main.c:1235 (named+0x1aeec)
#5 main main.c:1515 (named+0x1aeec)
SUMMARY: ThreadSanitizer: data race /home/ondrej/Projects/bind9/lib/dns/rbtdb.c:4336 in check_stale_header
Edited by Ondřej Surý