2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00
Commit Graph

39533 Commits

Author SHA1 Message Date
Ondřej Surý
10279f540d Add CHANGES note for [GL #4223] 2023-07-31 15:51:15 +02:00
Ondřej Surý
c1821ccf92 Call rcu_barrier() five times in the isc__mem_destroy()
Because rcu_barrier() needs to be called as many times as the number of
nested call_rcu() calls (call_rcu() calls made from call_rcu thread),
and currently there's no mechanism to detect whether there are more
call_rcu callbacks scheduled, we simply call the rcu_barrier() multiple
times.  The overhead is negligible and it prevents rare assertion
failures caused by the check for memory leaks in isc__mem_destroy().
2023-07-31 15:51:15 +02:00
Ondřej Surý
1e3b6d2d83 Don't cleanup the dns_message_checksig fuzzer in atexit handler
After the dns_badcache refactoring, the dns_badcache_destroy() would
call call_rcu().  The dns_message_checksig cleanup which calls
dns_view_detach() happens in the atexit handler, so there might be
call_rcu threads started very late in the process.  The liburcu
registers library destructor that destroys the data structured internal
to liburcu and this clashes with the call_rcu thread that just got
started in the atexit() handler causing either (depending on timing):

 - a normal run
 - a straight segfault
 - an assertion failure from liburcu

Instead of trying to cleanup the dns_message_checksig unit, ignore the
leaked memory as we do with all the other fuzzing tests.
2023-07-31 15:51:15 +02:00
Ondřej Surý
b570750382 Make the load-names benchmark multithreaded
The load-names benchmark was originally only measuring single thread
performance of the data structures.  As this is not how those are used
in the real life, it was refactored to be multi-threaded with proper
protections in place (rwlock for ht, hashmap and rbt; transactions for
qp).

The qp test has been extended to see effect of the dns_qp_compact() and
rcu_barrier() on the overall speed and memory consumption.
2023-07-31 15:51:15 +02:00
Ondřej Surý
4dacdde28f Refactor dns_badcache to use cds_lfht lock-free hashtable
The dns_badcache unit had (yet another) own locked hashtable
implementation.  Replace the hashtable used by dns_badcache with
lock-free cds_lfht implementation from liburcu.
2023-07-31 15:51:15 +02:00
Ondřej Surý
c4bc43c8a7 Merge branch 'stepan/fix-check-in-ecdsa-system-test' into 'main'
Fix ecdsa256 check in ecdsa system test setup

See merge request isc-projects/bind9!8053
2023-07-28 07:14:27 +00:00
Štěpán Balážik
10194baa07 Fix ecdsa256 check in ecdsa system test setup
Probably by copy-paste mistake, ecdsa384 was checked twice.
2023-07-28 09:13:39 +02:00
Ondřej Surý
baa8f81b3d Merge branch '4086-run-dispentry_destroy-on-associated-loop' into 'main'
Pin dns_request to the associated loop

Closes #4086

See merge request isc-projects/bind9!8137
2023-07-28 07:07:50 +00:00
Ondřej Surý
9908e0a664 Add CHANGES note for [GL #4086] 2023-07-28 09:01:36 +02:00
Ondřej Surý
4ca64c1799 Pin dns_request to the associated loop
When dns_request was canceled via dns_requestmgr_shutdown() the cancel
event would be propagated on different loop (loop 0) than the loop where
request was created on.  In turn this would propagate down to isc_netmgr
where we require all the events to be called from the matching isc_loop.

Pin the dns_requests to the loops and ensure that all the events are
called on the associated loop.  This in turn allows us to remove the
hashed locks on the requests and change the single .requests list to be
a per-loop list for the request accounting.

Additionally, do some extra cleanup because some race condititions are
now not possible as all events on the dns_request are serialized.
2023-07-28 09:01:22 +02:00
Ondřej Surý
0fa8d8c191 Merge branch 'ondrej/remove__tsan_acquire_release-hints' into 'main'
Cleanup the __tsan_acquire/__tsan_release

See merge request isc-projects/bind9!8114
2023-07-28 06:59:44 +00:00
Ondřej Surý
b6b0d81a36 Cleanup the __tsan_acquire/__tsan_release
With ThreadSanitizer support added to the Userspace RCU, we no longer
need to wrap the call_rcu and caa_container_of with
__tsan_{acquire,release} hints.  Remove the direct calls to
__tsan_{acquire,release} and the isc_urcu_{container,cleanup} macros.
2023-07-28 08:59:08 +02:00
Mark Andrews
c8b73d98e4 Merge branch '4225-return-refused-if-gssapi-not-configured' into 'main'
Resolve "SERVFAIL response to TKEY query"

Closes #4225

See merge request isc-projects/bind9!8146
2023-07-28 06:43:58 +00:00
Mark Andrews
ccaefce7ca Add CHANGES for [GL #4225] 2023-07-28 14:38:20 +10:00
Mark Andrews
3a2a24903c Check GSS-API TKEY against non configured server
Check for the expected error message which includes rcode REFUSED
then reload the server to specify the keytab for the rest of the
GSSAPI tests.
2023-07-28 14:38:20 +10:00
Mark Andrews
f244619680 Report TKEY query errors in nsupdate 2023-07-28 14:38:20 +10:00
Mark Andrews
b5076014b9 Return REFUSED if GSSAPI is not configured
Return REFUSED if neither a keytab nor a gssapi credential is
configured to GSSAPI/TKEY requests.
2023-07-28 14:37:32 +10:00
Ondřej Surý
5342d6e97d Merge branch 'ondrej/workaround-the-ASAN-report-for-cds_lfht_for_each_entry' into 'main'
Workaround AddressSanitizer overzealous check

See merge request isc-projects/bind9!8116
2023-07-27 13:22:08 +00:00
Ondřej Surý
dc3e07572b Workaround AddressSanitizer overzealous check
The cds_lfht_for_each_entry and cds_lfht_for_each_entry_duplicate macros
had a code that operated on the NULL pointer, at the end of the list it
was calling caa_container_of() on the NULL pointer in the init-clause
and iteration-expression, but the result wasn't actually used anywhere
because the cond-expression in the for loop has prevented executing
loop-statement.  This made AddressSanitizer notice the invalid operation
and rightfully complain.

This was reported to the upstream and fixed there.  Pull the upstream
fix into our <isc/urcu.h> header, so our CI checks pass.
2023-07-27 15:21:39 +02:00
Ondřej Surý
7c8d6a454d Merge branch '4227-free-stub_glue_request-in-stub_glue_response' into 'main'
Free struct stub_glue_request in stub_glue_response() callback

Closes #4227

See merge request isc-projects/bind9!8147
2023-07-27 10:34:20 +00:00
Ondřej Surý
7a2b4ad17b Add CHANGES note for [GL #4227] 2023-07-27 12:34:03 +02:00
Ondřej Surý
31c43d4b76 Free struct stub_glue_request in stub_glue_response() callback
When stub_glue_response() is called, the associated data is stored in
newly allocated struct stub_glue_request.  The allocated structure is
never freed in the callback, thus we leak a little bit of memory.
2023-07-27 12:34:03 +02:00
Ondřej Surý
57a568e8f9 Unify the naming for struct stub_glue_request
The stub_request_nameserver_address() used 'request' as name for
struct stub_glue_request leading to confusion between 'request'
(stub_glue_request) and 'request->request' (dns_request_t).

Unify the name to 'sgr' already used in struct stub_glue_response().
2023-07-27 12:34:03 +02:00
Ondřej Surý
8ff1729b66 Merge branch 'ondrej/cleanup-isc_stats_create-return' into 'main'
Refactor isc_stats_create() and its downstream users to return void

See merge request isc-projects/bind9!8055
2023-07-27 10:10:26 +00:00
Ondřej Surý
bf44554889 Refactor ns_server_create() to return void
After isc_stats_create() change, the ns_server_create() cannot fail, so
refactor the function to return void and fix all its uses.
2023-07-27 11:37:44 +02:00
Ondřej Surý
ea2fe8eea4 Refactor dns_zone_create() to return void
After isc_stats_create() change, the dns_zone_create() cannot fail, so
refactor the function to return void and fix all its uses.
2023-07-27 11:37:44 +02:00
Ondřej Surý
045d8d9ed6 Refactor dns_adb_create() to return void
After isc_stats_create() change, the dns_adb_create() cannot fail, so
refactor the function to return void and fix all its uses.
2023-07-27 11:37:44 +02:00
Ondřej Surý
5321c474ea Refactor isc_stats_create() and its downstream users to return void
The isc_stats_create() can no longer return anything else than
ISC_R_SUCCESS.  Refactor isc_stats_create() and its variants in libdns,
libns and named to just return void.
2023-07-27 11:37:44 +02:00
Tom Krizek
6a6f2e58e9 Merge branch '4055-improve-the-overmem-cache-cleaning-test' into 'main'
[CVE-2023-2828] Add test for dns_rbtdb overmem purging

Closes #4055

See merge request isc-projects/bind9!8141
2023-07-26 11:24:36 +00:00
Ondřej Surý
269c03831f Add test for dns_rbtdb overmem purging
Add a unit test to check if the overmem purging in the RBTDB is
effective when mixed size RR data is inserted into the database.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Jinmei Tatuya <jtatuya@infoblox.com>
2023-07-26 10:30:51 +02:00
Tom Krizek
186d4cec3d Merge branch '4089-stale-query-loop-test' into 'main'
Reproducer for CVE-2023-2911

Closes #4089

See merge request isc-projects/bind9!8132
2023-07-25 08:34:00 +00:00
Tom Krizek
f617512d37 Reproducer for CVE-2023-2911
The conditions that trigger the crash:
- a stale record is in cache
- stale-answer-client-timeout is 0
- multiple clients query for the stale record, enough of them to exceed
  the recursive-clients quota
- the response from the authoritative is sufficiently delayed so that
  recursive-clients quota is exceeded first

The reproducer attempts to simulate this situation. However, it hasn't
proven to be 100 % reproducible, especially in CI. When reproducing
locally, the priming query also seems to sometimes interfere and prevent
the crash. When the reproducer is ran twice, it appears to be more
reliable in reproducing the issue.
2023-07-25 09:23:24 +02:00
Tom Krizek
ae179921e0 Merge branch 'tkrizek/checkconf-keys-dir-set-e' into 'main'
Clean up keys directory in checkconf test

See merge request isc-projects/bind9!8133
2023-07-25 07:20:31 +00:00
Tom Krizek
062dfac28e Clean up keys directory in checkconf test
The keys directory should be cleaned up in clean.sh. Doing that in the
test itself isn't reliable which may lead to failing mkdir which causes
the test to fail with set -e.
2023-07-25 09:19:55 +02:00
Matthijs Mekking
539a4581ea Merge branch '4222-inline-system-test-ns7-fails-to-start' into 'main'
Change RSASHA256 key length to be FIPS compliant

Closes #4222

See merge request isc-projects/bind9!8131
2023-07-25 06:42:17 +00:00
Matthijs Mekking
2c978017b3 Change RSASHA256 key length to be FIPS compliant
After commit f4eb3ba4, that is part of removing 'auto-dnssec', the
inline system test started to fail in FIPS CI jobs. This is because
the 'nsec3-loop' zone started to use a RSASHA256 key size of 1024 and
this is not FIPS compliant.

This commit changes the key size from 1024 to 4096, in order to
become FIPS compliant again.
2023-07-25 06:42:03 +00:00
Ondřej Surý
aed4fdd7d3 Merge branch 'ondrej/cleanup-cruft-in-dns_catz' into 'main'
Cleanup the dns_catz unit API

See merge request isc-projects/bind9!8099
2023-07-24 17:54:26 +00:00
Ondřej Surý
e29f9e982e Fix TSAN data race accessing zone->parentcatz
The zone->parentcatz was accessed unlocked in dns_zone_get_parentcatz(),
add a locking around it.
2023-07-24 19:49:14 +02:00
Aram Sargsyan
b2e84371d3 Test catz member zone fail-safe recreation
The catz module has a fail-safe code to recreate a member zone
that was expected to exist but was not found.

Improve a test case where the fail-safe code is expected to execute
to check that the log message exists.

Add a test case where the fail-safe code is not expected to execute
to check that the log message does not exist.
2023-07-24 19:49:14 +02:00
Ondřej Surý
48714a9c1d Cleanup the dns_catz unit API
1. Change the _new, _add and _copy functions to return the new object
   instead of returning 'void' (or always ISC_R_SUCCESS)

2. Cleanup the isc_ht_find() + isc_ht_add() usage - the code is always
   locked with catzs->lock (mutex), so when isc_ht_find() returns
   ISC_R_NOTFOUND, the isc_ht_add() must always succeed.

3. Instead of returning direct iterator for the catalog zone entries,
   add dns_catz_zone_for_each_entry2() function that calls callback
   for each catalog zone entry and passes two extra arguments to the
   callback.  This will allow changing the internal storage for the
   catalog zone entries.

4. Cleanup the naming - dns_catz_<fn>_<obj> -> dns_catz_<obj>_<fn>, as an
   example dns_catz_new_zone() gets renamed to dns_catz_zone_new().
2023-07-24 19:49:14 +02:00
Matthijs Mekking
aad9fda87d Merge branch '4221-multisigner-add-nsupdate-return-value-checks' into 'main'
Add nsupdate retvalue checks in multisigner test

See merge request isc-projects/bind9!8130
2023-07-24 15:18:44 +00:00
Matthijs Mekking
e426501a45 Add nsupdate retvalue checks in multisigner test
Ensure the nsupdate command executes with success.

Add a couple of 'n=$((n+1))' and explicit 'ret=0' to clearly mark the
start of a new check.
2023-07-24 11:48:07 +02:00
Mark Andrews
f66881c995 Merge branch '4215-add-isc_r_timedout-to-the-reasons-to-call-dns_zonemgr_unreachableadd-in-xfrin' into 'main'
Resolve "Add ISC_R_TIMEDOUT to the reasons to call dns_zonemgr_unreachableadd in xfrin"

Closes #4215

See merge request isc-projects/bind9!8122
2023-07-21 22:57:38 +00:00
Mark Andrews
fefc273eb0 Add CHANGES note for [GL #4215] 2023-07-22 08:18:14 +10:00
Mark Andrews
621c117101 Mark a primary as unreachable on timed out in xfin
When a primary server is not responding, mark it as temporarialy
unreachable.  This will prevent too many zones queuing up on a
unreachable server and allow the refresh process to move onto
the next primary sooner once it has been so marked.
2023-07-22 08:17:11 +10:00
Ondřej Surý
2f9322f88d Merge branch '4200-placeholder' into 'main'
Add CHANGES placeholder for [GL #4200]

Closes #4200

See merge request isc-projects/bind9!8127
2023-07-20 16:40:42 +00:00
Ondřej Surý
0487d50813 Add CHANGES placeholder for [GL #4200] 2023-07-20 18:40:08 +02:00
Ondřej Surý
e0aec97bcd Merge branch '4212-dead-code-in-dns_rbt-zonedb' into 'main'
Restore the IS_STUB() condition in zone_zonecut_callback

Closes #4212

See merge request isc-projects/bind9!8117
2023-07-20 16:00:13 +00:00
Ondřej Surý
40659b5978 Restore the IS_STUB() condition in zone_zonecut_callback
After the refactoring the condition whether to use DNAME or NS for the
zonecut was incorrectly simplified and the !IS_STUB() condition was
removed.  This was flagged by Coverity as:

	/lib/dns/rbt-zonedb.c: 192 in zone_zonecut_callback()
	186     		found = ns_header;
	187     		search->zonecut_sigheader = NULL;
	188     	} else if (dname_header != NULL) {
	189     		found = dname_header;
	190     		search->zonecut_sigheader = sigdname_header;
	191     	} else if (ns_header != NULL) {
	>>>     CID 462773:  Control flow issues  (DEADCODE)
	>>>     Execution cannot reach this statement: "found = ns_header;".
	192     		found = ns_header;
	193     		search->zonecut_sigheader = NULL;
	194     	}
	195
	196     	if (found != NULL) {
	197     		/*

Instead of removing the extra block, restore the !IS_STUB() condition
for the first if block.
2023-07-20 17:59:44 +02:00
Tom Krizek
f03d41c6ee Merge branch 'tkrizek/multisigner-test-pytest-glue' into 'main'
Add missing pytest glue to run multisigner test

See merge request isc-projects/bind9!8126
2023-07-20 15:55:09 +00:00