Resolve "ThreadSanitizer: data race lib/dns/rbtdb.c:1365 in newversion"

Arаm Sаrgsyаn requested to merge 3907-data-race-in-rbtdb into main

This MR reverts the ed268b46 commit from the !7431 (merged) merge request, and fixes the TSAN issue uncovered by the !7431 (merged)'s test case alternatively, by using two pairs of dns_db_t and dns_dbversion_t in a catalog zone. Doing that should avoid a race between the dns__catz_update_cb() and dns_catz_dbupdate_callback() functions.

Also for the same reason, since in main and v9_18 the update process now runs without the catzs->lock lock (see #3881 (closed)), protect catz->db_registered access/modification and dns_db_updatenotify_register()/dns_db_updatenotify_unregister() calls with catzs->lock. This change won't be backported to v9_16, as the code there is already protected by the lock.

The CHANGES entry for #3777 (closed) was edited to remove the change describing the reverted commit. The CHANGES entry was never part of a released BIND 9 version.

Closes #3907 (closed)

Edited by Arаm Sаrgsyаn

Merge request reports