2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Merge branch '3777-fix-crash-after-failed-ixfr-from-differences' into 'main'

Resolve "crash after failed ixfr-from-differences on a catalog zone"

Closes #3777

See merge request isc-projects/bind9!7431
This commit is contained in:
Arаm Sаrgsyаn
2023-02-27 11:25:00 +00:00
8 changed files with 65 additions and 9 deletions

View File

@@ -1,3 +1,8 @@
6115. [bug] Unregister db update notify callback before detaching
from the previous db inside the catz update notify
callback. Also, call the db notify callbacks only after
zone_postload() returns successfully. [GL #3777]
6114. [func] Run the catalog zone update process on the offload
threads. [GL #3881]

View File

@@ -29,6 +29,7 @@ rm -f ns2/catalog-bad*.db
rm -f ns2/named.conf.tmp
rm -f ns3/dom2.example.db ns3/dom13.example.db ns3/dom14.example.db ns3/dom17.example.db ns3/dom18.example.db
rm -f ns4/__catz__*db
rm -f ns4/catalog-self.example.db
rm -f ns[123]/catalog[1234].example.db
rm -f ns[14]/catalog-tls.example.db
rm -f nsupdate.out.*

View File

@@ -0,0 +1,14 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, you can obtain one at https://mozilla.org/MPL/2.0/.
;
; See the COPYRIGHT file distributed with this work for additional
; information regarding copyright ownership.
@ 3600 SOA . . 1 86400 3600 86400 3600
@ 3600 IN NS invalid.
version IN TXT "1"

View File

@@ -30,11 +30,15 @@ options {
notify-delay 0;
recursion no;
serial-query-rate 100;
ixfr-from-differences yes; // GL #3777
catalog-zones {
zone "catalog-tls.example"
min-update-interval 1s
default-primaries { 10.53.0.1 key tsig_key tls ephemeral; };
zone "catalog-self.example"
min-update-interval 1s
default-primaries { 10.53.0.4; };
};
};
@@ -44,6 +48,12 @@ zone "catalog-tls.example" {
primaries { 10.53.0.1 key tsig_key tls ephemeral; };
};
zone "catalog-self.example" {
type primary;
file "catalog-self.example.db";
notify explicit;
};
key tsig_key. {
secret "LSAnCU+Z";
algorithm @DEFAULT_HMAC@;

View File

@@ -25,5 +25,6 @@ cp -f ns3/catalog.example.db.in ns3/catalog2.example.db
cp -f ns1/catalog.example.db.in ns1/catalog3.example.db
cp -f ns1/catalog.example.db.in ns1/catalog4.example.db
cp -f ns1/catalog.example.db.in ns1/catalog-tls.example.db
cp -f ns4/catalog.example.db.in ns4/catalog-self.example.db
mkdir -p ns2/zonedir

View File

@@ -2605,5 +2605,23 @@ wait_for_soa @10.53.0.4 tls1.example. dig.out.test$n || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
##########################################################################
# GL #3777
nextpart ns4/named.run >/dev/null
n=$((n+1))
echo_i "Adding domain self.example. to catalog-self zone without updating the serial ($n)"
ret=0
echo "self.zones.catalog-self.example. 3600 IN PTR self.example." >> ns4/catalog-self.example.db
rndccmd 10.53.0.4 reload || ret=1
n=$((n+1))
echo_i "Issuing another rndc reload command after 1 second ($n)"
sleep 1
rndccmd 10.53.0.4 reload || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
##########################################################################
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1

View File

@@ -910,8 +910,10 @@ dns_catz_get_zone(dns_catz_zones_t *catzs, const dns_name_t *name) {
REQUIRE(DNS_CATZ_ZONES_VALID(catzs));
REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC));
LOCK(&catzs->lock);
result = isc_ht_find(catzs->zones, name->ndata, name->length,
(void **)&found);
UNLOCK(&catzs->lock);
if (result != ISC_R_SUCCESS) {
return (NULL);
}
@@ -2104,6 +2106,8 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
if (catz->dbversion != NULL) {
dns_db_closeversion(catz->db, &catz->dbversion, false);
}
dns_db_updatenotify_unregister(
catz->db, dns_catz_dbupdate_callback, catz->catzs);
dns_db_detach(&catz->db);
/*
* We're not registering db update callback, it will be

View File

@@ -17225,13 +17225,6 @@ zone_loaddone(void *arg, isc_result_t result) {
dns_zone_catz_disable_db(zone, load->db);
}
tresult = dns_db_endload(load->db, &load->callbacks);
if (tresult != ISC_R_SUCCESS &&
(result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE))
{
result = tresult;
}
/*
* Lock hierarchy: zmgr, zone, raw.
*/
@@ -17250,9 +17243,13 @@ again:
goto again;
}
}
(void)zone_postload(zone, load->db, load->loadtime, result);
tresult = zone_postload(zone, load->db, load->loadtime, result);
if (tresult != ISC_R_SUCCESS &&
(result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE))
{
result = tresult;
}
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADING);
zone_idetach(&load->callbacks.zone);
/*
* Leave the zone frozen if the reload fails.
*/
@@ -17269,6 +17266,12 @@ again:
}
UNLOCK_ZONE(zone);
(void)dns_db_endload(load->db, &load->callbacks);
LOCK_ZONE(zone);
zone_idetach(&load->callbacks.zone);
UNLOCK_ZONE(zone);
dns_db_detach(&load->db);
if (zone->loadctx != NULL) {
dns_loadctx_detach(&zone->loadctx);