]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
2 years agoMerge branch 'tkrizek-shutdown-rndc-hang' into 'main'
Tom Krizek [Tue, 4 Jul 2023 11:34:00 +0000 (11:34 +0000)] 
Merge branch 'tkrizek-shutdown-rndc-hang' into 'main'

Split shutdown test into separate test cases

See merge request isc-projects/bind9!8058

2 years agoMark the test_named_shutdown[rndc] test as xfail
Tom Krizek [Mon, 26 Jun 2023 13:22:32 +0000 (15:22 +0200)] 
Mark the test_named_shutdown[rndc] test as xfail

It is currently affected by #4060, making the unstable as it
occassionally fails.

2 years agoUse timeout for rndc status in shutdown test
Tom Krizek [Mon, 26 Jun 2023 13:19:35 +0000 (15:19 +0200)] 
Use timeout for rndc status in shutdown test

Pass 5 second timeout to the rndc status command(s) to avoid hitting the
hard 10 second timeout from subprocess.call, which would result in an
unwanted exception that would only mask the real issue: if the rndc
status times out in this test, it is likely due to the server not
stopping as it should.

2 years agoSplit shutdown test into separate test cases
Tom Krizek [Mon, 26 Jun 2023 13:18:45 +0000 (15:18 +0200)] 
Split shutdown test into separate test cases

The shutdown test attempts to shut down the server using two different
methods - rndc and sigterm. Use pytest.mark.parametrize to run these as
separate test cases for easier identification of failures.

3 years agoMerge branch 'each-lock-counter' into 'main'
Evan Hunt [Fri, 30 Jun 2023 06:52:18 +0000 (06:52 +0000)] 
Merge branch 'each-lock-counter' into 'main'

fix a TSAN bug in "rndc fetchlimit"

See merge request isc-projects/bind9!8067

3 years agofix a TSAN bug in "rndc fetchlimit"
Evan Hunt [Wed, 28 Jun 2023 21:52:53 +0000 (14:52 -0700)] 
fix a TSAN bug in "rndc fetchlimit"

fctx counters could be accessed without locking when
"rndc fetchlimit" is called; while this is probably harmless
in production, it triggered TSAN reports in system tests.

3 years agoMerge branch '4173-refactor-resume_qmin' into 'main'
Evan Hunt [Thu, 29 Jun 2023 17:34:20 +0000 (17:34 +0000)] 
Merge branch '4173-refactor-resume_qmin' into 'main'

minor refactoring of resume_qmin() for clarity

Closes #4173

See merge request isc-projects/bind9!8068

3 years agominor refactoring of resume_qmin() for clarity
Evan Hunt [Wed, 28 Jun 2023 16:28:01 +0000 (09:28 -0700)] 
minor refactoring of resume_qmin() for clarity

make the code flow clearer by enumerating the result codes that
are treated as success conditions for an intermediate minimized
query (ISC_R_SUCCESS, DNS_R_DELEGATION, DNS_R_NXRRSET, etc), rather
than just folding them all into the 'default' branch of a switch
statement.

3 years agoMerge branch '4169-add-google-site-verification-tag-to-the-toc-page' into 'main'
Michał Kępień [Thu, 29 Jun 2023 16:48:15 +0000 (16:48 +0000)] 
Merge branch '4169-add-google-site-verification-tag-to-the-toc-page' into 'main'

Add Google Site Verification tag to the TOC page

Closes #4169

See merge request isc-projects/bind9!8076

3 years agoAdd Google Site Verification tag to the TOC page
Michał Kępień [Thu, 29 Jun 2023 16:32:50 +0000 (18:32 +0200)] 
Add Google Site Verification tag to the TOC page

This should allow tracking HTTP 404 errors for Read the Docs using the
Google Search Console.

3 years agoMerge branch 'michal/update-release-and-cve-checklists' into 'main'
Michał Kępień [Thu, 29 Jun 2023 14:14:02 +0000 (14:14 +0000)] 
Merge branch 'michal/update-release-and-cve-checklists' into 'main'

Update release and CVE checklists

See merge request isc-projects/bind9!8074

3 years agoUpdate release and CVE checklists
Michał Kępień [Thu, 29 Jun 2023 14:08:35 +0000 (16:08 +0200)] 
Update release and CVE checklists

3 years agoMerge branch 'tkrizek-disable-delv-in-tsan' into 'main'
Tom Krizek [Thu, 29 Jun 2023 10:58:44 +0000 (10:58 +0000)] 
Merge branch 'tkrizek-disable-delv-in-tsan' into 'main'

Disable delv tests under TSAN

See merge request isc-projects/bind9!8062

3 years agoCheck for unset variables only after conf.sh is loaded
Tom Krizek [Mon, 26 Jun 2023 16:59:32 +0000 (18:59 +0200)] 
Check for unset variables only after conf.sh is loaded

Make the cds/setup.sh compatible with the workaround which relies on
testing the TSAN_OPTIONS variable which may not be set.

3 years agoFix checking for executables in shell conditions in tests
Tom Krizek [Mon, 26 Jun 2023 15:14:16 +0000 (17:14 +0200)] 
Fix checking for executables in shell conditions in tests

Surround the variables which are checked whether they're executable in
double quotes. Without them, empty paths won't be properly interpreted
as not executable.

3 years agoOnly use delv if available in mkeys test
Tom Krizek [Mon, 26 Jun 2023 14:46:27 +0000 (16:46 +0200)] 
Only use delv if available in mkeys test

Check that $DELV is an executable before using it in a test.

3 years agoDisable delv tests under TSAN
Tom Krizek [Mon, 26 Jun 2023 14:40:03 +0000 (16:40 +0200)] 
Disable delv tests under TSAN

Since delv can occasionally hang in system tests when running with TSAN
(see GL#4119), disable these tests as a workaround. Otherwise, the hung
delv process will just waste CI resources and prevent any meaningful
output from the rest of the test suite.

3 years agoMerge branch '4154-restore-the-ability-to-read-old-hmac-md5-key-pair-files' into...
Mark Andrews [Thu, 29 Jun 2023 00:20:07 +0000 (00:20 +0000)] 
Merge branch '4154-restore-the-ability-to-read-old-hmac-md5-key-pair-files' into 'main'

Resolve "Restore the ability to read old HMAC-MD5 key pair files."

Closes #4154

See merge request isc-projects/bind9!8041

3 years agoEmit deprecated warning for K* file pairs
Mark Andrews [Tue, 27 Jun 2023 04:24:40 +0000 (14:24 +1000)] 
Emit deprecated warning for K* file pairs

We try reading the same file using different methods so only
emit a warning if we successfully read the file.

3 years agoAdd release note entry for [GL #4154]
Mark Andrews [Mon, 19 Jun 2023 08:58:40 +0000 (18:58 +1000)] 
Add release note entry for [GL #4154]

3 years agoTest legacy HMAC key files with dig
Mark Andrews [Mon, 19 Jun 2023 07:49:05 +0000 (17:49 +1000)] 
Test legacy HMAC key files with dig

tsig-keygen is now used to generate key files for TSIG.  These have
a different format to those that were generated by dnssec-keygen.
Test that dig can still read these files.

3 years agoTest support with legacy HMAC K files with nsupdate
Mark Andrews [Mon, 19 Jun 2023 04:14:39 +0000 (14:14 +1000)] 
Test support with legacy HMAC K files with nsupdate

tsig-keygen generates key files that are different to those that
where generated by dnssec-keygen.  Check that nsupdate can still
read those old format files.

3 years agoRestore the ability to read legacy K*+157+* files
Mark Andrews [Mon, 19 Jun 2023 04:17:14 +0000 (14:17 +1000)] 
Restore the ability to read legacy K*+157+* files

The ability to read legacy HMAC-MD5 K* keyfile pairs using algorithm
number 157 was accidentally lost when the algorithm numbers were
consolidated into a single block, in commit
09f7e0607a34d90eae53f862954e98c31b5ae532.

The assumption was that these algorithm numbers were only known
internally, but they were also used in key files. But since HMAC-MD5
got renumbered from 157 to 160, legacy HMAC-MD5 key files no longer
work.

Move HMAC-MD5 back to 157 and GSSAPI back to 160.  Add exception for
GSSAPI to list_hmac_algorithms.

3 years agoMerge branch '3325-strict-qname-minimisation-should-check-for-cached-nodata-for-ns...
Ondřej Surý [Wed, 28 Jun 2023 10:29:57 +0000 (10:29 +0000)] 
Merge branch '3325-strict-qname-minimisation-should-check-for-cached-nodata-for-ns-name' into 'main'

Refactor QNAME minimization to use NS records and check for cached NODATA

Closes #3325, #3326, and #3331

See merge request isc-projects/bind9!6267

3 years agoAdd release note for [GL #3325]
Mark Andrews [Tue, 23 May 2023 14:03:02 +0000 (00:03 +1000)] 
Add release note for [GL #3325]

3 years agoAdd CHANGES note for [GL #3325]
Mark Andrews [Tue, 23 May 2023 14:00:09 +0000 (00:00 +1000)] 
Add CHANGES note for [GL #3325]

3 years agoIn rctx_answer return DNS_R_DELEGATION on NOFOLLOW
Mark Andrews [Fri, 19 May 2023 02:22:51 +0000 (12:22 +1000)] 
In rctx_answer return DNS_R_DELEGATION on NOFOLLOW

When DNS_FETCHOPT_NOFOLLOW is set DNS_R_DELEGATION needs to be
returned to restart the resolution process rather than converting
it to ISC_R_SUCCESS.

3 years agoSkip some QNAME mininisation queries if possible
Mark Andrews [Tue, 23 May 2023 04:02:29 +0000 (14:02 +1000)] 
Skip some QNAME mininisation queries if possible

If we know that the NS RRset for an intermediate label doesn't exist
on cache contents don't query using that name when looking for a
referral.

3 years agoUse NS rather than A records for qname-minimization relaxed
Mark Andrews [Tue, 23 May 2023 06:59:40 +0000 (16:59 +1000)] 
Use NS rather than A records for qname-minimization relaxed

Remove all references to DNS_FETCHOPT_QMIN_USE_A and adjust
the expected tests results in the qmin system test.

3 years agoMerge branch 'fanf-overflow-checks' into 'main'
Ondřej Surý [Tue, 27 Jun 2023 13:13:14 +0000 (13:13 +0000)] 
Merge branch 'fanf-overflow-checks' into 'main'

Prevent integer overflow when allocating arrays

Closes #4120, #4121, and #4122

See merge request isc-projects/bind9!8007

3 years agoCHANGES entry
Tony Finch [Tue, 6 Jun 2023 17:14:08 +0000 (18:14 +0100)] 
CHANGES entry

[cleanup] Ensure that the size calculation does not overflow
when allocating memory for an array.
[GL #4120] [GL #4121] [GL #4122]

3 years agoCheck for overflow when resizing a heap
Tony Finch [Tue, 6 Jun 2023 14:24:02 +0000 (15:24 +0100)] 
Check for overflow when resizing a heap

Ensure that the heap size calculations produce the correct answers,
and use `isc_mem_reget()` instead of calling `get` and `put`.

Closes #4122

3 years agoCheck for overflow in jemalloc_shim
Tony Finch [Tue, 6 Jun 2023 14:20:44 +0000 (15:20 +0100)] 
Check for overflow in jemalloc_shim

When compiled using a malloc that lacks an equivalent to sallocx(),
the jemalloc_shim adds a size prefix to each allocation. We must check
that this does not overflow.

Closes #4121

3 years agoUse isc_mem_callocate() in http_calloc()
Tony Finch [Tue, 6 Jun 2023 14:19:20 +0000 (15:19 +0100)] 
Use isc_mem_callocate() in http_calloc()

Closes #4120

3 years agoAdd isc_mem_callocate() for safer array allocation
Tony Finch [Tue, 6 Jun 2023 14:15:31 +0000 (15:15 +0100)] 
Add isc_mem_callocate() for safer array allocation

As well as clearing the fresh memory, `calloc()`-like functions must
ensure that the count and size do not overflow when multiplied.

Use `isc_mem_callocate()` in `isc__uv_calloc()`.

3 years agoAdd <isc/overflow.h> for checked mul, add, and sub
Tony Finch [Tue, 6 Jun 2023 14:11:13 +0000 (15:11 +0100)] 
Add <isc/overflow.h> for checked mul, add, and sub

The `ISC_OVERFLOW_XXX()` macros are usually wrappers around
`__builtin_xxx_overflow()`, with alternative implementations
for compilers that lack the builtins.

Replace the overflow checks in `isc/time.c` with the new macros.

3 years agoMerge branch 'ondrej-use-loop-mctx-in-dns_resolver' into 'main'
Ondřej Surý [Tue, 27 Jun 2023 09:31:00 +0000 (09:31 +0000)] 
Merge branch 'ondrej-use-loop-mctx-in-dns_resolver' into 'main'

Use per-loop memory contexts for dns_resolver child objects

See merge request isc-projects/bind9!8015

3 years agoAdd CHANGES note for [GL !8015]
Ondřej Surý [Tue, 27 Jun 2023 08:53:02 +0000 (10:53 +0200)] 
Add CHANGES note for [GL !8015]

3 years agoUse per-loop memory contexts for dns_resolver child objects
Ondřej Surý [Wed, 7 Jun 2023 13:23:08 +0000 (15:23 +0200)] 
Use per-loop memory contexts for dns_resolver child objects

The dns_resolver creates a lot of smaller objects (fetch context, fetch
counter, query, response, ...) and those are all loop-bound.
Previously, those objects were allocated from the a single resolver
context, which in turn increases contention between threads - remember
"dead by thousand atomic paper cuts".  Instead of using a single memory
context, use the per-loop memory contexts that are bound to a specific
loop and thus there's no contention between them when doing the memory
accounting.

3 years agoMerge branch '4163-dont-create-and-destroy-call_rcu-threads-by-hand' into 'main'
Ondřej Surý [Tue, 27 Jun 2023 06:00:32 +0000 (06:00 +0000)] 
Merge branch '4163-dont-create-and-destroy-call_rcu-threads-by-hand' into 'main'

Remove the explicit call_rcu thread creating and destruction

Closes #4163

See merge request isc-projects/bind9!8060

3 years agoAdd CHANGES note for [GL #4163]
Ondřej Surý [Mon, 26 Jun 2023 14:05:51 +0000 (16:05 +0200)] 
Add CHANGES note for [GL #4163]

3 years agoRemove the explicit call_rcu thread creating and destruction
Ondřej Surý [Mon, 26 Jun 2023 13:58:48 +0000 (15:58 +0200)] 
Remove the explicit call_rcu thread creating and destruction

The free_all_cpu_call_rcu_data() call can consume hundreds of
milliseconds on shutdown.  Don't try to be smart and let the RCU library
handle this internally.

3 years agoMerge branch '950-test-validation' into 'main'
Evan Hunt [Mon, 26 Jun 2023 21:59:06 +0000 (21:59 +0000)] 
Merge branch '950-test-validation' into 'main'

explicitly set dnssec-validation in system tests

Closes #950

See merge request isc-projects/bind9!7999

3 years agoexplicitly set dnssec-validation in system tests
Evan Hunt [Fri, 2 Jun 2023 00:14:49 +0000 (17:14 -0700)] 
explicitly set dnssec-validation in system tests

the default value of dnssec-validation is 'auto', which causes
a server to send a key refresh query to the root zone when starting
up. this is undesirable behavior in system tests, so this commit
sets dnssec-validation to either 'yes' or 'no' in all tests where
it had not previously been set.

this change had the mostly-harmless side effect of changing the cached
trust level of unvalidated answer data from 'answer' to 'authanswer',
which caused a few test cases in which dumped cache data was examined in
the serve-stale system test to fail. those test cases have now been
updated to expect 'authanswer'.

3 years agoMerge branch 'tkrizek-system-test-fixes' into 'main'
Tom Krizek [Mon, 26 Jun 2023 11:06:36 +0000 (11:06 +0000)] 
Merge branch 'tkrizek-system-test-fixes' into 'main'

Fix a couple of oversights in system tests

See merge request isc-projects/bind9!8051

3 years agoCheck for proper file size output in dnstap test
Tom Krizek [Thu, 22 Jun 2023 16:08:17 +0000 (18:08 +0200)] 
Check for proper file size output in dnstap test

Previously, the first check silently failed, as 454 is apparently (in my
local setup) the minimum output size for the dnstap output, rather than
470 which the test was expecting. Effectively, the check served as a 5
second sleep rather than waiting for the proper file size.

Additionally, check the expected file sizes and fail if expectations
aren't met.

3 years agoCheck for proper log message in kasp test
Tom Krizek [Thu, 22 Jun 2023 15:57:22 +0000 (17:57 +0200)] 
Check for proper log message in kasp test

The log message is supposed to contain the zone name which was
erroneously omitted, but didn't pop up during tests, since return code
was silently ignored.

Now it actually waits for the proper log message rather than being an
equivalent of 3 second sleep (which was also sufficient to make the test
pass, thus we detected no failure).

3 years agoMerge branch 'tkrizek-forward-test-echo-i' into 'main'
Tom Krizek [Thu, 22 Jun 2023 17:15:50 +0000 (17:15 +0000)] 
Merge branch 'tkrizek-forward-test-echo-i' into 'main'

Fix echo_i typo in forward test

See merge request isc-projects/bind9!8050

3 years agoFix echo_i typo in forward test
Tom Krizek [Thu, 22 Jun 2023 16:54:48 +0000 (18:54 +0200)] 
Fix echo_i typo in forward test

3 years agoMerge tag 'v9.19.14'
Michal Nowak [Wed, 21 Jun 2023 17:31:57 +0000 (19:31 +0200)] 
Merge tag 'v9.19.14'

BIND 9.19.14

3 years agoMerge branch '4044-placeholder' into 'main'
Arаm Sаrgsyаn [Tue, 20 Jun 2023 10:20:43 +0000 (10:20 +0000)] 
Merge branch '4044-placeholder' into 'main'

Add a CHANGES placeholder for [GL #4044]

See merge request isc-projects/bind9!8046

3 years agoAdd a CHANGES placeholder for [GL #4044]
Aram Sargsyan [Tue, 20 Jun 2023 10:13:12 +0000 (10:13 +0000)] 
Add a CHANGES placeholder for [GL #4044]

3 years agoMerge branch '2354-add-a-tool-for-reproducing-isc-spnego-bugs' into 'main'
Michał Kępień [Mon, 19 Jun 2023 09:06:56 +0000 (09:06 +0000)] 
Merge branch '2354-add-a-tool-for-reproducing-isc-spnego-bugs' into 'main'

[CVE-2020-8625] [CVE-2021-25216] Add a tool for reproducing ISC SPNEGO bugs

Closes #2354

See merge request isc-projects/bind9!7574

3 years agoAdd a tool for reproducing ISC SPNEGO bugs
Michał Kępień [Mon, 19 Jun 2023 07:20:03 +0000 (09:20 +0200)] 
Add a tool for reproducing ISC SPNEGO bugs

Extend the "tsiggss" system test with reproducers for CVE-2020-8625 and
CVE-2021-25216.

3 years agoMerge branch '4126-statschannel-connection-close-keepalive' into 'main'
Tony Finch [Thu, 15 Jun 2023 16:03:51 +0000 (16:03 +0000)] 
Merge branch '4126-statschannel-connection-close-keepalive' into 'main'

Improve statschannel HTTP Connection: header logic

See merge request isc-projects/bind9!8014

3 years agoImprove statschannel HTTP Connection: header protocol conformance
Tony Finch [Wed, 7 Jun 2023 14:47:47 +0000 (15:47 +0100)] 
Improve statschannel HTTP Connection: header protocol conformance

In HTTP/1.0 and HTTP/1.1, RFC 9112 section 9.6 says the last response
in a connection should include a `Connection: close` header, but the
statschannel server omitted it.

In an HTTP/1.0 response, the statschannel server can sometimes send a
`Connection: keep-alive` header when it is about to close the
connection. There are two ways:

If the first request on a connection is keep-alive and the second
request is not, then _both_ responses have `Connection: keep-alive`
but the connection is (correctly) closed after the second response.

If a single request contains

Connection: close
Connection: keep-alive

then RFC 9112 section 9.3 says the keep-alive header is ignored, but
the statschannel sends a spurious keep-alive in its response, though
it correctly closes the connection.

To fix these bugs, make it more clear that the `httpd->flags` are part
of the per-request-response state. The Connection: flags are now
described in terms of the effect they have instead of what causes them
to be set.

3 years agoMerge branch '4150-fix-entity-renumbering-in-parse_tsan.py' into 'main'
Michał Kępień [Thu, 15 Jun 2023 14:18:30 +0000 (14:18 +0000)] 
Merge branch '4150-fix-entity-renumbering-in-parse_tsan.py' into 'main'

Fix entity renumbering in util/parse_tsan.py

Closes #4150

See merge request isc-projects/bind9!8037

3 years agoFix entity renumbering in util/parse_tsan.py
Michał Kępień [Thu, 15 Jun 2023 14:17:14 +0000 (16:17 +0200)] 
Fix entity renumbering in util/parse_tsan.py

util/parse_tsan.py builds tables of mutexes, threads, and pointers it
finds in the TSAN report provided to it as a command-line argument and
then replaces all mentions of each of these entities so that they are
numbered sequentially in the processed report.  For example, this line:

    Cycle in lock order graph: M0 (...) => M5 (...) => M9 (...) => M0

is expected to become:

    Cycle in lock order graph: M1 (...) => M2 (...) => M3 (...) => M1

Problems arise when the gaps between mutex/thread identifiers present on
a single line are smaller than the total number of mutexes/threads found
by the script so far.  For example, the following line:

    Cycle in lock order graph: M0 (...) => M1 (...) => M2 (...) => M0

first gets turned into:

    Cycle in lock order graph: M1 (...) => M1 (...) => M2 (...) => M1

and then into:

    Cycle in lock order graph: M2 (...) => M2 (...) => M2 (...) => M2

In other words, lines like this become garbled due to information loss.

The problem stems from the fact that the numbering scheme the script
uses for identifying mutexes and threads is exactly the same as the one
used by TSAN itself.  Update util/parse_tsan.py so that it uses
zero-padded numbers instead, making the "overlapping" demonstrated above
impossible.

3 years agoMerge branch '4149-make-isc_result-tables-more-compact' into 'main'
Ondřej Surý [Thu, 15 Jun 2023 13:46:52 +0000 (13:46 +0000)] 
Merge branch '4149-make-isc_result-tables-more-compact' into 'main'

Make isc_result tables smaller

Closes #4149

See merge request isc-projects/bind9!8034

3 years agoAdd CHANGES note for [GL #4149]
Ondřej Surý [Thu, 15 Jun 2023 08:28:47 +0000 (10:28 +0200)] 
Add CHANGES note for [GL #4149]

3 years agoMake isc_result tables smaller
Ondřej Surý [Thu, 15 Jun 2023 08:24:21 +0000 (10:24 +0200)] 
Make isc_result tables smaller

The isc_result_t enum was to sparse when each library code would skip to
next << 16 as a base.  Remove the huge holes in the isc_result_t enum to
make the isc_result tables more compact.

This change required a rewrite how we map dns_rcode_t to isc_result_t
and back, so we don't ever return neither isc_result_t value nor
dns_rcode_t out of defined range.

3 years agoRefactor how we map isc_result_t <-> dns_rcode_t
Ondřej Surý [Thu, 15 Jun 2023 08:24:21 +0000 (10:24 +0200)] 
Refactor how we map isc_result_t <-> dns_rcode_t

The mapping functions between isc_result_t and dns_rcode_t could return
both isc_result_t values not defined in the header and dns_rcode_t
values not defined in the header because it blindly maps anything
withing full 12-bits defined for RCODEs to isc_result_t and back.

Refactor the dns_result_{from,to}rcode() functions to always return
valid isc_result_t and dns_rcode_t values by explicitly mapping the
values to each other and returning DNS_R_SERVFAIL (dns_rcode_servfail)
when encountering value out of the defined range.

3 years agoMerge branch 'tkrizek/ci-system-clang-tsan-disallow-failure' into 'main'
Tom Krizek [Thu, 15 Jun 2023 11:09:48 +0000 (11:09 +0000)] 
Merge branch 'tkrizek/ci-system-clang-tsan-disallow-failure' into 'main'

Mark CI failure of system:clang:tsan as an error again

See merge request isc-projects/bind9!8035

3 years agoMark CI failure of system:clang:tsan as an error again
Tom Krizek [Thu, 15 Jun 2023 08:48:21 +0000 (10:48 +0200)] 
Mark CI failure of system:clang:tsan as an error again

Both the issues causing frequent failures have been resolved. The job
seems to have stabilized and there's no longer a need to mark the
failure as a mere warnings.

3 years agoMerge branch '4132-catz-data-race-in-db.c' into 'main'
Arаm Sаrgsyаn [Thu, 15 Jun 2023 09:50:15 +0000 (09:50 +0000)] 
Merge branch '4132-catz-data-race-in-db.c' into 'main'

Fix a data race between the dns_zone and dns_catz modules

Closes #4132

See merge request isc-projects/bind9!8031

3 years agoAdd a CHANGES note for [GL #4132]
Aram Sargsyan [Wed, 14 Jun 2023 09:02:51 +0000 (09:02 +0000)] 
Add a CHANGES note for [GL #4132]

3 years agoFix a data race between the dns_zone and dns_catz modules
Aram Sargsyan [Fri, 9 Jun 2023 07:13:27 +0000 (07:13 +0000)] 
Fix a data race between the dns_zone and dns_catz modules

The dns_zone_catz_enable_db() and dns_zone_catz_disable_db()
functions can race with similar operations in the catz module
because there is no synchronization between the threads.

Add catz functions which use the view's catalog zones' lock
when registering/unregistering the database update notify callback,
and use those functions in the dns_zone module, instead of doing it
directly.

3 years agoMerge branch '4134-zonefile-erofs' into 'main'
Tony Finch [Wed, 14 Jun 2023 12:44:54 +0000 (12:44 +0000)] 
Merge branch '4134-zonefile-erofs' into 'main'

Translate POSIX errorcode EROFS to ISC_R_NOPERM

Closes #4134

See merge request isc-projects/bind9!8017

3 years agoCHANGES note for [GL #4134]
Tony Finch [Fri, 9 Jun 2023 07:22:47 +0000 (08:22 +0100)] 
CHANGES note for [GL #4134]

[cleanup] Report "permission denied" instead of "unexpected error"
when trying to update a zone file is on a read-only file
system. Thanks to Midnight Veil. [GL #4134]

3 years agoTranslate POSIX errorcode EROFS to ISC_R_NOPERM
Midnight Veil [Thu, 8 Jun 2023 07:11:37 +0000 (17:11 +1000)] 
Translate POSIX errorcode EROFS to ISC_R_NOPERM

Report "permission denied" instead of "unexpected error"
when trying to update a zone file on a read-only file system.

3 years agoMerge branch '4021-tsan-error-view-adb-detached-too-early' into 'main'
Mark Andrews [Wed, 14 Jun 2023 10:36:08 +0000 (10:36 +0000)] 
Merge branch '4021-tsan-error-view-adb-detached-too-early' into 'main'

Resolve "TSAN error: view->adb detached too early."

Closes #4021

See merge request isc-projects/bind9!8016

3 years agoAdd CHANGES note for [GL #4021]
Mark Andrews [Mon, 12 Jun 2023 23:55:22 +0000 (09:55 +1000)] 
Add CHANGES note for [GL #4021]

3 years agoUse RCU for view->adb access
Mark Andrews [Thu, 8 Jun 2023 06:58:45 +0000 (16:58 +1000)] 
Use RCU for view->adb access

view->adb may be referenced while the view is shutting down as the
zone uses a weak reference to the view and examines view->adb but
dns_view_detach call dns_adb_detach to clear view->adb.

3 years agoMerge branch 'each-tsig-refactoring' into 'main'
Evan Hunt [Wed, 14 Jun 2023 08:14:47 +0000 (08:14 +0000)] 
Merge branch 'each-tsig-refactoring' into 'main'

TSIG/TKEY refactoring

See merge request isc-projects/bind9!7828

3 years agoimprove code flow
Evan Hunt [Fri, 14 Apr 2023 00:46:49 +0000 (17:46 -0700)] 
improve code flow

the code in dns_tkey_processquery() was unnecessarily hard to follow.

3 years agominor tkey-related fixups
Evan Hunt [Thu, 13 Apr 2023 08:22:09 +0000 (01:22 -0700)] 
minor tkey-related fixups

- style fixes and general tidying-up in tkey.c
- remove the unused 'intoken' parameter from dns_tkey_buildgssquery()
- remove an unnecessary call to dns_tkeyctx_create() in ns_server_create()
  (the TKEY context that was created there would soon be destroyed and
  another one created when the configuration was loaded).

3 years agorename 'ret' to 'result'
Evan Hunt [Thu, 13 Apr 2023 16:25:13 +0000 (09:25 -0700)] 
rename 'ret' to 'result'

purely to assuage my desire for consistency across modules,
result variables have been renamed to 'result' as they are
throughout most of BIND. there are no other changes.

3 years agoconvert TSIG keyring storage from RBT to hash table
Evan Hunt [Wed, 12 Apr 2023 07:14:04 +0000 (00:14 -0700)] 
convert TSIG keyring storage from RBT to hash table

since it is not necessary to find partial matches when looking
up names in a TSIG keyring, we can use a hash table instead of
an RBT to store them.

the tsigkey object now stores the key name as a dns_fixedname
rather than allocating memory for it.

the `name` parameter to dns_tsigkeyring_add() has been removed;
it was unneeded since the tsigkey object already contains a copy
of the name.

the opportunistic cleanup_ring() function has been removed;
it was only slowing down lookups.

3 years agoremove dns__tsig_algallocated()
Evan Hunt [Wed, 12 Apr 2023 07:17:30 +0000 (00:17 -0700)] 
remove dns__tsig_algallocated()

this function was no longer needed, because the algorithm name is no
longer copied into the tsigkey object by dns_tsigkey_createfromkey();
it's always just a pointer to a statically defined name.

3 years agoget_key_struct() can no longer fail
Evan Hunt [Wed, 12 Apr 2023 06:43:19 +0000 (23:43 -0700)] 
get_key_struct() can no longer fail

remove checks for NULL return values.

3 years agouse algorithm number instead of name to create TSIG keys
Evan Hunt [Wed, 12 Apr 2023 02:01:31 +0000 (19:01 -0700)] 
use algorithm number instead of name to create TSIG keys

the prior practice of passing a dns_name containing the
expanded name of an algorithm to dns_tsigkey_create() and
dns_tsigkey_createfromkey() is unnecessarily cumbersome;
we can now pass the algorithm number instead.

3 years agofurther dns_tsigkey API tweaks
Evan Hunt [Tue, 11 Apr 2023 23:10:07 +0000 (16:10 -0700)] 
further dns_tsigkey API tweaks

- remove the 'ring' parameter from dns_tsigkey_createfromkey(),
  and use dns_tsigkeyring_add() to add key objects to a keyring instead.
- add a magic number to dns_tsigkeyring_t
- change dns_tsigkeyring_dumpanddetach() to dns_tsigkeyring_dump();
  we now call dns_tsigkeyring_detach() separately.
- remove 'maxgenerated' from dns_tsigkeyring_t since it never changes.

3 years agoclean up reference counting in dns_tsigkey
Evan Hunt [Tue, 11 Apr 2023 19:56:57 +0000 (12:56 -0700)] 
clean up reference counting in dns_tsigkey

the reference counter in dns_tsigkey was being computed differently
depending on whether there was a keyring or not. this is prone to
error.

3 years agouse ISC_REFCOUNT_IMPL for dns_tsigkey and dns_tsigkeyring
Evan Hunt [Tue, 11 Apr 2023 18:35:01 +0000 (11:35 -0700)] 
use ISC_REFCOUNT_IMPL for dns_tsigkey and dns_tsigkeyring

use the ISC_REFCOUNT attach/detach implementation in dns/tsig.c
so that detailed tracing can be used during refactoring.

dns_tsig_keyring_t has been renamed dns_tsigkeyring_t so the type
and the attach/detach function names will match.

3 years agominor tsig.c cleanups
Evan Hunt [Tue, 11 Apr 2023 06:46:10 +0000 (23:46 -0700)] 
minor tsig.c cleanups

- style cleanups.
- simplify the function parameters to dns_tsigkey_create():
  + remove 'restored' and 'generated', they're only ever set to false.
  + remove 'creator' because it's only ever set to NULL.
  + remove 'inception' and 'expiry' because they're only ever set to
    (0, 0) or (now, now), and either way, this means "never expire".
  + remove 'ring' because we can just use dns_tsigkeyring_add() instead.
- rename dns_keyring_restore() to dns_tsigkeyring_restore() to match the
  rest of the functions operating on dns_tsigkeyring objects.

3 years agoMerge branch '4141-find-zone_keys' into 'main'
Matthijs Mekking [Wed, 14 Jun 2023 08:05:55 +0000 (08:05 +0000)] 
Merge branch '4141-find-zone_keys' into 'main'

Update find_zone_keys for dynamic update

Closes #4141

See merge request isc-projects/bind9!8029

3 years agoUpdate findzonekeys function name in log message
Matthijs Mekking [Wed, 14 Jun 2023 07:05:31 +0000 (09:05 +0200)] 
Update findzonekeys function name in log message

The "dns_dnssec_findzonekeys2" log message is a leftover from when that
was the name of the function. Rename to match the current name of the
function.

3 years agoAdd dynamic update prepub and doubleksk test case
Matthijs Mekking [Tue, 13 Jun 2023 15:45:08 +0000 (17:45 +0200)] 
Add dynamic update prepub and doubleksk test case

Add two test cases for zones that use auto-dnssec, but not
inline-signing, and make sure that the change for find_zone_keys()
do not affect introducing a new key that is intended for signing.

See note https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/7638#note_355944

3 years agoAdd CHANGES for find_zone_keys() function update
Matthijs Mekking [Thu, 2 Mar 2023 10:04:59 +0000 (11:04 +0100)] 
Add CHANGES for find_zone_keys() function update

Probably a useful point in history.

3 years agoUpdate find_zone_keys for dynamic update
Matthijs Mekking [Tue, 4 Oct 2022 13:54:30 +0000 (15:54 +0200)] 
Update find_zone_keys for dynamic update

The find_zone_keys() function was not working properly for
inline-signed zones. It only worked if the DNSKEY records were also
published in the unsigned version of the zone. But this is not the
case when you use dnssec-policy, the DNSKEY records will only occur
in the signed version of the zone. Therefor, when looking for keys
to sign the zone, only the newly added keys in the dynamic update
were found (which could be zero), ignoring existing keys.

Also, if a DNSKEY was added, it would try to sign the zone with just
this new key, and this would only work if the key files for that key
were imported into the key-directory.

This is a design error, because the goal is to sign the zone with the
keys for which we actually have key files for. So instead of looking
for DNSKEY records to then search for the matching key files, call
dns_dnssec_findmatchingkeys() which just looks for the keys we have
on disk for the given zone. It will also set the correct DNSSEC
signing hints.

3 years agoAdd log check in multisigner system test
Matthijs Mekking [Tue, 13 Jun 2023 13:59:53 +0000 (15:59 +0200)] 
Add log check in multisigner system test

When we add DNSKEY records via dynamic update, this should no longer
trigger signing the zone with these keys. This currently happens when
'find_zone_keys()' looks up the keys by inspecting the DNSKEY RRset,
then attempting to read the corresponding key files.

Add checks that inspect the logs whether an attempt to read the key
files for the newly added keys was done (and failed because these files
are not available).

3 years agoMerge branch 'tkrizek/remove-trailing-whitespace' into 'main'
Tom Krizek [Tue, 13 Jun 2023 13:31:32 +0000 (13:31 +0000)] 
Merge branch 'tkrizek/remove-trailing-whitespace' into 'main'

Remove trailing whitespace from all text files

See merge request isc-projects/bind9!8012

3 years agoAdd utility script to detect trailing whitespace
Tom Krizek [Tue, 13 Jun 2023 08:26:26 +0000 (10:26 +0200)] 
Add utility script to detect trailing whitespace

Run the script in CI as well to ensure we don't accidentally add
trailing whitespace again.

3 years agoIgnore trailing whitespace removal commit in git blame
Tom Krizek [Wed, 7 Jun 2023 14:30:06 +0000 (16:30 +0200)] 
Ignore trailing whitespace removal commit in git blame

3 years agoRemove trailing whitespace from all text files
Tom Krizek [Wed, 7 Jun 2023 14:00:00 +0000 (16:00 +0200)] 
Remove trailing whitespace from all text files

I've used the following command to remove the trailing whitespace for
all tracked text files:

git grep -Il '' | xargs sed -i 's/[ \t]*$//'

3 years agoMerge branch '4136-catz-db-update-notify-bug' into 'main'
Arаm Sаrgsyаn [Tue, 13 Jun 2023 13:01:05 +0000 (13:01 +0000)] 
Merge branch '4136-catz-db-update-notify-bug' into 'main'

Fix catz db update callback registration logic error

Closes #4136

See merge request isc-projects/bind9!8025

3 years agoAdd a CHANGES note for [GL #4136]
Aram Sargsyan [Tue, 13 Jun 2023 10:52:05 +0000 (10:52 +0000)] 
Add a CHANGES note for [GL #4136]

3 years agoFix catz db update callback registration logic error
Aram Sargsyan [Tue, 13 Jun 2023 09:58:29 +0000 (09:58 +0000)] 
Fix catz db update callback registration logic error

When a catalog zone is updated using AXFR, the zone database is changed,
so it is required to unregister the update notification callback from
the old database, and register it for the new one.

Currently, here is the order of the steps happening in such scenario:

1. The zone.c:zone_startload() function registers the notify callback
   on the new database using dns_zone_catz_enable_db()
2. The callback, when called, notices that the new 'db' is different
   than 'catz->db', and unregisters the old callback for 'catz->db',
   marks that it's unregistered by setting 'catz->db_registered' to
   false, then it schedules an update if it isn't already scheduled.
3. The offloaded update process, after completing its job, notices that
   'catz->db_registered' is false, and (re)registers the update callback
   for the current database it is working on. There is no harm here even
   if it was registered also on step 1, and we can't skip it, because
   this function can also be called "artificially" during a
   reconfiguration, and in that case the registration step is required
   here.

A problem arises when before step 1 an update process was already
in a running state, operating on the old database, and finishing its
work only after step 2. As described in step 3, dns__catz_update_cb()
notices that 'catz->db_registered' is false and registers the callback
on the current database it is working on, which, at that state, is
already obsolete and unused by the zone. When it detaches the database,
the function which is responsible for its cleanup (e.g. free_rbtdb())
asserts because there is a registered update notify callback there.

To fix the problem, instead of delaying the (re)registration to step 3,
make sure that the new callback is registered and 'catz->db_registered'
is accordingly marked on step 2.

3 years agoMerge branch '4117-serve-stale-check' into 'main'
Tom Krizek [Tue, 13 Jun 2023 12:10:25 +0000 (12:10 +0000)] 
Merge branch '4117-serve-stale-check' into 'main'

Avoid false positive in serve-stale system test check

Closes #4117

See merge request isc-projects/bind9!8026

3 years agoAvoid false positive in serve-stale system test check
Tom Krizek [Tue, 13 Jun 2023 08:52:01 +0000 (10:52 +0200)] 
Avoid false positive in serve-stale system test check

The purpose of the check is to verify the server has survived the
previous barrage of queries. This is done by sending a query and
checking we get a NOERROR response back.

Previously, that query could've been affected by a servfail cache - the
server would return a SERVFAIL answer, thus failing the check, despite
being up and running. Use version.bind txt ch query to avoid the
interference of servfail cache.