mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
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
This commit is contained in:
@@ -4556,7 +4556,11 @@ sync_keyzone(dns_zone_t *zone, dns_db_t *db) {
|
||||
if (rdataset->type != dns_rdatatype_keydata) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Release db wrlock to prevent LOR reports against
|
||||
* dns_keytable_forall() call below.
|
||||
*/
|
||||
dns_rriterator_pause(&rrit);
|
||||
result = dns_keytable_find(sr, rrname, &keynode);
|
||||
if (result != ISC_R_SUCCESS || !dns_keynode_managed(keynode)) {
|
||||
CHECK(delete_keydata(db, ver, &diff, rrname, rdataset));
|
||||
|
Reference in New Issue
Block a user