Commit Graph

39592 Commits

Author SHA1 Message Date
Matthijs Mekking
62ddc3dca0 Remove redundant inline-signing lines from tests
Now that inline-signing is explicitly set in dnssec-policy, remove
the redundant "inline-signing yes;" lines from the system tests.
2023-08-01 06:55:48 +00:00
Matthijs Mekking
495597a91b Update inline-signing checkconf code
When using automated DNSSEC management, it is required that the zone
is dynamic, or that inline-signing is enabled (or both). Update the
checkconf code to also allow inline-signing to be enabled within
dnssec-policy.
2023-08-01 06:55:48 +00:00
Matthijs Mekking
bbfdcc36c8 Add inline-signing to dnssec-policy
Add an option to enable/disable inline-signing inside the
dnssec-policy clause. The existing inline-signing option that is
set in the zone clause takes priority, but if it is omitted, then the
value that is set in dnssec-policy is taken.

The built-in policies use inline-signing.

This means that if you want to use the default policy without
inline-signing you either have to set it explicitly in the zone
clause:

    zone "example" {
        ...
        dnssec-policy default;
        inline-signing no;
    };

Or create a new policy, only overriding the inline-signing option:

    dnssec-policy "default-dynamic" {
        inline-signing no;
    };

    zone "example" {
        ...
        dnssec-policy default-dynamic;
    };

This also means that if you are going insecure with a dynamic zone,
the built-in "insecure" policy needs to be accompanied with
"inline-signing no;".
2023-08-01 06:55:48 +00:00
Ondřej Surý
4bf94f4c52 Merge branch '4196-use-rculist-for-dns_db_updatenotify' into 'main'
Use cds_lfht for updatenotify mechanism in dns_db unit

Closes #4196

See merge request isc-projects/bind9!8097
2023-07-31 16:12:54 +00:00
Ondřej Surý
8c4cf5b1de fixup! Use cds_lfht for updatenotify mechanism in dns_db unit 2023-07-31 18:11:34 +02:00
Ondřej Surý
a1afa31a5a Use cds_lfht for updatenotify mechanism in dns_db unit
The updatenotify mechanism in dns_db relied on unlocked ISC_LIST for
adding and removing the "listeners".  The mechanism relied on the
exclusive mode - it should have been updated only during reconfiguration
of the server.  This turned not to be true anymore in the dns_catz - the
updatenotify list could have been updated during offloaded work as the
offloaded threads are not subject to the exclusive mode.

Change the update_listeners to be cds_lfht (lock-free hash-table), and
slightly refactor how register and unregister the callbacks - the calls
are now idempotent (the register call already was and the return value
of the unregister function was mostly ignored by the callers).
2023-07-31 18:11:34 +02:00
Ondřej Surý
6856798919 Merge branch 'ondrej/add-isc_rwlock-unit-test' into 'main'
Add rwlock unit test

See merge request isc-projects/bind9!7859
2023-07-31 16:08:46 +00:00
Ondřej Surý
46d75e0004 Add rwlock unit test
Add simple rwlock unit test and rwlock benchmark.  The benchmark
compares the pthread rwlock with isc rwlock implementation, so it's
mainly useful when developing a new isc rwlock implementation.
2023-07-31 18:07:56 +02:00
Ondřej Surý
ed944ba8fd Merge branch '4223-replace-dns_badcache-hashtable-implementation' into 'main'
Refactor dns_badcache to use cds_lfht lock-free hashtable

Closes #4223

See merge request isc-projects/bind9!8139
2023-07-31 13:54:11 +00:00
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