ThreadSanitizer: data race rbtdb.c:5756 in add32
Found by running dnssec-signzone
compiled from c5b6f215 in the dnssec system test:
WARNING: ThreadSanitizer: data race (pid=18887)
Write of size 8 at 0x7b5c00000928 by thread T5:
#0 add32 rbtdb.c:5756 (libdns.1503.dylib:x86_64+0xbd8e9)
#1 addrdataset rbtdb.c:6599 (libdns.1503.dylib:x86_64+0xb9abc)
#2 dns_db_addrdataset db.c:744 (libdns.1503.dylib:x86_64+0x2c2ee)
#3 diff_apply diff.c:364 (libdns.1503.dylib:x86_64+0x302cc)
#4 dns_diff_applysilently diff.c:457 (libdns.1503.dylib:x86_64+0x306bb)
#5 signname dnssec-signzone.c:1147 (dnssec-signzone:x86_64+0x10000c9dd)
#6 sign dnssec-signzone.c:1627 (dnssec-signzone:x86_64+0x10000de57)
#7 run task.c:1134 (libisc.1503.dylib:x86_64+0x2c9e1)
Previous write of size 8 at 0x7b5c00000928 by thread T8:
#0 add32 rbtdb.c:5756 (libdns.1503.dylib:x86_64+0xbd8e9)
#1 addrdataset rbtdb.c:6599 (libdns.1503.dylib:x86_64+0xb9abc)
#2 dns_db_addrdataset db.c:744 (libdns.1503.dylib:x86_64+0x2c2ee)
#3 diff_apply diff.c:364 (libdns.1503.dylib:x86_64+0x302cc)
#4 dns_diff_applysilently diff.c:457 (libdns.1503.dylib:x86_64+0x306bb)
#5 signname dnssec-signzone.c:1147 (dnssec-signzone:x86_64+0x10000c9dd)
#6 sign dnssec-signzone.c:1627 (dnssec-signzone:x86_64+0x10000de57)
#7 run task.c:1134 (libisc.1503.dylib:x86_64+0x2c9e1)
Location is heap block of size 801 at 0x7b5c00000700 allocated by main thread:
#0 malloc <null>:5823120 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x4e65a)
#1 default_memalloc mem.c:685 (libisc.1503.dylib:x86_64+0x17ae1)
#2 newversion rbtdb.c:1281 (libdns.1503.dylib:x86_64+0xb37ee)
#3 dns_db_newversion db.c:383 (libdns.1503.dylib:x86_64+0x2adbf)
#4 main dnssec-signzone.c:3738 (dnssec-signzone:x86_64+0x1000036fa)
Thread T5 (tid=4542388, running) created by main thread at:
#0 pthread_create <null>:5823168 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2a9cd)
#1 isc_thread_create thread.c:75 (libisc.1503.dylib:x86_64+0x46d1c)
#2 main dnssec-signzone.c:3800 (dnssec-signzone:x86_64+0x100006289)
Thread T8 (tid=4542391, running) created by main thread at:
#0 pthread_create <null>:5823168 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2a9cd)
#1 isc_thread_create thread.c:75 (libisc.1503.dylib:x86_64+0x46d1c)
#2 main dnssec-signzone.c:3800 (dnssec-signzone:x86_64+0x100006289)
SUMMARY: ThreadSanitizer: data race rbtdb.c:5756 in add32
Edited by Ondřej Surý