Commit Graph
35052 Commits
Author SHA1 Message Date
Ondřej Surý 7fef8e77d6 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-19 11:28:10 +01:00
Ondřej Surý 617186d514 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-19 11:28:10 +01:00
Ondřej Surý 76859344fe Repair isc_task_purgeevent()
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.

(cherry picked from commit 17aed2f895)
2023-01-19 11:28:10 +01:00
Ondřej Surý 6efd8d5faf Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach-lock-order-inversion-v9_16' into 'v9_16'
[9.16] Detach the zone views outside of the zone lock

See merge request isc-projects/bind9!7409
2023-01-19 10:15:40 +00:00
Ondřej Surý 4b222f154b Detach the zone views outside of the zone lock
Detaching the views in the zone_shutdown() could lead to
lock-order-inversion between adb->namelocks[bucket], adb->lock,
view->lock and zone->lock.  Detach the views outside of the section that
zone-locked.

(cherry picked from commit 978a0ef84c)
2023-01-19 10:21:27 +01:00
Ondřej Surý 93082bd010 Merge branch 'ondrej/replace-lgtm-with-codeql-add-python-ply-v9_16' into 'v9_16'
[9.16] Add python3-ply for ./configure to succeed on BIND 9.16 branch

See merge request isc-projects/bind9!7407
2023-01-19 09:17:40 +00:00
Ondřej Surý 60d43925b3 Add python3-ply to GitHub CodeQL configuration
BIND 9.16 needs Python and PLY packages for configure to succeed.
Unless we want to tweak the build script to exclude python, we need to
add python3-ply package to the CodeQL configuration.

(cherry picked from commit 0622d11366)
2023-01-19 10:12:12 +01:00
Ondřej Surý c6bb1c93a2 Merge branch 'ondrej/replace-lgtm-with-codeql-v9_16' into 'v9_16'
[9.16] Add CodeQL GitHub Action

See merge request isc-projects/bind9!7404
2023-01-19 08:46:54 +00:00
Ondřej Surý dfe2f2120a Add CodeQL GitHub Action
Replace the decommissioned LGTM service with CodeQL GitHub action.

(cherry picked from commit 77abe612a1)
2023-01-19 08:46:50 +00:00
Ondřej Surý ef27382794 Merge branch '3795-speed-up-EVP_DigestInit_ex-v9_16' into 'v9_16'
[9.16] Avoid implicit algorithm fetch for OpenSSL EVP_MD family

See merge request isc-projects/bind9!7399
2023-01-19 08:33:40 +00:00
Ondřej Surý 74b74dacd2 Add CHANGES and release note for [GL #3795]
(cherry picked from commit 401294cf60)
2023-01-18 23:26:40 +01:00
Ondřej Surý 49af3a23b9 Use OpenSSL 1.x SHA_CTX API in isc_iterated_hash()
Instead of going through another layer, use OpenSSL SHA1 API directly
in the isc_iterated_hash() implementation.

(cherry picked from commit 25db8d0103)
2023-01-18 23:26:40 +01:00
Ondřej Surý abb367615c Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach-v9_16' into 'v9_16'
[9.16] Detach the views in zone_shutdown(), not in zone_free()

See merge request isc-projects/bind9!7389
2023-01-17 22:23:09 +00:00
Ondřej Surý 1177891f9c Add CHANGES and release note for [GL #3801]
(cherry picked from commit b049e329ef)
2023-01-17 22:49:14 +01:00
Ondřej Surý 235ce6c888 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:48:37 +01:00
Ondřej Surý cb083876c1 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:48:37 +01:00
Tom Krizek 55545b8377 Merge branch '3804-fix-feature-detection-in-pytests-v9_16' into 'v9_16'
[9.16] Fix feature detection for pytest markers in tests

See merge request isc-projects/bind9!7384
2023-01-17 14:14:49 +00:00
Tom Krizek 7139e297b2 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:49:38 +01:00
Ondřej Surý ff48b58a1d Merge branch 'cherry-pick-d7bcdf8b-2' into 'v9_16'
[9.16] Merge branch 'feature/main/zt-rwlock.h' into 'main'

See merge request isc-projects/bind9!7378
2023-01-16 11:10:11 +00:00
Ondřej Surý 606fc6d4aa 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:08:43 +00:00
Michał Kępień 4a30ced1cb Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.16.38' into 'v9_16'
Set up version and release notes for BIND 9.16.38

See merge request isc-projects/bind9!7364
2023-01-13 14:47:09 +00:00
Michał Kępień 7db230d6bf Set up release notes for BIND 9.16.38 2023-01-13 15:41:30 +01:00
Michał Kępień 265dbeb3f2 Update BIND version to 9.16.38-dev 2023-01-13 15:41:30 +01:00
Ondřej Surý afc49c62e0 Merge branch '3744-catz-small-update-to-large-catz-causes-cpu-spike' into 'v9_16'
[9.16] Increase catalog zone entries hash table's bits size

See merge request isc-projects/bind9!7357
2023-01-11 18:06:11 +00:00
Aram Sargsyan 60dece8277 Increase catalog zone entries hash table's bits size
The hash table implementation in the current branch does not
support automatic resize operation, so the initial value of
the table should be chosen carefully.

Catalog zones entries hash table's size is currently only 4 bits,
which is very low for a catalog zone with thousands of entries,
and causes CPU consumption spikes when working with the hash
table to add/delete/search entries.

Use 16 bits instead, which should make working with big catalog
zones much faster at the expense of slightly higher memory usage,
i.e. 512 KiB for a 64-bit system for each catalog zone.
2023-01-11 17:26:26 +00:00
Arаm Sаrgsyаn 5823dacba8 Merge branch 'aram/dns_fwdtable_addfwd-cleanup-bugfix-v9_16' into 'v9_16'
[9.16] Fix dns_fwdtable_addfwd() error path cleanup bug

See merge request isc-projects/bind9!7353
2023-01-11 14:15:20 +00:00
Aram Sargsyan 144135415b 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:00 +00:00
Aram Sargsyan 1950629ffa 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:00 +00:00
Arаm Sаrgsyаn 56281e968d Merge branch '3768-dns_zonemgr-use-after-free-v9_16' into 'v9_16'
[9.16] Fix a use-after-free bug in dns_zonemgr_releasezone()

See merge request isc-projects/bind9!7352
2023-01-11 13:01:40 +00:00
Aram Sargsyan 1cab382d17 Add a CHANGES note for [GL #3768]
(cherry picked from commit d50cb1d45d)
2023-01-11 12:17:38 +00:00
Aram Sargsyan 272afcd999 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:17:27 +00:00
Evan Hunt f57d21c01a Merge branch '3773-remove-dscp-v9_16' into 'v9_16'
[9.16] deprecate dscp configuration

See merge request isc-projects/bind9!7337
2023-01-10 19:46:39 +00:00
Evan Hunt 288e7332ed CHANGES and release note for [GL #3773] 2023-01-10 11:16:18 -08:00
Matthijs MekkingandEvan Hunt 0656395f25 Test deprecate dscp configuration
Add 'dscp' token and 'option' to deprecated.conf. It should trigger warnings
(except when deprecation warnings are being ignored).
2023-01-10 11:16:18 -08:00
Evan Hunt 0b40df8f8a deprecate dscp configuration
This commit deprecates the "dscp" configuration option and "dscp"
parameters to source-address configuration options (query-source,
transfer-source, etc.

(Note that the DSCP feature has not been fully operational since
the network manager was introduced in 9.16.0; outgoing DSCP values
can be configured, but incoming DSCP values are not detected.)
2023-01-10 11:16:18 -08:00
Michal Nowak e929b3b54a Merge branch 'mnowak/abort-on-ubsan-errors-v9_16' into 'v9_16'
[9.16] Abort on UBSAN errors

See merge request isc-projects/bind9!7328
2023-01-10 10:23:28 +00:00
Michal Nowak b276e76130 Abort on UBSAN errors
Previously, UBSAN errors might slip undetected.

(cherry picked from commit 1451bb7390)
2023-01-10 10:17:37 +01:00
Mark Andrews 7c51096f8b Merge branch '3787-siphash-c-105-26-runtime-error-applying-zero-offset-to-null-pointer-v9_16' into 'v9_16'
[9.16] Accept 'in=NULL' with 'inlen=0' in isc_{half}siphash24

See merge request isc-projects/bind9!7342

Backport of MR !7339
2023-01-10 08:18:01 +00:00
Mark Andrews f1c08fe93b 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:27 +11:00
Mark Andrews cc11456017 Merge branch '3788-rbt-c-187-19-runtime-error-applying-zero-offset-to-null-pointer' into 'v9_16'
Resolve "rbt.c:187:19: runtime error: applying zero offset to null pointer"

See merge request isc-projects/bind9!7340
2023-01-10 07:19:39 +00:00
Mark Andrews 2a9300a3bc Don't perform arithmetic on NULL pointers
When node is NULL when calling getparent() et al. they return NULL
but performing arithmetic on the NULL pointer is undefined.  Check
if 'node' or 'header' is NULL and skip the adjustment.
2023-01-10 17:45:51 +11:00
Matthijs Mekking 802f700d5a Merge branch '3678-serve-stale-servfailing-unexpectedly-v9_16' into 'v9_16'
[9.16] Add serve-stale CNAME check with stale-answer-client-timeout off

See merge request isc-projects/bind9!7311
2023-01-09 13:31:24 +00:00
Michał KępieńandMatthijs Mekking ba1306bfb4 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 13:57:44 +01:00
Aram SargsyanandMatthijs Mekking 36a439b91e Add a CHANGES note for [GL #3678]
(cherry picked from commit 40dee61a1e)
2023-01-09 13:57:44 +01:00
Matthijs Mekking 2696267b1f Consider non-stale data when in serve-stale mode
With 'stale-answer-enable yes;' and 'stale-answer-client-timeout off;',
consider the following situation:

A CNAME record and its target record are in the cache, then the CNAME
record expires, but the target record is still valid.

When a new query for the CNAME record arrives, and the query fails,
the stale record is used, and then the query "restarts" to follow
the CNAME target. The problem is that the query's multiple stale
options (like DNS_DBFIND_STALEOK) are not reset, so 'query_lookup()'
treats the restarted query as a lookup following a failed lookup,
and returns a SERVFAIL answer when there is no stale data found in the
cache, even if there is valid non-stale data there available.

With this change, query_lookup() now considers non-stale data in the
cache in the first place, and returns it if it is available.

(cherry picked from commit 91a1a8efc5)
2023-01-09 13:57:43 +01:00
Aram SargsyanandMatthijs Mekking 869abb768b Add serve-stale CNAME check with stale-answer-client-timeout off
Prime the cache with the following records:

    shortttl.cname.example.	1	IN	CNAME	longttl.target.example.
    longttl.target.example.	600	IN	A	10.53.0.2

Wait for the CNAME record to expire, disable the authoritative server,
and query 'shortttl.cname.example' again, expecting a stale answer.

(cherry picked from commit 537187bf2f)
2023-01-09 13:57:43 +01:00
Tony Finch d14a22b3d9 Merge branch '3745-delzone-catz-v9_16' into 'v9_16'
[9.16] Don't crash when rndc delzone encounters a catz member

See merge request isc-projects/bind9!7298
2023-01-04 19:32:40 +00:00
Tony FinchandTony Finch 01788b8852 Don't crash when rndc delzone encounters a catz member
Try to remove the zone from the NZF config only if it was
dynamically added but not by a catalog zone.

(cherry picked from commit 9fa20d6f6c)
2023-01-04 18:04:53 +00:00
Michał Kępień e255032a67 Merge branch 'michal/update-copyright-year-to-2023-v9_16' into 'v9_16'
[9.16] Update copyright year to 2023

See merge request isc-projects/bind9!7284
2023-01-02 13:30:04 +00:00
Michał Kępień f7bd3bd2b6 Update copyright year to 2023
(cherry picked from commit 1a5d707f52)
2023-01-02 14:24:23 +01:00