bind9/lib/dns/include/dns
Aram Sargsyan ee6e7e6d00 Lock the catalog zone when reconfiguring it
A catalog zone is updated in an offloaded thread, which is not
stopped during a reconfiguration in an exclusive mode, and so
can cause a race condition with it.

Waiting for the offloaded threads to complete their work before
entering into the exclusive mode can potentially cause unwanted
delays, because offloaded threads are generally "allowed" to take
a longer amount of time before they complete.

Add a dns_catz_zone_prereconfig()/dns_catz_zone_postreconfig() pair
of functions which currently just lock the catalog zone when
reconfiguring it. The change should eliminate the race.

As a side note, there was already a similar pair of functions,
dns_catz_prereconfig() and dns_catz_postreconfig() which are called
before and after reconfiguring a 'dns_catz_zones_t' object.

Below are the stack traces of the reconfiguration thread which has
asserted, and a catalog zone update thread which was caught in the
middle of its work despite the fact that the exclusive mode is
turned on.

                Stack trace of thread 23859:
                #0  0x00007f80e7b8e52f raise (libc.so.6)
                #1  0x00007f80e7b61e65 abort (libc.so.6)
                #2  0x0000000000422558 assertion_failed (named)
                #3  0x00007f80eaa6799e isc_assertion_failed (libisc-9.18.41.so)
                #4  0x00007f80ea5bc788 dns_catz_entry_getname (libdns-9.18.41.so)
                #5  0x000000000042ce0e catz_reconfigure (named)
                #6  0x000000000042d3c5 configure_catz_zone (named)
                #7  0x000000000042d7a4 configure_catz (named)
                #8  0x0000000000430645 configure_view (named)
                #9  0x000000000043d998 load_configuration (named)
                #10 0x000000000044184f loadconfig (named)
                #11 0x0000000000442525 named_server_reconfigcommand (named)
                #12 0x000000000041b277 named_control_docommand (named)
                #13 0x000000000041c74a control_command (named)
                #14 0x00007f80eaa912ae task_run (libisc-9.18.41.so)
                #15 0x00007f80eaa914cd isc_task_run (libisc-9.18.41.so)
                #16 0x00007f80eaa46435 isc__nm_async_task (libisc-9.18.41.so)
                #17 0x00007f80eaa467aa process_netievent (libisc-9.18.41.so)
                #18 0x00007f80eaa475a6 process_queue (libisc-9.18.41.so)
                #19 0x00007f80eaa46227 process_all_queues (libisc-9.18.41.so)
                #20 0x00007f80eaa462a1 async_cb (libisc-9.18.41.so)
                #21 0x00007f80e8d01893 uv__async_io.part.3 (libuv.so.1)
                #22 0x00007f80e8d13ac4 uv__io_poll (libuv.so.1)
                #23 0x00007f80e8d023fb uv_run (libuv.so.1)
                #24 0x00007f80eaa45ced nm_thread (libisc-9.18.41.so)
                #25 0x00007f80eaa9bda3 isc__trampoline_run (libisc-9.18.41.so)
                #26 0x00007f80e7f1e1ca start_thread (libpthread.so.0)
                #27 0x00007f80e7b798d3 __clone (libc.so.6)
    ...
    ...
                Stack trace of thread 23912:
                #0  0x00007f80ea5bc2da dns_catz_options_setdefault (libdns-9.18.41.so)
                #1  0x00007f80ea5bd411 dns__catz_zones_merge (libdns-9.18.41.so)
                #2  0x00007f80ea5c3c2f dns__catz_update_cb (libdns-9.18.41.so)
                #3  0x00007f80eaa4fee9 isc__nm_work_run (libisc-9.18.41.so)
                #4  0x00007f80eaa9bda3 isc__trampoline_run (libisc-9.18.41.so)
                #5  0x00007f80eaa4ff48 isc__nm_work_cb (libisc-9.18.41.so)
                #6  0x00007f80e8cfc75e worker (libuv.so.1)
                #7  0x00007f80e7f1e1ca start_thread (libpthread.so.0)
                #8  0x00007f80e7b798d3 __clone (libc.so.6)

(cherry picked from commit aed9cafd5c)
2025-12-17 17:48:28 +00:00
..
acl.h Convert rwlock in dns_acl to RCU 2023-10-13 14:44:40 +02:00
adb.h Detect resolution loops between fetches 2025-11-28 09:32:53 +01:00
badcache.h Improve the badcache cleaning by adding LRU and using RCU 2024-11-27 17:07:03 +00:00
bit.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
byaddr.h remove isc_task completely 2023-02-16 18:35:32 +01:00
cache.h Add a limit to the number of RR types for single name 2024-06-10 16:55:09 +02:00
callbacks.h add setup/commit functions to rdatacallbacks 2024-03-08 15:36:56 -08:00
catz.h Lock the catalog zone when reconfiguring it 2025-12-17 17:48:28 +00:00
cert.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
client.h Add +maxtotalqueries option to delv 2024-12-06 06:20:33 +00:00
clientinfo.h Move contributed DLZ modules into a separate repository 2024-11-26 16:24:17 +01:00
compress.h Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
db.h Fix missing RRSIGs for "glue" lookups with CD=1 2025-09-10 17:08:52 +10:00
dbiterator.h Implement dns_dbiterator_seek3 2025-12-11 13:53:25 +01:00
diff.h Incrementally apply AXFR transfer 2024-11-26 07:17:06 +00:00
dispatch.h Fix TCP dispatches and transport 2024-10-24 01:21:37 +00:00
dlz.h Update clang to version 14 2022-06-16 17:21:11 +02:00
dlz_dlopen.h Update clang to version 14 2022-06-16 17:21:11 +02:00
dns64.h Add the ability to use DNS64 internally 2023-09-13 14:31:43 +10:00
dnsrps.h Give the rdataset->privateN fields more helpful names 2023-07-17 14:50:25 +02:00
dnssec.h Fix dnssec-keygen key collision checking for KEY rrtype keys 2025-10-22 12:55:41 +11:00
dnstap.h Emit and read correct DoT and DoH dnstap entries 2024-04-26 16:12:29 +03:00
ds.h Warn about deprecated DNSKEY and DS algorithms / digest types 2025-07-16 01:39:58 +10:00
dsdigest.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
dsync.h Add support for parsing DSYNC scheme mnemonics 2025-08-06 13:13:34 +10:00
dyndb.h remove isc_task completely 2023-02-16 18:35:32 +01:00
ecs.h Move contributed DLZ modules into a separate repository 2024-11-26 16:24:17 +01:00
ede.h detect dup EDE with bitmap and store next pos 2025-01-30 12:37:55 +00:00
edns.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
fixedname.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
forward.h reduce memory consumption of the remaining QP databases 2024-03-14 10:25:07 -07:00
geoip.h Update clang to version 14 2022-06-16 17:21:11 +02:00
ipkeylist.h remove nonfunctional DSCP implementation 2023-01-09 12:15:21 -08:00
iptable.h Convert manual dns_iptable_{attach,detach} to ISC_REFCOUNT_IMPL 2023-10-13 14:44:40 +02:00
journal.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
kasp.h Implement named-checkconf -k (check keys) 2025-09-29 15:13:26 +02:00
keydata.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
keyflags.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
keymgr.h Implement named-checkconf -k (check keys) 2025-09-29 15:13:26 +02:00
keystore.h Replace keystore attach/detach with ISC_REFCOUNT_IMPL/ISC_REFCOUNT_DECL 2024-01-25 15:37:40 +01:00
keytable.h Reformat sources with up-to-date clang-format-17 2023-11-13 16:52:35 +01:00
keyvalues.h Tidy up keyvalue.h definitions 2025-03-25 06:40:49 +00:00
librpz.h Use clang-format-21 to update formatting 2025-10-21 12:12:01 +02:00
log.h remove {root-}delegation-only 2023-03-23 12:57:01 -07:00
master.h Fix a typo in dns/master.h 2025-01-08 15:21:28 +00:00
masterdump.h remove unused functions in dns_master 2023-12-06 17:31:38 -08:00
message.h Retry lookups with unsigned DNAME over TCP 2025-10-02 12:58:54 +02:00
name.h Optimize memory layout of core structs 2024-12-09 09:04:28 +01:00
nametree.h Don't undef <unit>_TRACE, instead add comment how to enable it 2023-10-13 11:40:16 +02:00
ncache.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
nsec.h Wait with NSEC3 during a DNSSEC policy change 2022-08-22 15:55:46 +02:00
nsec3.h Lower the maximum allowed NSEC3 iterations to 50 2023-12-05 14:58:58 +00:00
nta.h Don't undef <unit>_TRACE, instead add comment how to enable it 2023-10-13 11:40:16 +02:00
opcode.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
order.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
peer.h remove nonfunctional DSCP implementation 2023-01-09 12:15:21 -08:00
private.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
qp.h Adaptive memory allocation strategy for qp-tries 2025-08-05 12:48:19 +02:00
rbt.h Reduce lock contention during RBTDB tree pruning 2024-02-29 11:23:03 +01:00
rcode.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdata.h Optimize memory layout of core structs 2024-12-09 09:04:28 +01:00
rdataclass.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rdatalist.h Implement dns_db node tracing 2023-02-28 11:44:15 +01:00
rdataset.h Remove dns_rdataset_equals as unneeded 2025-09-10 17:09:14 +10:00
rdatasetiter.h Reformat sources with up-to-date clang-format-17 2023-11-13 16:52:35 +01:00
rdataslab.h Preserve brackets in DNS_SLABHEADER_GETATTR macro 2025-06-25 13:26:13 +10:00
rdatatype.h separate generic DB helpers into db_p.h 2024-02-14 09:00:27 +01:00
remote.h remove nonfunctional DSCP implementation 2023-01-09 12:15:21 -08:00
request.h Don't undef <unit>_TRACE, instead add comment how to enable it 2023-10-13 11:40:16 +02:00
resolver.h Detect resolution loops between fetches 2025-11-28 09:32:53 +01:00
result.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rootns.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
rpz.h Implement '-T slowrpz' named testing option 2025-08-27 10:00:45 +00:00
rriterator.h Update clang to version 14 2022-06-16 17:21:11 +02:00
rrl.h Use clang-format-21 to update formatting 2025-10-21 12:12:01 +02:00
sdlz.h Update clang to version 14 2022-06-16 17:21:11 +02:00
secalg.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
secproto.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
skr.h Use archived version of draft-icann-dnssec-keymgmt-01.txt 2025-01-28 13:41:05 +00:00
soa.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
ssu.h Add isc_rwlock around dns_aclenv .localhost and .localnets member 2022-04-04 19:27:00 +02:00
stats.h Update the source code formatting using clang-format-17 2023-10-17 17:47:46 +02:00
time.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
tkey.h Obsolete the "tkey-domain" statement 2025-09-01 22:34:08 +02:00
trace.h Replace __attribute__((unused)) with ISC_ATTR_UNUSED attribute macro 2023-03-30 23:29:25 +02:00
transport.h Integrate TLS cipher suites support into BIND 2024-01-12 13:27:59 +02:00
tsig.h Prevent assertion when processing TSIG algorithm 2025-05-07 13:45:48 +02:00
ttl.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
types.h Add support for parsing DSYNC scheme mnemonics 2025-08-06 13:13:34 +10:00
update.h Reformat sources with up-to-date clang-format-17 2023-11-13 16:52:35 +01:00
validator.h Detect resolution loops between fetches 2025-11-28 09:32:53 +01:00
view.h Implement sig0key-checks-limit and sig0message-checks-limit 2025-02-20 14:48:01 +00:00
xfrin.h Expose the incoming transfers' rates in the statistics channel 2025-02-20 11:05:09 +00:00
zone.h Force full sign to generate new signatures 2025-09-26 14:18:57 +02:00
zonekey.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
zoneverify.h Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
zt.h The zone table no longer depends on the loop manager 2023-05-12 20:48:31 +01:00