TSAN data race in zone.c
TSAN reports a race between dns_zone_rekey()
and zone_maintenance()
. Turns out zone_maintenance()
accesses all the timer info unlocked, whoops.
WARNING: ThreadSanitizer: data race
Write of size 8 at 0x000000000001 by main thread (mutexes: write M1):
#0 dns_zone_rekey lib/dns/zone.c:22097
#1 named_server_dnssec bin/named/server.c:15335
#2 named_control_docommand bin/named/control.c:206
#3 control_command bin/named/controlconf.c:390
#4 task_run lib/isc/task.c:470
#5 task__run lib/isc/task.c:287
#6 isc__job_cb lib/isc/job.c:75
#7 uv__run_idle /usr/src/libuv-v1.44.1/src/unix/loop-watcher.c:68
#8 isc_loopmgr_run lib/isc/loop.c:469
#9 main bin/named/main.c:1545
Previous read of size 4 at 0x000000000001 by thread T1:
#0 isc_time_isepoch lib/isc/time.c:81
#1 zone_maintenance lib/dns/zone.c:11559
#2 zone_timer lib/dns/zone.c:15214
#3 timer_cb lib/isc/timer.c:113
#4 uv__run_timers /usr/src/libuv-v1.44.1/src/timer.c:178
#5 isc__trampoline_run lib/isc/trampoline.c:198
Location is heap block of size 3216 at 0x000000000018 allocated by main thread:
#0 malloc <null>
#1 mallocx lib/isc/jemalloc_shim.h:57
#2 mem_get lib/isc/mem.c:343
#3 isc__mem_get lib/isc/mem.c:774
#4 dns_zone_create lib/dns/zone.c:1158
#5 dns_zonemgr_createzone lib/dns/zone.c:19035
#6 configure_zone bin/named/server.c:6791
#7 configure_view bin/named/server.c:4208
#8 load_configuration bin/named/server.c:9271
#9 run_server bin/named/server.c:10065
#10 task_run lib/isc/task.c:470
#11 task__run lib/isc/task.c:287
#12 isc__job_cb lib/isc/job.c:75
#13 uv__run_idle /usr/src/libuv-v1.44.1/src/unix/loop-watcher.c:68
#14 isc_loopmgr_run lib/isc/loop.c:469
#15 main bin/named/main.c:1545
Mutex M1 (0x000000000028) created at:
#0 pthread_mutex_init <null>
#1 dns_zone_create lib/dns/zone.c:1163
#2 dns_zonemgr_createzone lib/dns/zone.c:19035
#3 configure_zone bin/named/server.c:6791
#4 configure_view bin/named/server.c:4208
#5 load_configuration bin/named/server.c:9271
#6 run_server bin/named/server.c:10065
#7 task_run lib/isc/task.c:470
#8 task__run lib/isc/task.c:287
#9 isc__job_cb lib/isc/job.c:75
#10 uv__run_idle /usr/src/libuv-v1.44.1/src/unix/loop-watcher.c:68
#11 isc_loopmgr_run lib/isc/loop.c:469
#12 main bin/named/main.c:1545
Thread T1 'isc-loop-0001' (running) created by main thread at:
#0 pthread_create <null>
#1 isc_thread_create lib/isc/thread.c:70
#2 isc_loopmgr_run lib/isc/loop.c:463
#3 main bin/named/main.c:1545
SUMMARY: ThreadSanitizer: data race lib/dns/zone.c:22097 in dns_zone_rekey