Commit Graph

37233 Commits

Author SHA1 Message Date
Ondřej Surý
68abe3fa06 Add isc_task_setquantum() and use it for post-init zone loading
Add isc_task_setquantum() function that modifies quantum for the future
isc_task_run() invocations.

NOTE: The current isc_task_run() caches the task->quantum into a local
variable and therefore the current event loop is not affected by any
quantum change.

(cherry picked from commit 15ea6f002f)
2023-01-18 18:04:41 +01:00
Ondřej Surý
5f141e2c7f Keep the list of scheduled events on the timer
Instead of searching for the events to purge, keep the list of scheduled
events on the timer list and purge the events that we have scheduled.

(cherry picked from commit 3f8024b4a2f12fcd28a9dd813b6f1f3f11d506f2)
2023-01-18 18:04:41 +01:00
Ondřej Surý
be99507488 Repair isc_task_purgeevent(), clean isc_task_unsend{,range}()
The isc_task_purgerange() was walking through all events on the task to
find a matching task.  Instead use the ISC_LINK_LINKED to find whether
the event is active.

Cleanup the related isc_task_unsend() and isc_task_unsendrange()
functions that were not used anywhere.

(cherry picked from commit 17aed2f895)
2023-01-18 18:04:41 +01:00
Ondřej Surý
29bc0daed1 Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach-v9_18' into 'v9_18'
[9.18] Detach the views in zone_shutdown(), not in zone_free()

See merge request isc-projects/bind9!7388
2023-01-17 22:17:29 +00:00
Ondřej Surý
b4357fab6f Add CHANGES and release note for [GL #3801]
(cherry picked from commit b049e329ef)
2023-01-17 22:47:44 +01:00
Ondřej Surý
fe0e9cf301 Commit the change of view for view->managed_keys
When we change the view in the view->managed_keys, we never commit the
change, keeping the previous view possibly attached forever.

Call the dns_zone_setviewcommit() immediately after changing the view as
we are detaching the previous view anyway and there's no way to recover
from that.

(cherry picked from commit 7e8b53720d)
2023-01-17 22:47:44 +01:00
Ondřej Surý
f8b7188a42 Detach the views in zone_shutdown(), not in zone_free()
The .view (and possibly .prev_view) would be kept attached to the
removed zone until the zone is fully removed from the memory in
zone_free().  If this process is delayed because server is busy
something else like doing constant `rndc reconfig`, it could take
seconds to detach the view, possibly keeping multiple dead views in the
memory.  This could quickly lead to a massive memory bloat.

Release the views early in the zone_shutdown() call, and don't wait
until the zone is freed.

(cherry picked from commit 13bb821280)
2023-01-17 22:47:43 +01:00
Artem Boldariev
5d41338e9c Merge branch '3767-dot-no-alpn-transfer-shutdown-crash-v9-18' into 'v9_18'
[9.18](backport )XoT: properly handle the case when checking for ALPN failed

See merge request isc-projects/bind9!7387
2023-01-17 19:53:54 +00:00
Artem Boldariev
26c0dd96eb Modify CHANGES [GL #3767]
Mention that downloading a zone via TLS- from a server which does not
negotiate "dot" ALPN tag could have crashed BIND on shutdown.

(cherry picked from commit 16fa692b56)
2023-01-17 21:29:38 +02:00
Artem Boldariev
dbd15f962e XoT: properly handle the case when checking for ALPN failed
During XoT it is important to check for "dot" ALPN tag to be
negotiated (according to the RFC 9103). We were doing that, however, the
situation was not handled properly, leading to non-cancelled zone
transfers that would crash (abort()) BIND on shutdown.

In this particular case 'result' might equal 'ISC_R_SUCCESS'. When
this is the case, the part of the code supposed to handle failures
will not cancel the zone transfer.

This situation cannot happen when BIND is a secondary of other BIND
instance. Only primaries following the RFC not closely enough could
trigger such a behaviour.

(cherry picked from commit 34a1aab1cb)
2023-01-17 21:27:44 +02:00
Tom Krizek
ed23fd4b1f Merge branch '3804-fix-feature-detection-in-pytests-v9_18' into 'v9_18'
[9.18] Fix feature detection for pytest markers in tests

See merge request isc-projects/bind9!7385
2023-01-17 14:29:50 +00:00
Tom Krizek
58ff3b4fc0 Fix feature detection for pytest markers in tests
The condition was accidentally reversed during refactoring in
9730ac4c56 . It would result in skipped
tests on builds with proper support and false negatives on builds
without proper feature support.

Credit for reporting the issue and the fix goes to Stanislav Levin.

(cherry picked from commit 473cb530f4)
2023-01-17 14:50:23 +01:00
Ondřej Surý
aee89c3454 Merge branch 'cherry-pick-d7bcdf8b' into 'v9_18'
[9.18] Merge branch 'feature/main/zt-rwlock.h' into 'main'

See merge request isc-projects/bind9!7377
2023-01-16 11:09:55 +00:00
Ondřej Surý
c5c432a36a Merge branch 'feature/main/zt-rwlock.h' into 'main'
Include isc_rwlocktype_t type definition in zt.h

See merge request isc-projects/bind9!7376

(cherry picked from commit d7bcdf8bd6)

395d6fca Include isc_rwlocktype_t type definition in zt.h
2023-01-16 11:07:19 +00:00
Tom Krizek
0d0c2e466b Merge branch 'tkrizek/system-tests-pytest-prep-v9_18' into 'v9_18'
[9.18] Various tweaks of system test framework

See merge request isc-projects/bind9!7374
2023-01-16 09:42:30 +00:00
Tom Krizek
f3c6217046 Update the TEST_PARALLEL_JOBS value in CI
The authoritative source for this value is in the project's CI/CD
Variables Setting. The reason to keep it in .gitlab-ci.yaml as well is
to have functional testing in forks without the need to manually specify
this variable in Settings.

The tests have been executed with 4 jobs for some time now. This
"change" only brings .gitlab-ci.yaml file up to date, it doesn't
actually change the number of jobs we currently use to test.

(cherry picked from commit 03d7b45d81)
2023-01-16 10:13:53 +01:00
Tom Krizek
dd5f0d2c4c Tweak dupsigs test output
Use a different visual separator, since "====", "----" and "____" is
used by pytest to separate the log output.

(cherry picked from commit 9593ff9347)
2023-01-16 10:13:53 +01:00
Tom Krizek
8033857295 Look for ifconfig.sh.in in testsock.pl parent dir
Instead of using the current working directory to find the ifconfig.sh
script, look for the ifconfig.sh.in template in the directory where the
testsock.pl script is located. This enables the testsock.pl script to be
called from any working directory.

Using the ifconfig.sh.in template is sufficient, since it contains
the necessary information to be extracted: the max= value (which is
hard-coded in the template).

(cherry picked from commit e24d3b21d0)
2023-01-16 10:13:53 +01:00
Tom Krizek
bcf1f5c808 Factor out script to handle system test core dumps
Move the core dump detection functionality for system test runs into a
separate script. This enables reuse by the pytest runner. The
functionality remains the same.

(cherry picked from commit d9a97200d5)
2023-01-16 10:13:53 +01:00
Tom Krizek
db03296683 testcrypto.sh: run in TMPDIR if possible
Avoid creating any temporary files in the current workdir.

Additional/changing files in the bin/tests/system directory are
problematic for pytest/xdist collection phase, which assumes the list of
files doesn't change between the collection phase of the main pytest
thread and the subsequent collection phase of the xdist worker threads.

Since the testcrypto.sh is also called during pytest initialization
through conf.sh.common (to detect feature support), this could
occasionally cause a race condition when the list of files would be
different for the main pytest thread and the xdist worker.

(cherry picked from commit 61330a7863)
2023-01-16 10:13:51 +01:00
Michał Kępień
8b06de031e Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.18.12' into 'v9_18'
Set up version and release notes for BIND 9.18.12

See merge request isc-projects/bind9!7363
2023-01-13 14:47:07 +00:00
Michał Kępień
b6d271a1af Set up release notes for BIND 9.18.12 2023-01-13 15:40:27 +01:00
Michał Kępień
6d89ad302b Update BIND version to 9.18.12-dev 2023-01-13 15:40:27 +01:00
Ondřej Surý
dec1bf29fd Merge branch '3212-implement-incremental-rehashing-for-isc_ht-hashtables-v9_18' into 'v9_18'
[9.18] Implement incremental hash table resizing in isc_ht

See merge request isc-projects/bind9!7355
2023-01-11 17:01:00 +00:00
Ondřej Surý
68c094c59a Add CHANGES note for [GL #3212]
(cherry picked from commit 5ccb28d6d8)
2023-01-11 17:16:35 +01:00
Ondřej Surý
8c31a939c9 Implement incremental hash table resizing in isc_ht
Previously, an incremental hash table resizing was implemented for the
dns_rbt_t hash table implementation.  Using that as a base, also
implement the incremental hash table resizing also for isc_ht API
hashtables:

 1. During the resize, allocate the new hash table, but keep the old
    table unchanged.
 2. In each lookup, delete, or iterator operation, check both tables.
 3. Perform insertion operations only in the new table.
 4. At each insertion also move <r> elements from the old table to
    the new table.
 5. When all elements are removed from the old table, deallocate it.

To ensure that the old table is completely copied over before the new
table itself needs to be enlarged, it is necessary to increase the
size of the table by a factor of at least (<r> + 1)/<r> during resizing.

In our implementation <r> is equal to 1.

The downside of this approach is that the old table and the new table
could stay in memory for longer when there are no new insertions into
the hash table for prolonged periods of time as the incremental
rehashing happens only during the insertions.

(cherry picked from commit e42cb1f198)
2023-01-11 17:15:33 +01:00
Arаm Sаrgsyаn
c120cc40f5 Merge branch 'aram/dns_fwdtable_addfwd-cleanup-bugfix-v9_18' into 'v9_18'
[9.18] Fix dns_fwdtable_addfwd() error path cleanup bug

See merge request isc-projects/bind9!7354
2023-01-11 14:25:44 +00:00
Aram Sargsyan
39cc597022 Use sizeof(*ptr) for allocating/freeing memory in forward.c
As shown in the previous commit, using sizeof(type_t) is a little
bit more error-prone when copy-pasting code, so extracting the
size information from the pointer which is being dealt with seems
like a better alternative.

(cherry picked from commit cf4003fa58)
2023-01-11 13:42:09 +00:00
Aram Sargsyan
64c8e63942 Fix dns_fwdtable_addfwd() error path cleanup bug
Free 'sizeof(dns_forwarder_t)' bytes of memory instead of
'sizeof(dns_sockaddr_t)' bytes, because `fwd` is a pointer
to a 'dns_forwarder_t' type structure.

(cherry picked from commit 0cc1b06d98)
2023-01-11 13:42:09 +00:00
Arаm Sаrgsyаn
6d3c38e381 Merge branch '3768-dns_zonemgr-use-after-free-v9_18' into 'v9_18'
[9.18] Fix a use-after-free bug in dns_zonemgr_releasezone()

See merge request isc-projects/bind9!7351
2023-01-11 12:53:01 +00:00
Aram Sargsyan
7643e0b60a Add a CHANGES note for [GL #3768]
(cherry picked from commit d50cb1d45d)
2023-01-11 12:16:40 +00:00
Aram Sargsyan
4121af8f7e Fix a use-after-free bug in dns_zonemgr_releasezone()
The dns_zonemgr_releasezone() function makes a decision to destroy
'zmgr' (based on its references count, after decreasing it) inside
a lock, and then destroys the object outside of the lock.

This causes a race with dns_zonemgr_detach(), which could destroy
the object in the meantime.

Change dns_zonemgr_releasezone() to detach from 'zmgr' and destroy
the object (if needed) using dns_zonemgr_detach(), outside of the
lock.

(cherry picked from commit c1fc212253)
2023-01-11 12:16:23 +00:00
Ondřej Surý
4ad0cc8118 Merge branch 'ondrej/use-pthread_barrier-if-available-v9_18' into 'v9_18'
[9.18] Prefer the pthread_barrier implementation over uv_barrier

See merge request isc-projects/bind9!7350
2023-01-11 10:21:46 +00:00
Ondřej Surý
6906b42cdd Prefer the pthread_barrier implementation over uv_barrier
Prefer the pthread_barrier implementation on platforms where it is
available over uv_barrier implementation.  This also solves the problem
with thread sanitizer builds on macOS that doesn't have pthread barrier.

(cherry picked from commit d07c4a98da)
2023-01-11 10:21:39 +00:00
Ondřej Surý
fa53e4f87c Merge branch '3772-revert-fix-single-read-tlsdns-client-v9_18' into 'v9_18'
Don't honour single read per client isc_nm_read() call in the TLSDNS

See merge request isc-projects/bind9!7349
2023-01-11 10:20:49 +00:00
Ondřej Surý
cb3990001f Add CHANGES and release note for [GL #3772] 2023-01-11 10:42:03 +01:00
Ondřej Surý
d0d9e7dfb2 Don't honour single read per client isc_nm_read() call in the TLSDNS
This reverts commit f17f5e831b that made
following change:

> The TLSDNS transport was not honouring the single read callback for
> TLSDNS client.  It would call the read callbacks repeatedly in case the
> single TLS read would result in multiple DNS messages in the decoded
> buffer.

Turns out that this change broke XoT, so we are reverting the change
until we figure out a proper fix that will keep the design promise and
not break XoT at the same time.
2023-01-11 10:17:55 +01:00
Matthijs Mekking
614d5c3334 Merge branch '3743-unexpected-prohibited-ede-v9_18' into 'v9_18'
[9.18] Fix unexpected "Prohibited" extended DNS error on allow-recursion mismatch

See merge request isc-projects/bind9!7324
2023-01-10 10:02:22 +00:00
Matthijs Mekking
29963f4c0e Add system test for #3743
(cherry picked from commit 8db8ec1f6e)
2023-01-10 10:02:14 +00:00
Matthijs Mekking
f8b7bb7c9f Add release note and CHANGES for #3743
(cherry picked from commit e43a26fd1e)
2023-01-10 10:02:14 +00:00
Matthijs Mekking
f481073110 Don't set EDE in ns_client_aclchecksilent
The ns_client_aclchecksilent is used to check multiple ACLs before
the decision is made that a query is denied. It is also used to
determine if recursion is available. In those cases we should not
set the extended DNS error "Prohibited".

(cherry picked from commit 798c8f57d4)
2023-01-10 10:02:14 +00:00
Mark Andrews
81f8b8fc14 Merge branch '3787-siphash-c-105-26-runtime-error-applying-zero-offset-to-null-pointer-v9_18' into 'v9_18'
[9.18] Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24

See merge request isc-projects/bind9!7341

Backport of MR !7339
2023-01-10 08:28:15 +00:00
Mark Andrews
f99593a9ca Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24
Arthimetic on NULL pointers is undefined.  Avoid arithmetic operations
when 'in' is NULL and require 'in' to be non-NULL if 'inlen' is not zero.

(cherry picked from commit 349c23dbb7)
2023-01-10 18:36:08 +11:00
Evan Hunt
12de356ed6 Merge branch '3773-remove-dscp-v9_18' into 'v9_18'
[9.18] Merge branch '3773-remove-dscp' into 'main'

See merge request isc-projects/bind9!7336
2023-01-10 00:20:14 +00:00
Evan Hunt
55d728a678 CHANGES and release note for [GL #3773]
(cherry picked from commit 34a7166029)
2023-01-09 14:24:23 -08:00
Evan Hunt
5fd93c66aa remove nonfunctional DSCP implementation
DSCP has not been fully working since the network manager was
introduced in 9.16, and has been completely broken since 9.18.
This seems to have caused very few difficulties for anyone,
so we have now marked it as obsolete and removed the
implementation.

To ensure that old config files don't fail, the code to parse
dscp key-value pairs is still present, but a warning is logged
that the feature is obsolete and should not be used. Nothing is
done with configured values, and there is no longer any
range checking.

(cherry picked from commit 916ea26ead)
2023-01-09 14:23:26 -08:00
Michal Nowak
703c799376 Merge branch 'mnowak/abort-on-ubsan-errors-v9_18' into 'v9_18'
[9.18] Abort on UBSAN errors

See merge request isc-projects/bind9!7327
2023-01-09 17:07:44 +00:00
Michal Nowak
addd4141a7 Abort on UBSAN errors
Previously, UBSAN errors might slip undetected.

(cherry picked from commit 1451bb7390)
2023-01-09 17:40:32 +01:00
Matthijs Mekking
815ac08a26 Merge branch '3678-serve-stale-servfailing-unexpectedly-v9_18' into 'v9_18'
[9.18] Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

See merge request isc-projects/bind9!7310
2023-01-09 15:01:49 +00:00
Michał Kępień
90408617d7 Check for NULL before dereferencing qctx->rpz_st
Commit 9ffb4a7ba1 causes Clang Static
Analyzer to flag a potential NULL dereference in query_nxdomain():

    query.c:9394:26: warning: Dereference of null pointer [core.NullDereference]
            if (!qctx->nxrewrite || qctx->rpz_st->m.rpz->addsoa) {
                                    ^~~~~~~~~~~~~~~~~~~
    1 warning generated.

The warning above is for qctx->rpz_st potentially being a NULL pointer
when query_nxdomain() is called from query_resume().  This is a false
positive because none of the database lookup result codes currently
causing query_nxdomain() to be called (DNS_R_EMPTYWILD, DNS_R_NXDOMAIN)
can be returned by a database lookup following a recursive resolution
attempt.  Add a NULL check nevertheless in order to future-proof the
code and silence Clang Static Analyzer.

(cherry picked from commit 07592d1315)
(cherry picked from commit a4547a1093)
2023-01-09 14:26:02 +01:00