81 lines
2.9 KiB
Diff
81 lines
2.9 KiB
Diff
From 215526caf4b32968cf407351fe48aed3bb2747e8 Mon Sep 17 00:00:00 2001
|
|
From: Mark Andrews <marka@isc.org>
|
|
Date: Fri, 4 Sep 2020 16:40:51 +1000
|
|
Subject: [PATCH] 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 fbed96220486a063aafdd0a6ada8adce972fd48f)
|
|
Conflict: NA
|
|
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/215526caf4b32968cf407351fe48aed3bb2747e8
|
|
---
|
|
lib/dns/zone.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
diff --git a/lib/dns/zone.c b/lib/dns/zone.c
|
|
index b024034e63..25ed062994 100644
|
|
--- a/lib/dns/zone.c
|
|
+++ b/lib/dns/zone.c
|
|
@@ -7939,6 +7939,8 @@ zone_nsec3chain(dns_zone_t *zone) {
|
|
first = true;
|
|
buildnsecchain = false;
|
|
while (nsec3chain != NULL && nodes-- > 0 && signatures > 0) {
|
|
+ dns_dbiterator_pause(nsec3chain->dbiterator);
|
|
+
|
|
LOCK_ZONE(zone);
|
|
nextnsec3chain = ISC_LIST_NEXT(nsec3chain, link);
|
|
UNLOCK_ZONE(zone);
|
|
--
|
|
2.23.0
|
|
|