Commit Graph
41741 Commits
Author SHA1 Message Date
Arаm Sаrgsyаn 2287dc0ac0 [9.20] fix: usr: Fix a statistics channel counter bug when 'forward only' zones are used
When resolving a zone with a 'forward only' policy, and
finding out that all the forwarders are marked as "bad",
the 'ServerQuota' counter of the statistics channel was
incorrectly increased. This has been fixed.

Closes #1793

Backport of MR !9493

Merge branch 'backport-1793-serverquota-counter-bug-with-forward-only-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9502
2024-09-16 12:25:19 +00:00
Aram Sargsyan 80dad234ba Add a statistics channel check in the forward system test
Check that the fix in the previous commit works and that the
'ServerQuota' counter in the statistics channel is still unset
after a SERVFAIL result in a 'forward only' zone.

(cherry picked from commit 81b3c5d908)
2024-09-16 09:31:38 +00:00
Aram Sargsyan 59cc292928 Fix a 'serverquota' counter calculation bug
The 'all_spilled' local variable in resolver.c:fctx_getaddresses()
is 'true' by default, and only becomes false when there is at least
one successfully found NS address. However, when a 'forward only;'
configuration is used, the code jumps over the part where it looks
for NS addresses and doesn't reset the 'all_spilled' to false, which
results in incorretly increased 'serverquota' statistics variable,
and also in invalid return error code from the function. The result
code error didn't make any differences, because all codes other than
'ISC_R_SUCCESS' or 'DNS_R_WAIT' were treated in the same way, and
the result code was never logged anywhere.

Set the default value of 'all_spilled' to 'false', and only make it
'true' before actually starting to look up NS addresses.

(cherry picked from commit e430ce7039)
2024-09-16 09:31:38 +00:00
Mark Andrews 12eb16186f [9.20] chg: dev: Remove statslock from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked) by converting dnssec-signzone to use atomics for statistics counters rather than using a lock.

Closes #4939

Backport of MR !9496

Merge branch 'backport-4939-remove-stats-lock-from-dnssec-signzone-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9500
2024-09-16 03:29:39 +00:00
Mark Andrews b33727a202 Remove 'statslock' from dnssec-signzone
Silence Coverity CID 468757 and 468767 (DATA RACE read not locked)
by converting dnssec-signzone to use atomics for statistics counters
rather than using a lock.  This should be marginally faster than
using the lock as well when statistics are requested.

(cherry picked from commit 473cbd4e87)
2024-09-16 02:52:38 +00:00
Ondřej Surý c0022f6802 [9.20] fix: usr: Separate DNSSEC validation from the long-running tasks
As part of the KeyTrap \[CVE-2023-50387\] mitigation, the DNSSEC CPU-intensive operations were offloaded to a separate threadpool that we use to run other tasks that could affect the networking latency.

If that threadpool is running some long-running tasks like RPZ, catalog zone processing, or zone file operations, it would delay DNSSEC validations to a point where the resolving signed DNS records would fail.

Split the CPU-intensive and long-running tasks into separate threadpools in a way that the long-running tasks don't block the CPU-intensive operations.

Closes #4898

Backport of MR !9473

Merge branch 'backport-4898-move-offloaded-DNSSEC-to-own-threads-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9495
2024-09-12 15:46:28 +00:00
Ondřej Surý 26c2cbe63b Move offloaded DNSSEC operations to different helper threads
Currently, the isc_work API is overloaded.  It runs both the
CPU-intensive operations like DNSSEC validations and long-term tasks
like RPZ processing, CATZ processing, zone file loading/dumping and few
others.

Under specific circumstances, when many large zones are being loaded, or
RPZ zones processed, this stops the CPU-intensive tasks and the DNSSEC
validation is practically stopped until the long-running tasks are
finished.

As this is undesireable, this commit moves the CPU-intensive operations
from the isc_work API to the isc_helper API that only runs fast memory
cleanups now.

(cherry picked from commit 8a96a3af6a)
2024-09-12 16:41:02 +02:00
Ondřej Surý 17f23224d1 Add isc_helper API that adds 1:1 thread for each loop
Add an extra thread that can be used to offload operations that would
affect latency, but are not long-running tasks; those are handled by
isc_work API.

Each isc_loop now has matching isc_helper thread that also built on top
of uv_loop.  In fact, it matches most of the isc_loop functionality, but
only the `isc_helper_run()` asynchronous call is exposed.

(cherry picked from commit 6370e9b311)
2024-09-12 14:39:07 +00:00
Michal Nowak f0277b7284 [9.20] chg: test: Replace dns.resolver module in system tests
Closes #4634

Backport of MR !9150

Merge branch 'backport-4634-drop-dns.resolver-module-from-system-tests-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9491
2024-09-12 11:19:04 +00:00
Michal Nowak 944fc02f83 Extract dns.rcode compatibility code to isctest.compat
(cherry picked from commit 8b55d0709d)
2024-09-12 11:17:52 +00:00
Michal Nowak c8c8b36e44 Turn off deadline for wildcard tests
Tests that query BIND need much longer deadline to account for retries,
the default 200ms won't work.

(cherry picked from commit d2e0043ec3)
2024-09-12 11:17:52 +00:00
Michal Nowak 937d7f30eb Extract "custom" named instances support to isctest.run module
(cherry picked from commit 2cec1de43b)
2024-09-12 11:17:52 +00:00
Michal Nowak 531567b0a1 Rework query functions to retry by default
(cherry picked from commit 5929ba0f54)
2024-09-12 11:17:52 +00:00
Michal Nowak f7e03b4f3f Deprecate dns.resolver module in BIND 9 system tests
(cherry picked from commit cb3ffac9a7)
2024-09-12 11:17:52 +00:00
Michal Nowak 555f42754e Replace dns.resolver module in system tests
(cherry picked from commit bfe338b965)
2024-09-12 11:17:52 +00:00
Arаm Sаrgsyаn 3b5c4f94d7 [9.20] fix: dev: Fix data race in offloaded dns_message_checksig()
When verifying a message in an offloaded thread there is a race with
the worker thread which writes to the same buffer. Clone the message
buffer before offloading.

Closes #4929

Backport of MR !9481

Merge branch 'backport-4929-data-race-in-dns_dnssec_verifymessage-memmove-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9490
2024-09-12 10:34:07 +00:00
Aram Sargsyan 65fced42b9 Fix data race in offloaded dns_message_checksig()
When verifying a message in an offloaded thread there is a race with
the worker thread which writes to the same buffer. Clone the message
buffer before offloading.

(cherry picked from commit 35ef25e5ea)
2024-09-12 09:12:35 +00:00
Mark Andrews 02822b70ee [9.20] fix: usr: Don't allow statistics-channel if libxml2 and libjson-c are unsupported
When the libxml2 and libjson-c libraries are not supported, the statistics channel can't return anything useful, so it is now disabled. Use of `statistics-channel` in `named.conf` is a fatal error.

Closes #4895

Backport of MR !9423

Merge branch 'backport-4895-link-style-sheet-to-libxml2-support-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9486
2024-09-12 04:07:13 +00:00
Mark Andrews 4dcfa7b580 Fix named-checkconf and statistics-channels
If neither libxml2 nor libjson_c are available have named-checkconf
fail if a statistics-channels block is specified.

(cherry picked from commit b9246418e8)
2024-09-12 03:27:38 +00:00
Mark Andrews c52a9a5731 Only configure statistics-channels if supported
(cherry picked from commit d0c8c6d7ef)
2024-09-12 03:27:38 +00:00
Mark Andrews b3c0eb9bac Don't create the HTTP server if libxml and libjson-c are unavailable
(cherry picked from commit 31650d9440)
2024-09-12 03:27:38 +00:00
Mark Andrews 592ca7dc19 Don't return the style sheet unless libxml2 is supported
If not statistics are available we don't want the style sheet
returned.

(cherry picked from commit ed81b3ae93)
2024-09-12 03:27:38 +00:00
Mark Andrews e9627cef19 [9.20] fix: test: The statschannel tests fails if one of libxml2 or json-c is configured
The `statschannel` system test failed if only one of `libxml2` or `json-c` is
available / configured as checks were being run against the non available
statistics page.

Closes #4919

Backport of MR !9454

Merge branch 'backport-4919-fix-statschannel-system-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9483
2024-09-11 23:42:16 +00:00
Mark Andrews bacc945989 Properly detect when libxml2 or json-c is not available
(cherry picked from commit 7de939609b)
2024-09-11 23:06:55 +00:00
Nicki Křížek 09ec79b3e4 [9.20] chg: doc: Review BIND ARM (9.18 updates)
Forward-port of !9375

Closes #4832

Merge branch '4832-bind-arm-review-from-2022-through-9-18-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9480
2024-09-11 15:11:16 +00:00
Suzanne GoldlustandNicki Křížek 0fa0555dd4 Review and update ARM documentation
Minor edits and fixes for the documentation added from 2022 through
9.18.

(cherry picked from commit b6e4b512dd)
2024-09-11 16:32:33 +02:00
Michal Nowak 117c021082 [9.20] chg: ci: Update code formatting
clang 19 was updated in the base image.

Backport of MR !9475

Merge branch 'backport-mnowak/fix-clang-format-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9477
2024-09-11 09:44:42 +00:00
Michal Nowak 0d1cdf2677 Update to ignore 0aeefb9741 2024-09-11 11:36:56 +02:00
Michal Nowak 0aeefb9741 Update code formatting
clang 19 was updated in the base image.

(cherry picked from commit ff69d07fed)
2024-09-11 09:33:13 +00:00
Nicki Křížek 30c4cbd403 [9.20] chg: usr: allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the reason is `DNS_R_TOOMANYRECORDS`. This is because this error condition could be temporary only in an intermediate version of IXFR transactions and it's possible that the latest version of the zone doesn't have that condition. In such a case, the secondary would never be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently introduced `max-records-per-type` and `max-types-per-name` options: the primary may not have these limitations and may temporarily introduce "too many" records, breaking IXFR. If the primary side subsequently deletes these records, this fallback will help recover the zone transfer failure automatically; without it, the secondary side would first need to increase the limit, which requires more operational overhead and has its own adverse effect.

Closes #4928

Backport of MR !9333

Merge branch 'backport-fallback-ixfr-to-axfr-on-toomanyrecords-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9471
2024-09-10 13:15:46 +00:00
JINMEI TatuyaandNicki Křížek 33dd3fbca2 allow IXFR-to-AXFR fallback on DNS_R_TOOMANYRECORDS
This change allows fallback from an IXFR failure to AXFR when the
reason is DNS_R_TOOMANYRECORDS. This is because this error condition
could be temporary only in an intermediate version of IXFR
transactions and it's possible that the latest version of the zone
doesn't have that condition. In such a case, the secondary would never
be able to update the zone (even if it could) without this fallback.

This fallback behavior is particularly useful with the recently
introduced max-records-per-type and max-types-per-name options:
the primary may not have these limitations and may temporarily
introduce "too many" records, breaking IXFR. If the primary side
subsequently deletes these records, this fallback will help recover
the zone transfer failure automatically; without it, the secondary
side would first need to increase the limit, which requires more
operational overhead and has its own adverse effect.

This change also fixes a minor glitch that DNS_R_TOOMANYRECORDS wasn't
logged in xfrin_fail.

(cherry picked from commit 7289090683)
2024-09-10 12:39:36 +00:00
Arаm Sаrgsyаn a15d975dbe [9.20] fix: usr: Fix assertion failure when processing access control lists
The named process could terminate unexpectedly when processing access
control lists (ACLs). This has been fixed.

Closes #4908

Backport of MR !9458

Merge branch 'backport-4908-acl-assertion-failure-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9466
2024-09-10 11:26:30 +00:00
Aram Sargsyan 6706d2427e Fix RCU API usage in acl.c
The rcu_xchg_pointer() function can be used outside of a critical
section, and usually must be followed by a synchronize_rcu() or
call_rcu() call to detach from the resource, unless if there are
some guarantees in place because of our own reference counting.

(cherry picked from commit 0367c60759)
2024-09-10 10:34:32 +00:00
Nicki Křížek d42a5be6be [9.20] chg: test: Remove test.skr unit test file
This file was initially created for unit testing, but later code was added to generate the file. The static file should have been removed from the git repo.

Closes #4916

Backport of MR !9450

Merge branch 'backport-4916-skr-unit-test-rm-test-file-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9465
2024-09-10 06:30:42 +00:00
Matthijs MekkingandNicki Křížek c89230efcf Remove test.skr unit test file
This file was initially created for unit testing, but later code was
added to generate the file. The static file should have been removed
from the git repo.

(cherry picked from commit 903534c9a9)
2024-09-09 17:42:05 +00:00
Nicki Křížek 3f115d3cda [9.20] fix: usr: Fix bug in Offline KSK that is using ZSK with unlimited lifetime
If the ZSK has unlimited lifetime, the timing metadata "Inactive" and "Delete" cannot be found and is treated as an error, preventing the zone to be signed. This has been fixed.

Closes #4914

Backport of MR !9447

Merge branch 'backport-4914-offline-ksk-zsk-lifetime-unlimited-bug-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9453
2024-09-09 17:28:11 +00:00
Matthijs MekkingandNicki Křížek 66f850f01c Nit logging change
Fix wrong function name (dns_dnssec_keymgr -> dns_keymgr_run).

Add error log if dns_keymgr_offline() fails.

(cherry picked from commit 911daeb306)
2024-09-09 19:27:28 +02:00
Matthijs MekkingandNicki Křížek fa20a1df39 Fix bug in dns_keymgr_offline
If the ZSK has lifetime unlimited, the timing metadata "Inactive" and
"Delete" cannot be found and is treated as an error. Fix by allowing
these metadata to not exist.

(cherry picked from commit 5af53a329f)
2024-09-09 19:27:28 +02:00
Nicki Křížek 90bec9e287 chg: doc: Set up version for BIND 9.20.3
Merge branch 'nicki/set-up-version-for-bind-9.20.3' into 'bind-9.20'

See merge request isc-projects/bind9!9463
2024-09-09 17:23:58 +00:00
Nicki Křížek 314ba3898d Update BIND version to 9.20.3-dev 2024-09-09 19:21:41 +02:00
Nicki Křížek 02d4755cc3 [9.20] fix: usr: Fix rare assertion failure when shutting down incoming transfer
A very rare assertion failure can be triggered when the incoming transfer is either forcefully shut down or it is finished during printing the details about the statistics channel.  This has been fixed.

Closes #4860

Backport of MR !9336

Merge branch 'backport-4860-destroy-xfrin-timers-on-the-loop-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9377
2024-09-03 16:26:59 +00:00
Ondřej SurýandNicki Křížek 6db9f177b5 Destroy the dns_xfrin isc_timers on the correct loop
There are few places where we attach/detach from the dns_xfrin object
while running on a different thread than the zone's assigned thread -
xfrin_xmlrender() in the statschannel and dns_zone_stopxfr() to name the
two places where it happens now.  In the rare case, when the incoming
transfer completes (or shuts down) in the brief period between the other
thread attaches and detaches from the dns_xfrin, the isc_timer_destroy()
calls would be called by the last thread calling the xfrin_detach().
In the worst case, it would be this other thread causing assertion
failure.  Move the isc_timer_destroy() call to xfrin_end() function
which is always called on the right thread and to match this move
isc_timer_create() to xfrin_start() - although this other change makes
no difference.

(cherry picked from commit 3bca3cb5cf)
2024-09-03 15:51:35 +00:00
Nicki Křížek ce3209b1dc [9.20] chg: usr: Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on other O/S).

If the admin has used taskset, the `named` will now follow to automatically use the given number of CPUs rather than the system wide count.

Closes #4884

Backport of MR !9398

Merge branch 'backport-4884-use-cpuset-to-get-number-of-cpus-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9442
2024-09-03 13:52:42 +00:00
Ondřej SurýandNicki Křížek 5255843f9b Follow the number of CPU set by taskset/cpuset
Administrators may wish to constrain the set of cores that BIND 9 runs
on via the 'taskset', 'cpuset' or 'numactl' programs (or equivalent on
other O/S), for example to achieve higher (or more stable) performance
by more closely associating threads with individual NIC rx queues. If
the admin has used taskset, it follows that BIND ought to
automatically use the given number of CPUs rather than the system wide
count.

Co-Authored-By: Ray Bellis <ray@isc.org>
(cherry picked from commit 5a2df8caf5)
2024-09-03 13:52:10 +00:00
Nicki Křížek 36e220646c [9.20] chg: test: Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

Closes #4851

Backport of MR !9318

Merge branch 'backport-4851-generate-problematic-isc_hashmap-test-data-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9321
2024-09-03 13:24:21 +00:00
Ondřej SurýandNicki Křížek 95faca929e Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

(cherry picked from commit 2310c322c0)
2024-09-03 14:46:58 +02:00
Mark Andrews 4f01e8d33c [9.20] fix: Address potential TSAN issue with find->status
find->status is a private field of dns_adbfind_t so it now has an accessor function and has been made atomic.

Closes #4802

Backport of MR !9137

Merge branch 'backport-4802-address-potential-tsan-issue-with-find-status-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9433
2024-09-02 05:27:56 +00:00
Mark Andrews 1be660a1a2 Use atomics to access find->status
(cherry picked from commit a45e39d114)
2024-09-02 03:25:35 +00:00
Mark Andrews ce6c0c26a0 Use an accessor fuction to access find->status
find->status is marked as private and access is controlled
by find->lock.

(cherry picked from commit c900300f21)
2024-09-02 03:25:35 +00:00
Mark Andrews a348077718 [9.20] fix: chg: Improve performance when looking for the closest encloser when returning NSEC3 proofs
Use the fact that the database returns the longest matching part of the requested name to find the required NSEC3 record. If there are multiple versions present in the database we may have to search further.

Closes #4460

Backport of MR !9436

Merge branch 'backport-4460-auth-nsec3-many-labels-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!9438
2024-08-29 22:37:35 +00:00