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

Merge branch '4132-catz-data-race-in-db.c' into 'main'

Fix a data race between the dns_zone and dns_catz modules

Closes #4132

See merge request isc-projects/bind9!8031
This commit is contained in:
Arаm Sаrgsyаn 2023-06-15 09:50:15 +00:00
commit 14d4bf9136
4 changed files with 47 additions and 4 deletions

View File

@ -1,3 +1,8 @@
6197. [bug] Fix a data race between the dns_zone and dns_catz
modules when registering/unregistering a database
update notification callback for a catalog zone.
[GL #4132]
6196. [cleanup] Report "permission denied" instead of "unexpected error"
when trying to update a zone file on a read-only file
system. Thanks to Midnight Veil. [GL #4134]

View File

@ -2191,6 +2191,26 @@ cleanup:
return (result);
}
void
dns_catz_dbupdate_unregister(dns_db_t *db, dns_catz_zones_t *catzs) {
REQUIRE(DNS_DB_VALID(db));
REQUIRE(DNS_CATZ_ZONES_VALID(catzs));
LOCK(&catzs->lock);
dns_db_updatenotify_unregister(db, dns_catz_dbupdate_callback, catzs);
UNLOCK(&catzs->lock);
}
void
dns_catz_dbupdate_register(dns_db_t *db, dns_catz_zones_t *catzs) {
REQUIRE(DNS_DB_VALID(db));
REQUIRE(DNS_CATZ_ZONES_VALID(catzs));
LOCK(&catzs->lock);
dns_db_updatenotify_register(db, dns_catz_dbupdate_callback, catzs);
UNLOCK(&catzs->lock);
}
static bool
catz_rdatatype_is_processable(const dns_rdatatype_t type) {
return (!dns_rdatatype_isdnssec(type) && type != dns_rdatatype_cds &&

View File

@ -354,6 +354,26 @@ dns_catz_dbupdate_callback(dns_db_t *db, void *fn_arg);
* \li 'fn_arg' is not NULL (casted to dns_catz_zones_t*).
*/
void
dns_catz_dbupdate_unregister(dns_db_t *db, dns_catz_zones_t *catzs);
/*%<
* Register the catalog zone database update notify callback.
*
* Requires:
* \li 'db' is a valid database.
* \li 'catzs' is valid.
*/
void
dns_catz_dbupdate_register(dns_db_t *db, dns_catz_zones_t *catzs);
/*%<
* Unregister the catalog zone database update notify callback.
*
* Requires:
* \li 'db' is a valid database.
* \li 'catzs' is valid.
*/
void
dns_catz_prereconfig(dns_catz_zones_t *catzs);
/*%<

View File

@ -1939,8 +1939,7 @@ dns_zone_catz_enable_db(dns_zone_t *zone, dns_db_t *db) {
REQUIRE(db != NULL);
if (zone->catzs != NULL) {
dns_db_updatenotify_register(db, dns_catz_dbupdate_callback,
zone->catzs);
dns_catz_dbupdate_register(db, zone->catzs);
}
}
@ -1950,8 +1949,7 @@ dns_zone_catz_disable_db(dns_zone_t *zone, dns_db_t *db) {
REQUIRE(db != NULL);
if (zone->catzs != NULL) {
dns_db_updatenotify_unregister(db, dns_catz_dbupdate_callback,
zone->catzs);
dns_catz_dbupdate_unregister(db, zone->catzs);
}
}