Commit Graph
28976 Commits
Author SHA1 Message Date
Ondřej Surý 98def35e72 Handle the errors from sysconf() call in isc_meminfo_totalphys()
isc_meminfo_totalphys() would return invalid memory size when sysconf()
call would fail, because ((size_t)-1 * -1) is very large number.

(cherry picked from commit 79ca724d46)
2020-09-21 10:59:36 +02:00
Ondřej Surý f12893d4a7 Merge branch '2163-threadsanitizer-data-race-lib-isc-mem-c-1119-19-in-isc___mem_put-v9_11' into 'v9_11'
Exclude isc_mem_isovermem from ThreadSanitizer

See merge request isc-projects/bind9!4144
2020-09-18 06:52:41 +00:00
Ondřej Surý fe738c7432 Exclude isc_mem_isovermem from ThreadSanitizer
The .is_overmem member of isc_mem_t structure is intentionally accessed
unlocked as 100% accuracy isn't necessary here.

Without the attribute, following TSAN warning would show up:

    WARNING: ThreadSanitizer: data race
      Write of size 1 at 0x000000000001 by thread T1 (mutexes: write M1, write M2):
	#0 isc___mem_put lib/isc/mem.c:1119:19
	#1 isc__mem_put lib/isc/mem.c:2439:2
	#2 dns_rdataslab_fromrdataset lib/dns/rdataslab.c:327:2
	#3 addrdataset lib/dns/rbtdb.c:6761:11
	#4 dns_db_addrdataset lib/dns/db.c:719:10
	#5 cache_name lib/dns/resolver.c:6538:13
	#6 cache_message lib/dns/resolver.c:6628:14
	#7 resquery_response lib/dns/resolver.c:7883:13
	#8 dispatch lib/isc/task.c:1152:7
	#9 run lib/isc/task.c:1344:2

      Previous read of size 1 at 0x000000000001 by thread T2 (mutexes: write M3):
	#0 isc_mem_isovermem lib/isc/mem.c:1553:15
	#1 addrdataset lib/dns/rbtdb.c:6866:25
	#2 dns_db_addrdataset lib/dns/db.c:719:10
	#3 addoptout lib/dns/ncache.c:281:10
	#4 dns_ncache_add lib/dns/ncache.c:101:10
	#5 ncache_adderesult lib/dns/resolver.c:6668:12
	#6 ncache_message lib/dns/resolver.c:6845:11
	#7 rctx_ncache lib/dns/resolver.c:9174:11
	#8 resquery_response lib/dns/resolver.c:7894:2
	#9 dispatch lib/isc/task.c:1152:7
	#10 run lib/isc/task.c:1344:2

      Location is heap block of size 328 at 0x000000000020 allocated by thread T3:
	#0 malloc <null>
	#1 default_memalloc lib/isc/mem.c:713:8
	#2 mem_create lib/isc/mem.c:763:8
	#3 isc_mem_create lib/isc/mem.c:2425:2
	#4 configure_view bin/named/server.c:4494:4
	#5 load_configuration bin/named/server.c:9062:3
	#6 run_server bin/named/server.c:9771:2
	#7 dispatch lib/isc/task.c:1152:7
	#8 run lib/isc/task.c:1344:2

    [...]

    SUMMARY: ThreadSanitizer: data race lib/isc/mem.c:1119:19 in isc___mem_put

(cherry picked from commit 0110d1ab17)
2020-09-17 17:39:03 +02:00
Mark Andrews 42a0a1da44 Merge branch '2131-tsan-data-race-in-accessing-controls-symtab-v9_11' into 'v9_11'
Lock access to control->symtab to prevent data race

See merge request isc-projects/bind9!4139
2020-09-17 10:21:53 +00:00
Mark Andrews 7247df0fcf Lock access to control->symtab to prevent data race
WARNING: ThreadSanitizer: data race
    Read of size 8 at 0x000000000001 by thread T1:
    #0 isccc_symtab_foreach lib/isccc/symtab.c:277:14
    #1 isccc_cc_cleansymtab lib/isccc/cc.c:954:2
    #2 control_recvmessage bin/named/controlconf.c:477:2
    #3 recv_data lib/isccc/ccmsg.c:110:2
    #4 read_cb lib/isc/netmgr/tcp.c:769:4
    #5 <null> <null>

    Previous write of size 8 at 0x000000000001 by thread T2:
    #0 isccc_symtab_define lib/isccc/symtab.c:242:2
    #1 isccc_cc_checkdup lib/isccc/cc.c:1026:11
    #2 control_recvmessage bin/named/controlconf.c:478:11
    #3 recv_data lib/isccc/ccmsg.c:110:2
    #4 read_cb lib/isc/netmgr/tcp.c:769:4
    #5 <null> <null>

    Location is heap block of size 190352 at 0x000000000011 allocated by main thread:
    #0 malloc <null>
    #1 isccc_symtab_create lib/isccc/symtab.c:76:18
    #2 isccc_cc_createsymtab lib/isccc/cc.c:948:10
    #3 named_controls_create bin/named/controlconf.c:1483:11
    #4 named_server_create bin/named/server.c:10057:2
    #5 setup bin/named/main.c:1256:2
    #6 main bin/named/main.c:1523:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_nm_start lib/isc/netmgr/netmgr.c:215:3
    #3 create_managers bin/named/main.c:909:15
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T2 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_nm_start lib/isc/netmgr/netmgr.c:215:3
    #3 create_managers bin/named/main.c:909:15
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: data race lib/isccc/symtab.c:277:14 in isccc_symtab_foreach

(cherry picked from commit 0450acc1b6)
2020-09-17 20:06:27 +10:00
Mark Andrews 1051c51d4c Merge branch '2123-lock-order-inversions-in-main-v9_11' into 'v9_11'
Resolve "Lock order inversions in main"

See merge request isc-projects/bind9!4137
2020-09-17 09:02:33 +00:00
Mark Andrews 267fe9a6b7 Pause dbiterator ealier to prevent lock-order-inversion
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000000) => M2 (0x000000000000) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 findnodeintree lib/dns/rbtdb.c:2877:2
    #3 findnode lib/dns/rbtdb.c:2941:10
    #4 dns_db_findnode lib/dns/db.c:439:11
    #5 resume_addnsec3chain lib/dns/zone.c:3776:11
    #6 rss_post lib/dns/zone.c:20659:3
    #7 setnsec3param lib/dns/zone.c:20471:3
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null>
    #1 rss_post lib/dns/zone.c:20658:3
    #2 setnsec3param lib/dns/zone.c:20471:3
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T2:
    #0 pthread_mutex_lock <null>
    #1 zone_nsec3chain lib/dns/zone.c:8666:5
    #2 zone_maintenance lib/dns/zone.c:11063:4
    #3 zone_timer lib/dns/zone.c:14098:2
    #4 dispatch lib/isc/task.c:1152:7
    #5 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_next lib/dns/rbtdb.c:9647:3
    #4 dns_dbiterator_next lib/dns/dbiterator.c:87:10
    #5 zone_nsec3chain lib/dns/zone.c:8656:13
    #6 zone_maintenance lib/dns/zone.c:11063:4
    #7 zone_timer lib/dns/zone.c:14098:2
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

(cherry picked from commit 9e584a4511)
2020-09-17 18:27:14 +10:00
Mark Andrews 9781ce414a Pause the database iterator to release rwlock
(cherry picked from commit 2e63de94aa)
2020-09-17 18:26:28 +10:00
Mark Andrews 215526caf4 Pause dbiterator to release rwlock to prevent lock-order-inversion.
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000000) => M2 (0x000000000001) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 getsigningtime lib/dns/rbtdb.c:8198:2
    #3 dns_db_getsigningtime lib/dns/db.c:979:11
    #4 set_resigntime lib/dns/zone.c:3887:11
    #5 dns_zone_markdirty lib/dns/zone.c:11119:4
    #6 update_action lib/ns/update.c:3376:3
    #7 dispatch lib/isc/task.c:1152:7
    #8 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null>
    #1 dns_zone_markdirty lib/dns/zone.c:11089:2
    #2 update_action lib/ns/update.c:3376:3
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T1:
    #0 pthread_mutex_lock <null>
    #1 zone_nsec3chain lib/dns/zone.c:8502:3
    #2 zone_maintenance lib/dns/zone.c:11056:4
    #3 zone_timer lib/dns/zone.c:14091:2
    #4 dispatch lib/isc/task.c:1152:7
    #5 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_current lib/dns/rbtdb.c:9695:3
    #4 dns_dbiterator_current lib/dns/dbiterator.c:101:10
    #5 zone_nsec3chain lib/dns/zone.c:8539:3
    #6 zone_maintenance lib/dns/zone.c:11056:4
    #7 zone_timer lib/dns/zone.c:14091:2
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_rdlock

(cherry picked from commit fbed962204)
2020-09-17 18:26:27 +10:00
Mark Andrews 38734d80b5 Pause dbiterator to release rwlock to prevent lock-order-inversion.
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000001) => M2 (0x000000000000) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 zone_sign lib/dns/zone.c:9247:3
    #3 zone_maintenance lib/dns/zone.c:11047:4
    #4 zone_timer lib/dns/zone.c:14090:2
    #5 dispatch lib/isc/task.c:1152:7
    #6 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_next lib/dns/rbtdb.c:9647:3
    #4 dns_dbiterator_next lib/dns/dbiterator.c:87:10
    #5 zone_sign lib/dns/zone.c:9488:13
    #6 zone_maintenance lib/dns/zone.c:11047:4
    #7 zone_timer lib/dns/zone.c:14090:2
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T2:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 findnodeintree lib/dns/rbtdb.c:2877:2
    #3 findnode lib/dns/rbtdb.c:2941:10
    #4 dns_db_findnode lib/dns/db.c:439:11
    #5 dns_db_getsoaserial lib/dns/db.c:780:11
    #6 dump_done lib/dns/zone.c:11428:15
    #7 dump_quantum lib/dns/masterdump.c:1487:2
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 dump_done lib/dns/zone.c:11426:4
    #3 dump_quantum lib/dns/masterdump.c:1487:2
    #4 dispatch lib/isc/task.c:1152:7
    #5 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T2 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_rdlock

(cherry picked from commit c9dbad97b2)
2020-09-17 18:26:27 +10:00
Mark Andrews 508bb0859c Pause dbiterator to release rwlock to prevent lock-order-inversion.
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000000) => M2 (0x000000000000) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 getsigningtime lib/dns/rbtdb.c:8198:2
    #3 dns_db_getsigningtime lib/dns/db.c:979:11
    #4 set_resigntime lib/dns/zone.c:3887:11
    #5 dns_zone_markdirty lib/dns/zone.c:11115:4
    #6 update_action lib/ns/update.c:3376:3
    #7 dispatch lib/isc/task.c:1152:7
    #8 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_mutex_lock <null>
    #1 dns_zone_markdirty lib/dns/zone.c:11085:2
    #2 update_action lib/ns/update.c:3376:3
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T2:
    #0 pthread_mutex_lock <null>
    #1 zone_nsec3chain lib/dns/zone.c:8274:3
    #2 zone_maintenance lib/dns/zone.c:11052:4
    #3 zone_timer lib/dns/zone.c:14087:2
    #4 dispatch lib/isc/task.c:1152:7
    #5 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_next lib/dns/rbtdb.c:9647:3
    #4 dns_dbiterator_next lib/dns/dbiterator.c:87:10
    #5 zone_nsec3chain lib/dns/zone.c:8412:13
    #6 zone_maintenance lib/dns/zone.c:11052:4
    #7 zone_timer lib/dns/zone.c:14087:2
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T2 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_rdlock

(cherry picked from commit 98025e15d0)
2020-09-17 18:26:26 +10:00
Mark Andrews 36849cbfa7 Pause dbiterator to release rwlock to prevent lock-order-inversion.
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000001) => M2 (0x000000000002) => M3 (0x000000000000) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 findnodeintree lib/dns/rbtdb.c:2877:2
    #3 findnode lib/dns/rbtdb.c:2941:10
    #4 dns_db_findnode lib/dns/db.c:439:11
    #5 copy_non_dnssec_records lib/dns/zone.c:16031:11
    #6 receive_secure_db lib/dns/zone.c:16163:12
    #7 dispatch lib/isc/task.c:1152:7
    #8 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_first lib/dns/rbtdb.c:9407:3
    #4 dns_dbiterator_first lib/dns/dbiterator.c:43:10
    #5 receive_secure_db lib/dns/zone.c:16160:16
    #6 dispatch lib/isc/task.c:1152:7
    #7 run lib/isc/task.c:1344:2

    Mutex M3 acquired here while holding mutex M2 in thread T2:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 zone_sign lib/dns/zone.c:9244:3
    #3 zone_maintenance lib/dns/zone.c:11044:4
    #4 zone_timer lib/dns/zone.c:14087:2
    #5 dispatch lib/isc/task.c:1152:7
    #6 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_next lib/dns/rbtdb.c:9647:3
    #4 dns_dbiterator_next lib/dns/dbiterator.c:87:10
    #5 zone_sign lib/dns/zone.c:9485:13
    #6 zone_maintenance lib/dns/zone.c:11044:4
    #7 zone_timer lib/dns/zone.c:14087:2
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M3 in thread T3:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 findnodeintree lib/dns/rbtdb.c:2877:2
    #3 findnode lib/dns/rbtdb.c:2941:10
    #4 dns_db_findnode lib/dns/db.c:439:11
    #5 zone_get_from_db lib/dns/zone.c:5602:11
    #6 get_raw_serial lib/dns/zone.c:2520:12
    #7 zone_gotwritehandle lib/dns/zone.c:2559:4
    #8 dispatch lib/isc/task.c:1152:7
    #9 run lib/isc/task.c:1344:2

    Mutex M3 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 zone_gotwritehandle lib/dns/zone.c:2552:2
    #3 dispatch lib/isc/task.c:1152:7
    #4 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T2 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T3 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_rdlock

(cherry picked from commit e185e37137)
2020-09-17 18:26:25 +10:00
Mark Andrews 7f6cddad0c Address lock-order-inversion between the keytable and the db locks.
WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
    Cycle in lock order graph: M1 (0x000000000000) => M2 (0x000000000000) => M1

    Mutex M2 acquired here while holding mutex M1 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 dns_keytable_find lib/dns/keytable.c:522:2
    #3 sync_keyzone lib/dns/zone.c:4560:12
    #4 dns_zone_synckeyzone lib/dns/zone.c:4635:11
    #5 mkey_refresh bin/named/server.c:15423:2
    #6 named_server_mkeys bin/named/server.c:15727:4
    #7 named_control_docommand bin/named/control.c:236:12
    #8 control_command bin/named/controlconf.c:365:17
    #9 dispatch lib/isc/task.c:1152:7
    #10 run lib/isc/task.c:1344:2

    Mutex M1 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 resume_iteration lib/dns/rbtdb.c:9357:2
    #3 dbiterator_first lib/dns/rbtdb.c:9407:3
    #4 dns_dbiterator_first lib/dns/dbiterator.c:43:10
    #5 dns_rriterator_first lib/dns/rriterator.c:71:15
    #6 sync_keyzone lib/dns/zone.c:4543:16
    #7 dns_zone_synckeyzone lib/dns/zone.c:4635:11
    #8 mkey_refresh bin/named/server.c:15423:2
    #9 named_server_mkeys bin/named/server.c:15727:4
    #10 named_control_docommand bin/named/control.c:236:12
    #11 control_command bin/named/controlconf.c:365:17
    #12 dispatch lib/isc/task.c:1152:7
    #13 run lib/isc/task.c:1344:2

    Mutex M1 acquired here while holding mutex M2 in thread T1:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 zone_find lib/dns/rbtdb.c:4029:2
    #3 dns_db_find lib/dns/db.c:500:11
    #4 addifmissing lib/dns/zone.c:4481:11
    #5 dns_keytable_forall lib/dns/keytable.c:786:4
    #6 sync_keyzone lib/dns/zone.c:4586:2
    #7 dns_zone_synckeyzone lib/dns/zone.c:4635:11
    #8 mkey_refresh bin/named/server.c:15423:2
    #9 named_server_mkeys bin/named/server.c:15727:4
    #10 named_control_docommand bin/named/control.c:236:12
    #11 control_command bin/named/controlconf.c:365:17
    #12 dispatch lib/isc/task.c:1152:7
    #13 run lib/isc/task.c:1344:2

    Mutex M2 previously acquired by the same thread here:
    #0 pthread_rwlock_rdlock <null>
    #1 isc_rwlock_lock lib/isc/rwlock.c:48:3
    #2 dns_keytable_forall lib/dns/keytable.c:770:2
    #3 sync_keyzone lib/dns/zone.c:4586:2
    #4 dns_zone_synckeyzone lib/dns/zone.c:4635:11
    #5 mkey_refresh bin/named/server.c:15423:2
    #6 named_server_mkeys bin/named/server.c:15727:4
    #7 named_control_docommand bin/named/control.c:236:12
    #8 control_command bin/named/controlconf.c:365:17
    #9 dispatch lib/isc/task.c:1152:7
    #10 run lib/isc/task.c:1344:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_taskmgr_create lib/isc/task.c:1434:3
    #3 create_managers bin/named/main.c:915:11
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in pthread_rwlock_rdlock

(cherry picked from commit 9e5f83c499)
2020-09-17 18:26:22 +10:00
Michał Kępień 0cc1d2942e Merge branch 'v9_11_23-release' into 'v9_11'
Merge 9.11.23 release branch

See merge request isc-projects/bind9!4133
2020-09-16 21:06:02 +00:00
Michał Kępień 275c9d455a Set up release notes for BIND 9.11.24 2020-09-16 23:04:54 +02:00
Michał Kępień 6d2beebe6b Bump BIND_BASELINE_VERSION for ABI checks 2020-09-16 23:04:54 +02:00
Tinderbox UserandMichał Kępień 0c92bf6709 Merge branch 'prep-release' into v9_11_23-release 2020-09-16 23:00:15 +02:00
Michał Kępień bb06974f12 Merge branch 'michal/prepare-release-notes-for-bind-9.11.23' into 'v9_11_23-release'
Prepare release notes for BIND 9.11.23

See merge request isc-private/bind9!210
2020-09-16 23:00:15 +02:00
Tinderbox UserandMichał Kępień e7b0d5de15 prep 9.11.23 2020-09-16 23:00:15 +02:00
Michał Kępień 8b4bf85174 Prepare release notes for BIND 9.11.23 2020-09-16 23:00:14 +02:00
Michał Kępień ace52781c3 Add release note for OSS-Fuzz fixes 2020-09-16 23:00:14 +02:00
Michał Kępień 5a90248e6d Add release note for GL #2074 2020-09-16 23:00:14 +02:00
Michał Kępień c3e210aefe Tweak and reword recent CHANGES entries 2020-09-16 23:00:14 +02:00
Michal NowakandMichał Kępień c17dec6f75 Miscellaneous formatting and wording tweaks 2020-09-16 23:00:14 +02:00
Mark Andrews 88a22db66e Merge branch 'marka-tsan-unit-no-ignore-error-v9_11' into 'v9_11'
tsan unit no ignore error v9_11

See merge request isc-projects/bind9!4128
2020-09-16 03:56:47 +00:00
Mark Andrews c82648bb9e remove 'allow_failure: true' from unit tsan tests 2020-09-16 13:29:00 +10:00
Mark Andrews 08286be36b Merge branch 'marka-unit-test-failure-rbt_test.c' into 'v9_11'
The runtime of rbt_test can exceed 5 minutes when running under TSAN testing.

See merge request isc-projects/bind9!4117
2020-09-15 02:42:19 +00:00
Mark Andrews f30ec018f9 The runtime of rbt_test can exceed 5 minutes when running under TSAN testing.
Limit rbt_insert_and_remove subtest runtime to ~180 seconds which gives a total
runtime of ~270 seconds.
2020-09-15 02:15:27 +00:00
Evan Hunt d318bc2922 Merge branch 'each-copyright-header-v9_11' into 'v9_11'
copyright header typos

See merge request isc-projects/bind9!4121
2020-09-15 00:09:39 +00:00
Evan Hunt 400171aee8 update all copyright headers to eliminate the typo 2020-09-14 17:00:40 -07:00
Evan Hunt e353109f2c fix a typo in copyright headers, and change "http" to "https"
(cherry picked from commit 481a7aae44)
2020-09-14 16:52:34 -07:00
Mark Andrews 5a761a2500 Merge branch '2119-the-runtime-system-tests-interfered-with-each-other-v9_11' into 'v9_11'
Resolve "The runtime system tests interfered with each other"

See merge request isc-projects/bind9!4111
2020-09-10 11:05:28 +00:00
Mark Andrews e5ecb7f57d Wait for test instance of named to exit before completing subtest.
(cherry picked from commit dda5b7b0b8)
2020-09-10 20:41:00 +10:00
Mark Andrews 6dcdee08e9 Don't use production address (127.0.0.1) in runtime system test.
(cherry picked from commit 1f14705938)
2020-09-10 20:21:03 +10:00
Mark Andrews 53995492f1 Merge branch '2116-views-system-test-was-not-waiting-for-example-to-finish-loading-v9_11' into 'v9_11'
Also wait for 'zone_dump: zone example/IN: enter'

See merge request isc-projects/bind9!4109
2020-09-10 09:57:58 +00:00
Mark Andrews dc30a355bd Also wait for 'zone_dump: zone example/IN: enter'
use nextpartpeek as we don't want to reset the starting point

(cherry picked from commit 7b65bea6d2)
2020-09-10 18:48:52 +10:00
Mark Andrews 1c485645f4 Merge branch '2114-cid-306652-null-pointer-dereferences-reverse_inull-v9_11' into 'v9_11'
Silence REVERSE_INULL warning (CID 306652)

See merge request isc-projects/bind9!4107
2020-09-09 22:20:23 +00:00
Mark Andrews 87e8497b6a Silence REVERSE_INULL warning (CID 306652)
(cherry picked from commit 584dbffab1)
2020-09-10 07:57:20 +10:00
Mark Andrews b3dc93c819 Merge branch '2128-coverity-missing-lock-warning-9-11' into 'v9_11'
Resolve "Coverity missing lock warning 9.11"

See merge request isc-projects/bind9!4095
2020-09-09 21:26:25 +00:00
Mark Andrews 1d0c1e62b4 Silence Coverity missing lock warning.
Lock access to 'done' during initialisation in manytasks().
2020-09-09 21:02:51 +00:00
Mark Andrews 3501a8334b Merge branch 'marka-use-ns_g_server-recursionquota' into 'v9_11'
Use ns_g_server->recursionquota instead of client->recursionquota

See merge request isc-projects/bind9!4102
2020-09-09 06:17:22 +00:00
Mark Andrews ed0cb2e9e4 Use ns_g_server->recursionquota instead of client->recursionquota
as the later will be NULL on ISC_R_QUOTA.

*** CID 306732:  Null pointer dereferences  (FORWARD_NULL)
/bin/named/query.c: 4359 in query_recurse()
4353     			static _Atomic(isc_stdtime_t) last = 0;
4354     #else
4355     			static isc_stdtime_t last = 0;
4356     #endif
4357     			isc_stdtime_t now;
4358     			isc_stdtime_get(&now);
   CID 306732:  Null pointer dereferences  (FORWARD_NULL)
   Passing "client" to "log_quota", which dereferences null "client->recursionquota".
4359     			log_quota(client, &last, now,
4360     				  "no more recursive clients (%d/%d/%d): %s",
4361     				  isc_result_totext(result));
4362     			ns_client_killoldestquery(client);
4363     		}
4364     		if (result == ISC_R_SUCCESS && !client->mortal &&

** CID 306731:  Program hangs  (LOCK)
/lib/dns/resolver.c: 8943 in spillattimer_countdown()
2020-09-09 06:01:54 +00:00
Mark Andrews 1e1ecce605 Merge branch 'marka-lock-should-be-unlock' into 'v9_11'
LOCK should be UNLOCK

See merge request isc-projects/bind9!4101
2020-09-09 06:01:28 +00:00
Mark Andrews e075ae082c LOCK should be UNLOCK
*** CID 306731:  Program hangs  (LOCK)
/lib/dns/resolver.c: 8943 in spillattimer_countdown()
8937     		result = isc_timer_reset(res->spillattimer,
8938     					 isc_timertype_inactive, NULL,
8939     					 NULL, true);
8940     		RUNTIME_CHECK(result == ISC_R_SUCCESS);
8941     	}
8942     	count = res->spillat;
   CID 306731:  Program hangs  (LOCK)
   "pthread_mutex_lock" locks "res->spill_lock" while it is locked.
8943     	LOCK(&res->spill_lock);
8944     	UNLOCK(&res->lock);
8945     	if (logit)
8946     		isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
8947     			      DNS_LOGMODULE_RESOLVER, ISC_LOG_NOTICE,
8948     			      "clients-per-query decreased to %u", count);
2020-09-09 15:28:57 +10:00
Mark Andrews 549dfecb5e Merge branch '2090-v9_11-dig-tsan-error' into 'v9_11'
Resolve "v9_11 dig tsan error"

See merge request isc-projects/bind9!3997
2020-09-09 03:38:41 +00:00
Mark Andrews 90185b225f Update 'init_count' atomically to silence tsan errors. 2020-09-08 17:41:33 +10:00
Mark Andrews a1dcb73f67 The node lock was released too early.
NEGATIVE needs to be call with the node lock held.

WARNING: ThreadSanitizer: data race
  Write of size 2 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 mark_stale_header lib/dns/rbtdb.c:1802:21
    #1 add32 lib/dns/rbtdb.c:6559:5
    #2 addrdataset lib/dns/rbtdb.c:6975:12
    #3 dns_db_addrdataset lib/dns/db.c:783:10
    #4 cache_name lib/dns/resolver.c:5829:13
    #5 cache_message lib/dns/resolver.c:5926:14
    #6 resquery_response lib/dns/resolver.c:8618:12
    #7 dispatch lib/isc/task.c:1157:7
    #8 run lib/isc/task.c:1331:2

  Previous read of size 2 at 0x000000000001 by thread T2:
    #0 cache_findrdataset lib/dns/rbtdb.c:5932:6
    #1 dns_db_findrdataset lib/dns/db.c:739:10
    #2 query_addadditional2 bin/named/query.c:2196:11
    #3 additionaldata_ns lib/dns/./rdata/generic/ns_2.c:198:10
    #4 dns_rdata_additionaldata lib/dns/rdata.c:1246:2
    #5 dns_rdataset_additionaldata lib/dns/rdataset.c:629:12
    #6 query_addrdataset bin/named/query.c:2411:8
    #7 query_addrrset bin/named/query.c:2802:2
    #8 query_addbestns bin/named/query.c:3501:2
    #9 query_find bin/named/query.c:9165:4
    #10 query_resume bin/named/query.c:4164:12
    #11 dispatch lib/isc/task.c:1157:7
    #12 run lib/isc/task.c:1331:2
2020-09-08 17:41:33 +10:00
Mark Andrews 1f7a4f9ab2 Turn off TSAN for isc_log_wouldlog 2020-09-08 17:41:33 +10:00
Mark Andrews 8f88bc61e9 Lock zone to read DNS_ZONEFLG_DIALREFRESH 2020-09-08 17:41:33 +10:00
Mark Andrews 7db778854e Use a reference counter for zt
WARNING: ThreadSanitizer: data race
  Write of size 8 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 memset <null>
    #1 mem_put lib/isc/mem.c:819
    #2 isc___mem_free lib/isc/mem.c:1662
    #3 isc__mem_free lib/isc/mem.c:3078
    #4 isc___mem_putanddetach lib/isc/mem.c:1221
    #5 isc__mem_putanddetach lib/isc/mem.c:3033
    #6 zt_destroy lib/dns/zt.c:214
    #7 doneloading lib/dns/zt.c:591
    #8 zone_asyncload lib/dns/zone.c:2243
    #9 dispatch lib/isc/task.c:1157
    #10 run lib/isc/task.c:1331
    #11 <null> <null>

  Previous atomic read of size 8 at 0x000000000001 by thread T2:
    #0 __tsan_atomic64_load <null>
    #1 isc_rwlock_unlock lib/isc/rwlock.c:612
    #2 doneloading lib/dns/zt.c:585
    #3 zone_asyncload lib/dns/zone.c:2243
    #4 dispatch lib/isc/task.c:1157
    #5 run lib/isc/task.c:1331
    #6 <null> <null>

  Location is heap block of size 273 at 0x000000000015 allocated by thread T3:
    #0 malloc <null>
    #1 internal_memalloc lib/isc/mem.c:887
    #2 mem_get lib/isc/mem.c:792
    #3 mem_allocateunlocked lib/isc/mem.c:1545
    #4 isc___mem_allocate lib/isc/mem.c:1566
    #5 isc__mem_allocate lib/isc/mem.c:3048
    #6 isc___mem_get lib/isc/mem.c:1304
    #7 isc__mem_get lib/isc/mem.c:3012
    #8 dns_zt_create lib/dns/zt.c:85
    #9 dns_view_create lib/dns/view.c:126
    #10 create_view server.c:5312
    #11 load_configuration server.c:8101
    #12 loadconfig server.c:9428
    #13 ns_server_reconfigcommand server.c:9763
    #14 ns_control_docommand bin/named/control.c:243
    #15 control_recvmessage bin/named/controlconf.c:465
    #16 dispatch lib/isc/task.c:1157
    #17 run lib/isc/task.c:1331
    #18 <null> <null>
2020-09-08 17:41:33 +10:00