Commit graph

37459 commits

Author SHA1 Message Date
Ondřej Surý
e26aa4cbb1
Don't use reference counting in isc_timer unit
The reference counting and isc_timer_attach()/isc_timer_detach()
semantic are actually misleading because it cannot be used under normal
conditions.  The usual conditions under which is timer used uses the
object where timer is used as argument to the "timer" itself.  This
means that when the caller is using `isc_timer_detach()` it needs the
timer to stop and the isc_timer_detach() does that only if this would be
the last reference.  Unfortunately, this also means that if the timer is
attached elsewhere and the timer is fired it will most likely be
use-after-free, because the object used in the timer no longer exists.

Remove the reference counting from the isc_timer unit, remove
isc_timer_attach() function and rename isc_timer_detach() to
isc_timer_destroy() to better reflect how the API needs to be used.

The only caveat is that the already executed event must be destroyed
before the isc_timer_destroy() is called because the timer is no longet
attached to .ev_destroy_arg.

(cherry picked from commit ae01ec2823)
2023-01-18 22:39:26 +01:00
Ondřej Surý
7197cf2b7e
Remove isc_task_purge() and isc_task_purgerange()
The isc_task_purge() and isc_task_purgerange() were now unused, so sweep
the task.c file.  Additionally remove unused ISC_EVENTATTR_NOPURGE event
attribute.

(cherry picked from commit c17eee034b)
2023-01-18 22:06:24 +01:00
Ondřej Surý
a7055b01af
Set quantum to infinity for the zone loading task
When we are loading the zones, set the quantum to UINT_MAX, which makes
task_run process all tasks at once.  After the zone loading is finished
the quantum will be dropped to 1 to not block server when we are loading
new zones after reconfiguration.

(cherry picked from commit 87c4c24cde)
2023-01-18 18:04:41 +01:00
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
Michał Kępień
1f554acee8 Update BIND version for release 2023-01-12 23:20:04 +01:00
Michał Kępień
703fefc88c Add a CHANGES marker 2023-01-12 23:20:04 +01:00
Michał Kępień
6515e69b9b Merge branch 'michal/prepare-documentation-for-bind-9.18.11' into 'security-v9_18'
Prepare documentation for BIND 9.18.11

See merge request isc-private/bind9!493
2023-01-12 22:18:44 +00:00
Michał Kępień
3b4a34ccb9 Remove reused CHANGES entry
Changes entry 6063 was added to the v9_18 branch (by commit
cb3990001f) without an associated
placeholder in the main branch.  The same entry number was subsequently
reused for a different change in the main branch (by commit
41870dccba).  To prevent confusion, remove
the entry from the v9_18 branch as the original code change whose
reversal is mentioned in entry 6063 was not accompanied by its own
CHANGES entry.
2023-01-12 22:11:14 +01:00
Michał Kępień
c901270670 Add release note for GL #3678 2023-01-12 22:11:14 +01:00
Michał Kępień
3fcc021294 Reorder release notes 2023-01-12 22:11:14 +01:00
Michał Kępień
828d5d51d0 Tweak and reword release notes 2023-01-12 22:11:14 +01:00
Michał Kępień
166523fd61 Prepare release notes for BIND 9.18.11 2023-01-12 22:11:14 +01:00
Michał Kępień
1bec7e09a3 Update documentation for GL #3212 2023-01-12 22:11:14 +01:00
Michał Kępień
04b41cd54e Fix a typo in the DNSSEC Guide 2023-01-12 22:11:14 +01:00
Michał Kępień
b04ab0648a Merge branch '3619-security-serve-stale-client-timeout-crash-v9_18' into 'security-v9_18'
[9.18] [CVE-2022-3924] Fix the serve-stale crash when recursive clients soft quota is reached

See merge request isc-private/bind9!478
2023-01-12 11:56:39 +00:00
Aram Sargsyan
601066e854 Add CHANGES and release notes for [GL #3619]
(cherry picked from commit d08a478b42)
2023-01-12 12:54:02 +01:00
Aram Sargsyan
a4fc5e5158 Cancel all fetch events in dns_resolver_cancelfetch()
Although 'dns_fetch_t' fetch can have two associated events, one for
each of 'DNS_EVENT_FETCHDONE' and 'DNS_EVENT_TRYSTALE' types, the
dns_resolver_cancelfetch() function is designed in a way that it
expects only one existing event, which it must cancel, and when it
happens so that 'stale-answer-client-timeout' is enabled and there
are two events, only one of them is canceled, and it results in an
assertion in dns_resolver_destroyfetch(), when it finds a dangling
event.

Change the logic of dns_resolver_cancelfetch() function so that it
cancels both the events (if they exist), and in the right order.

(cherry picked from commit ec2098ca35)
2023-01-12 12:54:02 +01:00
Michał Kępień
72db6402f3 Merge branch '3622-serve-stale-rrsig-fix-security-v9_18' into 'security-v9_18'
[9.18] [CVE-2022-3736] Properly handle stale RRSIG lookups

See merge request isc-private/bind9!485
2023-01-12 11:31:41 +00:00
Mark Andrews
645dd3fdf1 Add release note for [GL #3622]
(cherry picked from commit 42c42be9a9)
2023-01-12 12:27:28 +01:00
Mark Andrews
a4b760d8f6 Add CHANGES note for [GL #3622]
(cherry picked from commit 8ca018b5ec)
2023-01-12 12:27:28 +01:00
Mark Andrews
38323f3b9f Move the mapping of SIG and RRSIG to ANY
dns_db_findext() asserts if RRSIG is passed to it and
query_lookup_stale() failed to map RRSIG to ANY to prevent this.  To
avoid cases like this in the future, move the mapping of SIG and RRSIG
to ANY for qctx->type to qctx_init().

(cherry picked from commit 56eae06418)
2023-01-12 12:27:28 +01:00
Michał Kępień
35c40a8053 Merge branch '3523-confidential-update-quota-v9_18' into 'security-v9_18'
[9.18] [CVE-2022-3094] apply quotas to updates

See merge request isc-private/bind9!490
2023-01-12 11:08:07 +00:00
Evan Hunt
5a7d1d2d0c CHANGES and release notes for [GL #3523]
(cherry picked from commit 991de0aa76)
2023-01-12 12:02:35 +01:00
Evan Hunt
24a684db94 test failure conditions
verify that updates are refused when the client is disallowed by
allow-query, and update forwarding is refused when the client is
is disallowed by update-forwarding.

verify that "too many DNS UPDATEs" appears in the log file when too
many simultaneous updates are processing.

(cherry picked from commit b91339b80e)
2023-01-12 12:02:35 +01:00
Evan Hunt
65d70ebd20 move update ACL and update-policy checks before quota
check allow-update, update-policy, and allow-update-forwarding before
consuming quota slots, so that unauthorized clients can't fill the
quota.

(this moves the access check before the prerequisite check, which
violates the precise wording of RFC 2136. however, RFC co-author Paul
Vixie has stated that the RFC is mistaken on this point; it should have
said that access checking must happen *no later than* the completion of
prerequisite checks, not that it must happen exactly then.)

(cherry picked from commit 964f559edb)
2023-01-12 12:02:35 +01:00
Evan Hunt
3d2033bb89 add a configuration option for the update quota
add an "update-quota" option to configure the update quota.

(cherry picked from commit f57758a730)
2023-01-12 12:02:35 +01:00
Evan Hunt
9f1ebd25f6 add an update quota
limit the number of simultaneous DNS UPDATE events that can be
processed by adding a quota for update and update forwarding.
this quota currently, arbitrarily, defaults to 100.

also add a statistics counter to record when the update quota
has been exceeded.

(cherry picked from commit 7c47254a14)
2023-01-12 12:02:35 +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