]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Lock the address entry bucket when dumping ADB namehook
authorEvan Hunt <each@isc.org>
Thu, 11 Aug 2022 22:06:34 +0000 (15:06 -0700)
committerEvan Hunt <each@isc.org>
Fri, 12 Aug 2022 21:47:50 +0000 (14:47 -0700)
When dumping an ADB address entry associated with a name,
the name bucket lock was held, but the entry bucket lock was
not; this could cause data races when other threads were updating
address entry info. (These races are probably not operationally
harmful, but they triggered TSAN error reports.)

lib/dns/adb.c

index 3ff149a77404ebae68077f0bd18862a04e7bf625..bca098f016e27ed4c1bc39d92bcfa7b43c39c83d 100644 (file)
@@ -2946,7 +2946,9 @@ print_namehook_list(FILE *f, const char *legend, dns_adb_t *adb,
                if (debug) {
                        fprintf(f, ";\tHook(%s) %p\n", legend, nh);
                }
+               LOCK(&nh->entry->bucket->lock);
                dump_entry(f, adb, nh->entry, debug, now);
+               UNLOCK(&nh->entry->bucket->lock);
        }
 }