Commit Graph
28968 Commits
Author SHA1 Message Date
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
Mark Andrews 7e44ba1d4a make all artifacts visible 2020-09-08 17:41:33 +10:00
Mark Andrews d6c727d669 ISC_QUEUE_POP is not tsan safe. Suppress warnings
ret->link.next is tested to see if it is NULL unlocked
to avoid obtaining taillock when it is not nexessary then
retested once the taillock is obtained.
2020-09-08 17:41:33 +10:00
Mark Andrews 6d9b1ed70c Address data race over query_recurse.last
WARNING: ThreadSanitizer: data race
  Read of size 4 at 0x000000000001 by thread T1:
    #0 query_recurse bin/named/query.c:4291:15
    #1 query_find bin/named/query.c
    #2 ns_query_start bin/named/query.c:9675:8
    #3 client_request bin/named/client.c:3133:3
    #4 dispatch lib/isc/task.c:1157:7
    #5 run lib/isc/task.c:1331:2

  Previous write of size 4 at 0x000000000001 by thread T2:
    #0 query_recurse bin/named/query.c:4292:10
    #1 query_find bin/named/query.c
    #2 ns_query_start bin/named/query.c:9675:8
    #3 client_request bin/named/client.c:3133:3
    #4 dispatch lib/isc/task.c:1157:7
    #5 run lib/isc/task.c:1331:2

  Location is global 'query_recurse.last' of size 4 at 0x000000000001
2020-09-08 09:25:43 +10:00
Mark Andrews 72cbe648c4 Test if linked while holding the queue lock
WARNING: ThreadSanitizer: data race
  Read of size 8 at 0x000000000001 by thread T1:
    #0 client_shutdown bin/named/client.c:849:6
    #1 dispatch lib/isc/task.c:1157:7
    #2 run lib/isc/task.c:1331:2

  Previous write of size 8 at 0x000000000001 by thread T2 (mutexes: write M1, write M2):
    #0 client_shutdown bin/named/client.c:850:3
    #1 dispatch lib/isc/task.c:1157:7
    #2 run lib/isc/task.c:1331:2
2020-09-08 09:25:43 +10:00
Mark Andrews 7da21a6ff3 Lock zone before reading DNS_ZONEFLG_REFRESH 2020-09-08 09:25:43 +10:00
Mark Andrews be4ed41611 Obtain a lock on the quota structure.
WARNING: ThreadSanitizer: data race (pid=15228)
  Read of size 4 at 0x7b5c00000444 by thread T8:
    #0 ns_server_status /builds/isc-projects/bind9/bin/named/./server.c:10935:31 (named+0x514671)
    #1 ns_control_docommand /builds/isc-projects/bind9/bin/named/control.c:263:12 (named+0x4e4726)
    #2 control_recvmessage /builds/isc-projects/bind9/bin/named/controlconf.c:465:13 (named+0x4e9046)
    #3 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
    #4 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)

  Previous write of size 4 at 0x7b5c00000444 by thread T9 (mutexes: write M1082):
    #0 isc_quota_release /builds/isc-projects/bind9/lib/isc/quota.c:73:13 (libisc.so.1107+0x3bf10)
    #1 isc_quota_detach /builds/isc-projects/bind9/lib/isc/quota.c:111:2 (libisc.so.1107+0x3c12b)
    #2 ns_client_endrequest /builds/isc-projects/bind9/bin/named/client.c:896:3 (named+0x4dcad1)
    #3 exit_check /builds/isc-projects/bind9/bin/named/client.c:512:3 (named+0x4d570d)
    #4 ns_client_detach /builds/isc-projects/bind9/bin/named/client.c:3687:8 (named+0x4d7732)
    #5 query_find /builds/isc-projects/bind9/bin/named/query.c (named+0x4f8ff1)
    #6 query_resume /builds/isc-projects/bind9/bin/named/query.c:4164:12 (named+0x509b38)
    #7 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
    #8 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)
2020-09-08 09:25:43 +10:00
Mark Andrews 9e8e886fd6 Don't grab all the adb locks at once
FATAL: ThreadSanitizer CHECK failed: /build/llvm-toolchain-10-10.0.1~++20200708124224+ef32c611aa2/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h:67 "((n_all_locks_)) < (((sizeof(all_locks_with_contexts_)/sizeof((all_locks_with_contexts_)[0]))))" (0x40, 0x40)
    #0 __tsan::TsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) <null> (named+0x4ad775)
    #1 __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) <null> (named+0x4c429f)
    #2 __sanitizer::DeadlockDetectorTLS<__sanitizer::TwoLevelBitVector<1ul, __sanitizer::BasicBitVector<unsigned long> > >::addLock(unsigned long, unsigned long, unsigned int) <null> (named+0x4b8a3c)
    #3 __sanitizer::DD::MutexAfterLock(__sanitizer::DDCallback*, __sanitizer::DDMutex*, bool, bool) <null> (named+0x4b7fae)
    #4 __tsan::MutexPostLock(__tsan::ThreadState*, unsigned long, unsigned long, unsigned int, int) <null> (named+0x4abc58)
    #5 pthread_mutex_lock <null> (named+0x4643a8)
    #6 dump_adb /builds/isc-projects/bind9/lib/dns/adb.c:3461:3 (libdns.so.1110+0x48be6)
    #7 dns_adb_dump /builds/isc-projects/bind9/lib/dns/adb.c:3434:2 (libdns.so.1110+0x48738)
    #8 dumpdone /builds/isc-projects/bind9/bin/named/./server.c:10149:4 (named+0x512022)
    #9 dump_quantum /builds/isc-projects/bind9/lib/dns/masterdump.c:1424:2 (libdns.so.1110+0x9f253)
    #10 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
    #11 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)
    #12 __tsan_thread_start_func <null> (named+0x446e3c)
    #13 start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486:8 (libpthread.so.0+0x7fa2)
    #14 clone /build/glibc-vjB4T1/glibc-2.28/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (libc.so.6+0xf94ce)
2020-09-08 09:25:43 +10:00
Mark Andrews 56ab2fc457 Lock access to state_mctx
WARNING: ThreadSanitizer: data race
  Read of size 4 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 isc___mem_allocate lib/isc/mem.c:1565:2
    #1 isc__mem_allocate lib/isc/mem.c:3048:11
    #2 isc___mem_get lib/isc/mem.c:1304:11
    #3 isc__mem_get lib/isc/mem.c:3012:11
    #4 set_state lib/dns/geoip2.c:174:29
    #5 get_entry_for lib/dns/geoip2.c:236:11
    #6 dns_geoip_match lib/dns/geoip2.c:383:10
    #7 dns_aclelement_match2 lib/dns/acl.c:493:11
    #8 dns_acl_match2 lib/dns/acl.c:298:7
    #9 allowed bin/named/client.c:1866:11
    #10 ns_client_isself bin/named/client.c:1931:7
    #11 notify_isself lib/dns/zone.c:11025:11
    #12 notify_send lib/dns/zone.c:11344:7
    #13 notify_find_address lib/dns/zone.c:11148:2
    #14 zone_notify lib/dns/zone.c:11586:3
    #15 zone_maintenance lib/dns/zone.c:10261:4
    #16 zone_timer lib/dns/zone.c:13106:2
    #17 dispatch lib/isc/task.c:1157:7
    #18 run lib/isc/task.c:1331:2

  Previous write of size 8 at 0x000000000001 by thread T2 (mutexes: write M2, write M3):
    #0 malloc <null>
    #1 internal_memalloc lib/isc/mem.c:887:8
    #2 isc_mem_createx2 lib/isc/mem.c:956:8
    #3 isc_mem_create lib/isc/mem.c:2793:11
    #4 state_key_init lib/dns/geoip2.c:119:14
    #5 get_entry_for lib/dns/geoip2.c:214:11
    #6 dns_geoip_match lib/dns/geoip2.c:383:10
    #7 dns_aclelement_match2 lib/dns/acl.c:493:11
    #8 dns_acl_match2 lib/dns/acl.c:298:7
    #9 allowed bin/named/client.c:1866:11
    #10 ns_client_isself bin/named/client.c:1931:7
    #11 notify_isself lib/dns/zone.c:11025:11
    #12 notify_send lib/dns/zone.c:11344:7
    #13 notify_find_address lib/dns/zone.c:11148:2
    #14 zone_notify lib/dns/zone.c:11586:3
    #15 zone_maintenance lib/dns/zone.c:10261:4
    #16 zone_timer lib/dns/zone.c:13106:2
    #17 dispatch lib/isc/task.c:1157:7
    #18 run lib/isc/task.c:1331:2
2020-09-08 09:25:43 +10:00