]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
5 years agoMerge branch '2445-nsec3-iterations-resolver' into 'main'
Matthijs Mekking [Thu, 29 Apr 2021 13:09:30 +0000 (13:09 +0000)] 
Merge branch '2445-nsec3-iterations-resolver' into 'main'

Resolve "NSEC3 iterations"

Closes #2445

See merge request isc-projects/bind9!4957

5 years agoAdd release note for [GL #2445]
Mark Andrews [Wed, 21 Apr 2021 03:28:16 +0000 (13:28 +1000)] 
Add release note for [GL #2445]

5 years agoAdd CHANGES for [GL #2445]
Mark Andrews [Wed, 21 Apr 2021 03:27:23 +0000 (13:27 +1000)] 
Add CHANGES for [GL #2445]

5 years agoCheck insecure responses returned with too many NSEC3 iterations
Mark Andrews [Wed, 17 Feb 2021 05:33:49 +0000 (16:33 +1100)] 
Check insecure responses returned with too many NSEC3 iterations

5 years agoMark DNSSEC responses with NSEC3 records that exceed 150 as insecure
Mark Andrews [Wed, 17 Feb 2021 05:33:49 +0000 (16:33 +1100)] 
Mark DNSSEC responses with NSEC3 records that exceed 150 as insecure

5 years agoMerge branch '2372-add-hyperlink-to-gl-xxxx-labels-in-documentation' into 'main'
Michał Kępień [Thu, 29 Apr 2021 11:35:33 +0000 (11:35 +0000)] 
Merge branch '2372-add-hyperlink-to-gl-xxxx-labels-in-documentation' into 'main'

Resolve "Add hyperlink to [GL XXXX] labels in documentation"

Closes #2372

See merge request isc-projects/bind9!4563

5 years agoUpdate Danger check for GitLab references
Michal Nowak [Thu, 29 Apr 2021 11:24:21 +0000 (13:24 +0200)] 
Update Danger check for GitLab references

Release notes now employ a custom :gl: Sphinx role for linking to GitLab
issues/MRs.  Tweak the relevant Danger checks to account for that.

5 years agoAdd a Sphinx role for linking GitLab issues/MRs
Michał Kępień [Thu, 29 Apr 2021 11:24:21 +0000 (13:24 +0200)] 
Add a Sphinx role for linking GitLab issues/MRs

Define a :gl: Sphinx role that takes a GitLab issue/MR number as an
argument and creates a hyperlink to the relevant ISC GitLab URL.  This
makes it easy to reach ISC GitLab pages directly from the release notes.

Make all GitLab references in the release notes use the new Sphinx role.

5 years agoMake use of the :rfc: role in the ARM consistent
Michal Nowak [Thu, 29 Apr 2021 11:24:21 +0000 (13:24 +0200)] 
Make use of the :rfc: role in the ARM consistent

Make sure all RFC references in the ARM use the stock :rfc: Sphinx role.

5 years agoMerge branch 'ondrej/use-sigabrt-from-start.pl' into 'main'
Ondřej Surý [Thu, 29 Apr 2021 10:44:26 +0000 (10:44 +0000)] 
Merge branch 'ondrej/use-sigabrt-from-start.pl' into 'main'

Use SIGABRT instead of SIGKILL to produce cores on failed start

See merge request isc-projects/bind9!4928

5 years agoUse SIGABRT instead of SIGKILL to produce cores on failed start
Ondřej Surý [Wed, 21 Apr 2021 13:39:14 +0000 (15:39 +0200)] 
Use SIGABRT instead of SIGKILL to produce cores on failed start

When the `named` would hang on startup it would be killed with SIGKILL
leaving us with no information about the state the process was in.
This commit changes the start.pl script to send SIGABRT instead, so we
can properly collect and process the coredump from the hung named
process.

5 years agoMerge branch 'matthijs-follow-up-2642-nsec3-iter-kasp' into 'main'
Matthijs Mekking [Thu, 29 Apr 2021 09:32:20 +0000 (09:32 +0000)] 
Merge branch 'matthijs-follow-up-2642-nsec3-iter-kasp' into 'main'

dnssec-policy: reduce NSEC3 iterations to 150

See merge request isc-projects/bind9!4952

5 years agodnssec-policy: reduce NSEC3 iterations to 150
Matthijs Mekking [Thu, 29 Apr 2021 07:54:51 +0000 (09:54 +0200)] 
dnssec-policy: reduce NSEC3 iterations to 150

When reducing the number of NSEC3 iterations to 150, commit
aa26cde2aea459d682f6f609a7c902ef9a7a35eb added tests for dnssec-policy
to check that a too high iteration count is a configuration failure.

The test is not sufficient because 151 was always too high for
ECDSAP256SHA256. The test should check for a different algorithm.

There was an existing test case that checks for NSEC3 iterations.
Update the test with the new maximum values.

Update the code in 'kaspconf.c' to allow at most 150 iterations.

5 years agoMerge branch 'v9_17_12-release' into 'main'
Michał Kępień [Thu, 29 Apr 2021 08:37:11 +0000 (08:37 +0000)] 
Merge branch 'v9_17_12-release' into 'main'

Merge 9.17.12 release branch

See merge request isc-projects/bind9!4953

5 years agoSet up release notes for BIND 9.17.13
Michał Kępień [Thu, 29 Apr 2021 08:30:00 +0000 (10:30 +0200)] 
Set up release notes for BIND 9.17.13

5 years agoUpdate BIND version to 9.17.12
Michał Kępień [Mon, 12 Apr 2021 10:31:49 +0000 (12:31 +0200)] 
Update BIND version to 9.17.12

5 years agoAdd a CHANGES marker
Michał Kępień [Mon, 12 Apr 2021 10:31:49 +0000 (12:31 +0200)] 
Add a CHANGES marker

5 years agoMerge branch 'michal/prepare-documentation-for-bind-9.17.12' into 'security-main'
Michał Kępień [Mon, 12 Apr 2021 10:29:15 +0000 (10:29 +0000)] 
Merge branch 'michal/prepare-documentation-for-bind-9.17.12' into 'security-main'

Prepare documentation for BIND 9.17.12

See merge request isc-private/bind9!280

5 years agoMerge branch '2540-confidential-issue-existing-dname' into 'security-main'
Michał Kępień [Mon, 12 Apr 2021 10:13:39 +0000 (10:13 +0000)] 
Merge branch '2540-confidential-issue-existing-dname' into 'security-main'

[CVE-2021-25215] Properly answer queries for DNAME records that require the DNAME to be processed to resolve itself

See merge request isc-private/bind9!253

5 years agoPrepare release notes for BIND 9.17.12
Michał Kępień [Mon, 12 Apr 2021 10:15:45 +0000 (12:15 +0200)] 
Prepare release notes for BIND 9.17.12

5 years agoMerge branch '2467-confidential-issue-ixfr-checks' into 'security-main'
Michał Kępień [Mon, 12 Apr 2021 10:08:35 +0000 (10:08 +0000)] 
Merge branch '2467-confidential-issue-ixfr-checks' into 'security-main'

[CVE-2021-25214] Prevent malformed incoming zone transfers from producing a zone without an SOA record

See merge request isc-private/bind9!239

5 years agoAdd Release Notes entry for [GL #2540]
Mark Andrews [Mon, 1 Mar 2021 05:08:21 +0000 (16:08 +1100)] 
Add Release Notes entry for [GL #2540]

5 years agoAdd release note for GL #2490
Michał Kępień [Mon, 12 Apr 2021 10:15:45 +0000 (12:15 +0200)] 
Add release note for GL #2490

5 years agoAdd release note for [GL #2467]
Mark Andrews [Wed, 3 Feb 2021 00:21:16 +0000 (11:21 +1100)] 
Add release note for [GL #2467]

5 years agoAdd CHANGES entry for [GL #2540]
Mark Andrews [Mon, 1 Mar 2021 05:09:39 +0000 (16:09 +1100)] 
Add CHANGES entry for [GL #2540]

5 years agoReorder release notes
Michał Kępień [Mon, 12 Apr 2021 10:15:45 +0000 (12:15 +0200)] 
Reorder release notes

5 years agoAdd CHANGES entry for [GL #2467]
Mark Andrews [Wed, 3 Feb 2021 00:19:43 +0000 (11:19 +1100)] 
Add CHANGES entry for [GL #2467]

5 years agoHandle DNAME lookup via itself
Mark Andrews [Mon, 1 Mar 2021 05:46:07 +0000 (16:46 +1100)] 
Handle DNAME lookup via itself

When answering a query, named should never attempt to add the same RRset
to the ANSWER section more than once.  However, such a situation may
arise when chasing DNAME records: one of the DNAME records placed in the
ANSWER section may turn out to be the final answer to a client query,
but there is no way to know that in advance.  Tweak the relevant INSIST
assertion in query_respond() so that it handles this case properly.
qctx->rdataset is freed later anyway, so there is no need to clean it up
in query_respond().

5 years agoTweak and reword release notes
Michał Kępień [Mon, 12 Apr 2021 10:15:45 +0000 (12:15 +0200)] 
Tweak and reword release notes

5 years agoUnload a zone if a transfer breaks its SOA record
Mark Andrews [Thu, 25 Feb 2021 03:11:05 +0000 (14:11 +1100)] 
Unload a zone if a transfer breaks its SOA record

If a zone transfer results in a zone not having any NS records, named
stops serving it because such a zone is broken.  Do the same if an
incoming zone transfer results in a zone lacking an SOA record at the
apex or containing more than one SOA record.

5 years agoTweak and reword recent CHANGES entries
Michał Kępień [Mon, 12 Apr 2021 10:15:45 +0000 (12:15 +0200)] 
Tweak and reword recent CHANGES entries

5 years agoAddress inconsistencies in checking added RRsets
Mark Andrews [Fri, 12 Feb 2021 03:51:28 +0000 (14:51 +1100)] 
Address inconsistencies in checking added RRsets

loading_addrdataset() rejects SOA RRsets which are not at top of zone.
addrdataset() should similarly reject such RRsets.

5 years agoCheck SOA owner names in zone transfers
Mark Andrews [Wed, 3 Feb 2021 00:10:20 +0000 (11:10 +1100)] 
Check SOA owner names in zone transfers

An IXFR containing SOA records with owner names different than the
transferred zone's origin can result in named serving a version of that
zone without an SOA record at the apex.  This causes a RUNTIME_CHECK
assertion failure the next time such a zone is refreshed.  Fix by
immediately rejecting a zone transfer (either an incremental or
non-incremental one) upon detecting an SOA record not placed at the apex
of the transferred zone.

5 years agoMerge branch '2642-reduce-the-maximum-nsec3-iterations-that-can-be-configured' into...
Mark Andrews [Thu, 29 Apr 2021 07:39:10 +0000 (07:39 +0000)] 
Merge branch '2642-reduce-the-maximum-nsec3-iterations-that-can-be-configured' into 'main'

Resolve "Reduce the maximum NSEC3 iterations that can be configured"

Closes #2642

See merge request isc-projects/bind9!4925

5 years agoAdd Release Note for [GL #2642]
Mark Andrews [Wed, 21 Apr 2021 01:45:56 +0000 (11:45 +1000)] 
Add Release Note for [GL #2642]

5 years agoAdd CHANGES for [GL #2642]
Mark Andrews [Wed, 21 Apr 2021 01:43:47 +0000 (11:43 +1000)] 
Add CHANGES for [GL #2642]

5625.   [func]          Reduce the supported maximum number of iterations
                        that can be configured in an NSEC3 zones to 150.
                        [GL #2642]

5 years agoCheck that excessive iterations in logged by named when
Mark Andrews [Wed, 17 Feb 2021 05:33:49 +0000 (16:33 +1100)] 
Check that excessive iterations in logged by named when

loading an existing zone or transfering from the primary.

5 years agoCheck NSEC3 iterations with dnssec-signzone
Mark Andrews [Fri, 23 Apr 2021 01:46:31 +0000 (11:46 +1000)] 
Check NSEC3 iterations with dnssec-signzone

5 years agoCheck that named rejects excessive iterations via UPDATE
Mark Andrews [Fri, 23 Apr 2021 00:28:06 +0000 (10:28 +1000)] 
Check that named rejects excessive iterations via UPDATE

5 years agonsupdate: reject attempts to add NSEC3PARAM with excessive iterations
Mark Andrews [Fri, 23 Apr 2021 00:03:53 +0000 (10:03 +1000)] 
nsupdate: reject attempts to add NSEC3PARAM with excessive iterations

5 years agoWarn if there is excessive NSEC3 iterations
Mark Andrews [Fri, 23 Apr 2021 04:23:00 +0000 (14:23 +1000)] 
Warn if there is excessive NSEC3 iterations

5 years agoCheck dnssec-policy nsec3param iterations limit
Mark Andrews [Wed, 21 Apr 2021 01:57:46 +0000 (11:57 +1000)] 
Check dnssec-policy nsec3param iterations limit

5 years agoReduce nsec3 max iterations to 150
Mark Andrews [Mon, 19 Apr 2021 06:32:54 +0000 (16:32 +1000)] 
Reduce nsec3 max iterations to 150

5 years agoMerge branch 'matthijs-nit-serve-stale-fixes' into 'main'
Matthijs Mekking [Wed, 28 Apr 2021 10:43:49 +0000 (10:43 +0000)] 
Merge branch 'matthijs-nit-serve-stale-fixes' into 'main'

Serve-stale nit fixes

See merge request isc-projects/bind9!4940

5 years agoServe-stale nit fixes
Matthijs Mekking [Mon, 26 Apr 2021 07:19:25 +0000 (09:19 +0200)] 
Serve-stale nit fixes

While working on the serve-stale backports, I noticed the following
oddities:

1. In the serve-stale system test, in one case we keep track of the
   time how long it took for dig to complete. In commit
   aaed7f9d8c2465790d769221dfe8378c7147f5eb, the code removed the
   exception to check for result == ISC_R_SUCCESS on stale found
   answers, and adjusted the test accordingly. This failed to update
   the time tracking accordingly. Move the t1/t2 time track variables
   back around the two dig commands to ensure the lookups resolved
   faster than the resolver-query-timeout.

2. We can remove the setting of NS_QUERYATTR_STALEOK and
   DNS_RDATASETATTR_STALE_ADDED on the "else if (stale_timeout)"
   code path, because they are added later when we know we have
   actually found a stale answer on a stale timeout lookup.

3. We should clear the NS_QUERYATTR_STALEOK flag from the client
   query attributes instead of DNS_RDATASETATTR_STALE_ADDED (that
   flag is set on the rdataset attributes).

4. In 'bin/named/config.c' we should set the configuration options
   in alpabetical order.

5. In the ARM, in the backports we have added "(stale)" between
   "cached" and "RRset" to make more clear a stale RRset may be
   returned in this scenario.

5 years agoMerge branch 'michal/limit-logging-for-verbose-system-tests' into 'main'
Michał Kępień [Wed, 28 Apr 2021 06:58:34 +0000 (06:58 +0000)] 
Merge branch 'michal/limit-logging-for-verbose-system-tests' into 'main'

Limit logging for verbose system tests

See merge request isc-projects/bind9!4812

5 years agoWarn when log files grow too big in system tests
Michał Kępień [Wed, 28 Apr 2021 05:56:47 +0000 (07:56 +0200)] 
Warn when log files grow too big in system tests

Exerting excessive I/O load on the host running system tests should be
avoided in order to limit the number of false positives reported by the
system test suite.  In some cases, running named with "-d 99" (which is
the default for system tests) results in a massive amount of logs being
generated, most of which are useless.  Implement a log file size check
to draw developers' attention to overly verbose named instances used in
system tests.  The warning threshold of 200,000 lines was chosen
arbitrarily.

5 years agoPrevent useless logging in the "tcp" system test
Michał Kępień [Wed, 28 Apr 2021 05:56:47 +0000 (07:56 +0200)] 
Prevent useless logging in the "tcp" system test

The regression test for CVE-2020-8620 causes a lot of useless messages
to be logged.  However, globally decreasing the log level for the
affected named instance would be a step too far as debugging information
may be useful for troubleshooting other checks in the "tcp" system test.
Starting a separate named instance for a single check should be avoided
when possible and thus is also not a good solution.  As a compromise,
run "rndc trace 1" for the affected named instance before starting the
regression test for CVE-2020-8620.

5 years agoLimit logging for verbose system tests
Michał Kępień [Wed, 28 Apr 2021 05:56:47 +0000 (07:56 +0200)] 
Limit logging for verbose system tests

The system test framework starts all named instances with the "-d 99"
command line option (unless it is overridden by a named.args file in a
given instance's working directory).  This causes a lot of log messages
to be written to named.run files - currently over 5 million lines for a
single test suite run.  While debugging information preserved in the log
files is essential for troubleshooting intermittent test failures, some
system tests involve sending hundreds or even thousands of queries,
which causes the relevant log files to explode in size.  When multiple
tests (or even multiple test suites) are run in parallel, excessive
logging contributes considerably to the I/O load on the test host,
increasing the odds of intermittent test failures getting triggered.

Decrease the debug level for the seven most verbose named instances:

  - use "-d 3" for ns2 in the "cacheclean" system test (it is the lowest
    logging level at which the test still passes without the need to
    apply any changes to tests.sh),

  - use "-d 1" for the other six named instances.

This roughly halves the number of lines logged by each test suite run
while still leaving enough information in the logs to allow at least
basic troubleshooting in case of test failures.

This approach was chosen as it results in a greater decrease in the
number of lines logged than running all named instances with "-d 3",
without causing any test failures.

5 years agoMerge branch '2529-add-__attribute__-malloc-for-isc_mempool_get' into 'main'
Diego dos Santos Fronza [Mon, 26 Apr 2021 14:50:15 +0000 (14:50 +0000)] 
Merge branch '2529-add-__attribute__-malloc-for-isc_mempool_get' into 'main'

Resolve "Add __attribute__((malloc)) for isc_mempool_get"

Closes #2529

See merge request isc-projects/bind9!4858

5 years agoAdd malloc attribute to memory allocation functions
Diego Fronza [Thu, 1 Apr 2021 20:03:59 +0000 (17:03 -0300)] 
Add malloc attribute to memory allocation functions

The malloc attribute allows compiler to do some optmizations on
functions that behave like malloc/calloc, like assuming that the
returned pointer do not alias other pointers.

5 years agoRemoved unnecessary check (mpctx->items == NULL)
Diego Fronza [Thu, 1 Apr 2021 19:48:16 +0000 (16:48 -0300)] 
Removed unnecessary check (mpctx->items == NULL)

There is no possibility for mpctx->items to be NULL at the point where
the code was removed, since we enforce that fillcount > 0, if
mpctx->items == NULL when isc_mempool_get is called, then we will
allocate fillcount more items and add to the mpctx->items list.

5 years agoMerge branch '2564-nslookup-segfaults-for-servfail' into 'main'
Diego dos Santos Fronza [Mon, 26 Apr 2021 14:30:46 +0000 (14:30 +0000)] 
Merge branch '2564-nslookup-segfaults-for-servfail' into 'main'

Add workaround for "nslookup segfaults for SERVFAIL"

See merge request isc-projects/bind9!4796

5 years agoAdd CHANGES note for [GL #2564]
Mark Andrews [Thu, 11 Mar 2021 03:37:19 +0000 (14:37 +1100)] 
Add CHANGES note for [GL #2564]

5 years agoFix following up lookup failure if more resolvers are available
Diego Fronza [Mon, 29 Mar 2021 17:04:12 +0000 (14:04 -0300)] 
Fix following up lookup failure if more resolvers are available

_query_detach function was incorrectly unliking the query object from
the lookup->q query list, this made it impossible to follow a query
lookup failure with the next one in the list (possibly using a separate
resolver), as the link to the next query in the list was dissolved.

Fix by unliking the node only when the query object is about to be
destroyed, i.e. there is no more references to the object.

5 years agoMerge branch '2650-handle-soa-rrsigs-not-at-zone-apex' into 'main'
Michał Kępień [Mon, 26 Apr 2021 11:06:00 +0000 (11:06 +0000)] 
Merge branch '2650-handle-soa-rrsigs-not-at-zone-apex' into 'main'

Handle RRSIG(SOA) RRsets not at zone apex

Closes #2650

See merge request isc-projects/bind9!4936

5 years agoMerge branch '2628-kasp-create-multiple-key-keyid-conflict' into 'main'
Matthijs Mekking [Mon, 26 Apr 2021 09:29:19 +0000 (09:29 +0000)] 
Merge branch '2628-kasp-create-multiple-key-keyid-conflict' into 'main'

Check for keyid conflicts between new keys

Closes #2628

See merge request isc-projects/bind9!4886

5 years agoChanges and release notes for [#2628]
Matthijs Mekking [Mon, 12 Apr 2021 14:25:49 +0000 (16:25 +0200)] 
Changes and release notes for [#2628]

5 years agoCheck for keyid conflicts between new keys
Matthijs Mekking [Mon, 12 Apr 2021 14:22:00 +0000 (16:22 +0200)] 
Check for keyid conflicts between new keys

When the keymgr needs to create new keys, it is possible it needs to
create multiple keys. The keymgr checks for keyid conflicts with
already existing keys, but it should also check against that it just
created.

5 years agoMerge branch '2634-test-tkey-gssapi-credential-conditionally' into 'main'
Michał Kępień [Mon, 26 Apr 2021 07:17:12 +0000 (07:17 +0000)] 
Merge branch '2634-test-tkey-gssapi-credential-conditionally' into 'main'

Test "tkey-gssapi-credential" conditionally

Closes #2634

See merge request isc-projects/bind9!4938

5 years agoTest "--without-gssapi" in GitLab CI
Michał Kępień [Mon, 26 Apr 2021 05:16:38 +0000 (07:16 +0200)] 
Test "--without-gssapi" in GitLab CI

GitLab CI pipelines do not currently include a Linux job that would have
GSSAPI support disabled.  Add the "--without-gssapi" option to the
./configure invocation on Debian 9 to address that deficiency and also
to continuously test that build-time switch.

5 years agoTest "tkey-gssapi-credential" conditionally
Michał Kępień [Mon, 26 Apr 2021 05:16:38 +0000 (07:16 +0200)] 
Test "tkey-gssapi-credential" conditionally

If "tkey-gssapi-credential" is set in the configuration and GSSAPI
support is not available, named will refuse to start.  As the test
system framework does not support starting named instances
conditionally, ensure that "tkey-gssapi-credential" is only present in
named.conf if GSSAPI support is available.

5 years agoMerge branch 'marka-shutdown-sync' into 'main'
Mark Andrews [Sat, 24 Apr 2021 04:36:45 +0000 (04:36 +0000)] 
Merge branch 'marka-shutdown-sync' into 'main'

shutdown: wait for named to start

See merge request isc-projects/bind9!4921

5 years agoWait for named to start
Mark Andrews [Tue, 20 Apr 2021 04:56:07 +0000 (14:56 +1000)] 
Wait for named to start

If we don't wait for named to finish starting, 'rndc stop' may
fail due to the listen limit being reached in named leading
to a false negative test

5 years agoMerge branch 'each-timeout-recovery' into 'main'
Evan Hunt [Fri, 23 Apr 2021 17:26:05 +0000 (17:26 +0000)] 
Merge branch 'each-timeout-recovery' into 'main'

ensure read timeouts are recoverable

See merge request isc-projects/bind9!4930

5 years agoUse a constant for timeouts in soft-timeout tests
Artem Boldariev [Thu, 22 Apr 2021 10:29:34 +0000 (13:29 +0300)] 
Use a constant for timeouts in soft-timeout tests

It makes it easier to change the value should the need arise.

5 years agouse the correct handle when calling the read callback
Evan Hunt [Thu, 22 Apr 2021 00:35:07 +0000 (17:35 -0700)] 
use the correct handle when calling the read callback

when calling isc_nm_read() on an HTTP socket, the read callback
was being run with the incorrect handle. this has been corrected.

5 years agofix DOH timeout recovery
Evan Hunt [Wed, 21 Apr 2021 19:03:10 +0000 (12:03 -0700)] 
fix DOH timeout recovery

as with TLS, the destruction of a client stream on failed read
needs to be conditional: if we reached failed_read_cb() as a
result of a timeout on a timer which has subsequently been
reset, the stream must not be closed.

5 years agoAdd CHANGES entry
Michał Kępień [Fri, 23 Apr 2021 12:26:48 +0000 (14:26 +0200)] 
Add CHANGES entry

5 years agoTest handling of non-apex RRSIG(SOA) RRsets
Michał Kępień [Fri, 23 Apr 2021 12:26:48 +0000 (14:26 +0200)] 
Test handling of non-apex RRSIG(SOA) RRsets

Add a check to the "dnssec" system test which ensures that RRSIG(SOA)
RRsets present anywhere else than at the zone apex are automatically
removed after a zone containing such RRsets is loaded.

5 years agoBe more precise with the stopping conditions in zone_resigninc
Mark Andrews [Thu, 8 Apr 2021 00:49:28 +0000 (10:49 +1000)] 
Be more precise with the stopping conditions in zone_resigninc

If there happens to be a RRSIG(SOA) that is not at the zone apex
for any reason it should not be considered as a stopping condition
for incremental zone signing.

5 years agoadd HTTP timeout recovery test
Evan Hunt [Wed, 21 Apr 2021 18:55:40 +0000 (11:55 -0700)] 
add HTTP timeout recovery test

NOTE: this test currently fails

5 years agofix TLS timeout recovery
Evan Hunt [Wed, 21 Apr 2021 17:28:26 +0000 (10:28 -0700)] 
fix TLS timeout recovery

the destruction of the socket in tls_failed_read_cb() needs to be
conditional; if reached due to a timeout on a timer that has
subsequently been reset, the socket must not be destroyed.

5 years agofix TCP timeout recovery
Evan Hunt [Wed, 21 Apr 2021 17:27:46 +0000 (10:27 -0700)] 
fix TCP timeout recovery

removed an unnecessary assert in the failed_read_cb() function.
also renamed to isc__nm_tcp_failed_read_cb() to match the practice
in other modules.

5 years agoadd TCP and TLS timeout recovery tests
Evan Hunt [Wed, 21 Apr 2021 17:27:09 +0000 (10:27 -0700)] 
add TCP and TLS timeout recovery tests

NOTE: currently these tests fail

5 years agoadd TCPDNS and TLSDNS timeout recovery tests
Evan Hunt [Wed, 21 Apr 2021 08:09:30 +0000 (01:09 -0700)] 
add TCPDNS and TLSDNS timeout recovery tests

this is similar in structure to the UDP timeout recovery test.

this commit adds a new mechanism to the netmgr test allowing the
listen socket to accept incoming TCP connections but never send
a response. this forces the client to time out on read.

5 years agorun read callbacks synchronously on timeout
Evan Hunt [Wed, 21 Apr 2021 06:27:51 +0000 (23:27 -0700)] 
run read callbacks synchronously on timeout

when running read callbacks, if the event result is not ISC_R_SUCCESS,
the callback is always run asynchronously. this is a problem on timeout,
because there's no chance to reset the timer before the socket has
already been destroyed. this commit allows read callbacks to run
synchronously for both ISC_R_SUCCESS and ISC_R_TIMEDOUT result codes.

5 years agoadd a UDP timeout recovery test
Evan Hunt [Wed, 21 Apr 2021 04:08:10 +0000 (21:08 -0700)] 
add a UDP timeout recovery test

this test sets up a server socket that listens for UDP connections
but never responds. the client will always time out; it should retry
five times before giving up.

5 years agoallow client read callback to be assignable
Evan Hunt [Wed, 21 Apr 2021 00:13:15 +0000 (17:13 -0700)] 
allow client read callback to be assignable

allow netmgr client tests to choose the function that will be
used as a read callback, without having to write a different
connect callback handler.

5 years agoMerge branch '2626-deadlock-with-concurrent-rndc-addzone-rndc-delzone-commands' into...
Diego dos Santos Fronza [Thu, 22 Apr 2021 15:47:16 +0000 (15:47 +0000)] 
Merge branch '2626-deadlock-with-concurrent-rndc-addzone-rndc-delzone-commands' into 'main'

Resolve "Deadlock with concurrent `rndc addzone`/`rndc delzone` commands"

Closes #2626

See merge request isc-projects/bind9!4904

5 years agoAdd CHANGES note for GL #2626
Diego Fronza [Fri, 16 Apr 2021 16:28:08 +0000 (13:28 -0300)] 
Add CHANGES note for GL #2626

5 years agoAdd system test for the deadlock fix
Diego Fronza [Mon, 19 Apr 2021 17:23:31 +0000 (14:23 -0300)] 
Add system test for the deadlock fix

The test spawns 4 parallel workers that keep adding, modifying and
deleting zones, the main thread repeatedly checks wheter rndc
status responds within a reasonable period.

While environment and timing issues may affect the test, in most
test cases the deadlock that was taking place before the fix used to
trigger in less than 7 seconds in a machine with at least 2 cores.

5 years agoFix deadlock between rndc addzone/delzone/modzone
Diego Fronza [Fri, 16 Apr 2021 15:21:31 +0000 (12:21 -0300)] 
Fix deadlock between rndc addzone/delzone/modzone

It follows a description of the steps that were leading to the deadlock:

1. `do_addzone` calls `isc_task_beginexclusive`.

2. `isc_task_beginexclusive` waits for (N_WORKERS - 1) halted tasks,
   this blocks waiting for those (no. workers -1) workers to halt.
...
isc_task_beginexclusive(isc_task_t *task0) {
    ...
while (manager->halted + 1 < manager->workers) {
wake_all_queues(manager);
WAIT(&manager->halt_cond, &manager->halt_lock);
}
```

3. It is possible that in `task.c / dispatch()` a worker is running a
   task event, if that event blocks it will not allow this worker to
   halt.

4. `do_addzone` acquires `LOCK(&view->new_zone_lock);`,

5. `rmzone` event is called from some worker's `dispatch()`, `rmzone`
   blocks waiting for the same lock.

6. `do_addzone` calls `isc_task_beginexclusive`.

7. Deadlock triggered, since:
- `rmzone` is wating for the lock.
- `isc_task_beginexclusive` is waiting for (no. workers - 1) to
   be halted
- since `rmzone` event is blocked it won't allow the worker to halt.

To fix this, we updated do_addzone code to call isc_task_beginexclusive
before the lock is acquired, we postpone locking to the nearest required
place, same for isc_task_beginexclusive.

The same could happen with rndc modzone, so that was addressed as well.

5 years agoMerge branch '2634-test-tkey-gssapi-credential' into 'main'
Petr Špaček [Thu, 22 Apr 2021 15:25:36 +0000 (15:25 +0000)] 
Merge branch '2634-test-tkey-gssapi-credential' into 'main'

Add tests for the "tkey-gssapi-credential" option

See merge request isc-projects/bind9!4905

5 years agoAdd tests for the "tkey-gssapi-credential" option
Petr Špaček [Fri, 16 Apr 2021 16:05:43 +0000 (18:05 +0200)] 
Add tests for the "tkey-gssapi-credential" option

Four named instances in the "nsupdate" system test have GSS-TSIG support
enabled.  All of them currently use "tkey-gssapi-keytab".  Configure two
of them with "tkey-gssapi-credential" to test that option.

As "tkey-gssapi-keytab" and "tkey-gssapi-credential" both provide the
same functionality, no test modifications are required.  The difference
between the two options is that the value of "tkey-gssapi-keytab" is an
explicit path to the keytab file to acquire credentials from, while the
value of "tkey-gssapi-credential" is the name of the principal whose
credentials should be used; those credentials are looked up in the
keytab file expected by the Kerberos library, i.e. /etc/krb5.keytab by
default.  The path to the default keytab file can be overridden using by
setting the KRB5_KTNAME environment variable.  Utilize that variable to
use existing keytab files with the "tkey-gssapi-credential" option.

The KRB5_KTNAME environment variable should not interfere with the
"tkey-gssapi-keytab" option.  Nevertheless, rename one of the keytab
files used with "tkey-gssapi-keytab" to something else than the contents
of the KRB5_KTNAME environment variable in order to make sure that both
"tkey-gssapi-keytab" and "tkey-gssapi-credential" are actually tested.

5 years agoMerge branch 'ondrej/autoconf-2.71-fixes' into 'main'
Ondřej Surý [Thu, 22 Apr 2021 12:41:11 +0000 (12:41 +0000)] 
Merge branch 'ondrej/autoconf-2.71-fixes' into 'main'

Update the configure.ac for autoconf >= 2.71 compatibility

See merge request isc-projects/bind9!4899

5 years agoUpdate the configure.ac for autoconf >= 2.71 compatibility
Ondřej Surý [Fri, 16 Apr 2021 10:25:35 +0000 (12:25 +0200)] 
Update the configure.ac for autoconf >= 2.71 compatibility

This mostly removes stuff that's either deprecated, obsolete or not used
at all:

* Update the minimal autoconf version to 2.69
* AC_PROG_CC_C99 is deprecated, just use AC_PROG_CC as we require C11
  anyway
* AC_HEADER_TIME is deprecated, both <sys/time.h> and <time.h> can be
  included at the same time, and we don't use the macros that
  AC_HEADER_TIME defines anywhere
* AC_HEADER_STDC checks for ISO C90 and we require at least C11
* Replace AC_TRY_*([]) with AC_*_IFELSE([AC_LANG_PROGRAM()])
* Update m4/ax_check_openssl.m4 from serial 10 to serial 11
* Update m4/ax_gcc_func_attribute.m4 from serial 10 to serial 13
* Update m4/ax_pthread.m4 from serial 24 to serial 30
* Add early AC_CANONICAL_TARGET call to prevent warning from AX_PTHREAD

5 years agoMerge branch '2625-the-shutdown-system-test-is-not-capturing-enough' into 'main'
Mark Andrews [Thu, 22 Apr 2021 06:47:21 +0000 (06:47 +0000)] 
Merge branch '2625-the-shutdown-system-test-is-not-capturing-enough' into 'main'

Resolve "The shutdown system test is not capturing enough"

Closes #2625

See merge request isc-projects/bind9!4883

5 years agoAbort named if 'rndc stop' or 'kill TERM' has failed to shutdown
Mark Andrews [Mon, 12 Apr 2021 08:00:07 +0000 (18:00 +1000)] 
Abort named if 'rndc stop' or 'kill TERM' has failed to shutdown

5 years agoMerge branch '2638-run-internal-tasks-on-top-of-network-manager-worker-loops' into...
Ondřej Surý [Tue, 20 Apr 2021 22:16:42 +0000 (22:16 +0000)] 
Merge branch '2638-run-internal-tasks-on-top-of-network-manager-worker-loops' into 'main'

Refactor taskmgr to run on top of netmgr

Closes #2638

See merge request isc-projects/bind9!4918

5 years agoAdd CHANGES and release note for [GL #2638]
Ondřej Surý [Mon, 19 Apr 2021 14:24:26 +0000 (16:24 +0200)] 
Add CHANGES and release note for [GL #2638]

5 years agoRefactor taskmgr to run on top of netmgr
Ondřej Surý [Fri, 9 Apr 2021 09:31:19 +0000 (11:31 +0200)] 
Refactor taskmgr to run on top of netmgr

This commit changes the taskmgr to run the individual tasks on the
netmgr internal workers.  While an effort has been put into keeping the
taskmgr interface intact, couple of changes have been made:

 * The taskmgr has no concept of universal privileged mode - rather the
   tasks are either privileged or unprivileged (normal).  The privileged
   tasks are run as a first thing when the netmgr is unpaused.  There
   are now four different queues in in the netmgr:

   1. priority queue - netievent on the priority queue are run even when
      the taskmgr enter exclusive mode and netmgr is paused.  This is
      needed to properly start listening on the interfaces, free
      resources and resume.

   2. privileged task queue - only privileged tasks are queued here and
      this is the first queue that gets processed when network manager
      is unpaused using isc_nm_resume().  All netmgr workers need to
      clean the privileged task queue before they all proceed normal
      operation.  Both task queues are processed when the workers are
      finished.

   3. task queue - only (traditional) task are scheduled here and this
      queue along with privileged task queues are process when the
      netmgr workers are finishing.  This is needed to process the task
      shutdown events.

   4. normal queue - this is the queue with netmgr events, e.g. reading,
      sending, callbacks and pretty much everything is processed here.

 * The isc_taskmgr_create() now requires initialized netmgr (isc_nm_t)
   object.

 * The isc_nm_destroy() function now waits for indefinite time, but it
   will print out the active objects when in tracing mode
   (-DNETMGR_TRACE=1 and -DNETMGR_TRACE_VERBOSE=1), the netmgr has been
   made a little bit more asynchronous and it might take longer time to
   shutdown all the active networking connections.

 * Previously, the isc_nm_stoplistening() was a synchronous operation.
   This has been changed and the isc_nm_stoplistening() just schedules
   the child sockets to stop listening and exits.  This was needed to
   prevent a deadlock as the the (traditional) tasks are now executed on
   the netmgr threads.

 * The socket selection logic in isc__nm_udp_send() was flawed, but
   fortunatelly, it was broken, so we never hit the problem where we
   created uvreq_t on a socket from nmhandle_t, but then a different
   socket could be picked up and then we were trying to run the send
   callback on a socket that had different threadid than currently
   running.

5 years agoMerge branch '2630-tsan-error-in-xfrin-c' into 'main'
Ondřej Surý [Tue, 20 Apr 2021 12:13:35 +0000 (12:13 +0000)] 
Merge branch '2630-tsan-error-in-xfrin-c' into 'main'

Prevent the double xfrin_fail() call

Closes #2630

See merge request isc-projects/bind9!4898

5 years agoAdd CHANGES note for [GL #2630]
Ondřej Surý [Fri, 16 Apr 2021 14:10:55 +0000 (16:10 +0200)] 
Add CHANGES note for [GL #2630]

5 years agoPrevent the double xfrin_fail() call
Ondřej Surý [Fri, 16 Apr 2021 09:08:05 +0000 (11:08 +0200)] 
Prevent the double xfrin_fail() call

When we are reading from the xfrin socket, and the transfer would be
shutdown, the shutdown function would call `xfrin_fail()` which in turns
calls `xfrin_cancelio()` that causes the read callback to be invoked
with `ISC_R_CANCELED` status code and that caused yet another
`xfrin_fail()` call.

The fix here is to ensure the `xfrin_fail()` would be run only once
properly using better synchronization on xfr->shuttingdown flag.

5 years agoMerge branch '2637-threadsanitizer-lock-order-inversion-potential-deadlock-in-zone_re...
Ondřej Surý [Mon, 19 Apr 2021 20:29:56 +0000 (20:29 +0000)] 
Merge branch '2637-threadsanitizer-lock-order-inversion-potential-deadlock-in-zone_refreshkeys' into 'main'

Fix lock-order-inversion (potential deadlock) in dns_resolver_createfetch

Closes #2637

See merge request isc-projects/bind9!4909

5 years agoFix lock-order-inversion (potential deadlock) in dns_resolver_createfetch
Ondřej Surý [Mon, 19 Apr 2021 08:01:32 +0000 (10:01 +0200)] 
Fix lock-order-inversion (potential deadlock) in dns_resolver_createfetch

There's a lock-order-inversion when running `zone_maintenance()` from
the timer while shutting down the server `shutdown_server()`.  This only
happens when the taskmgr scheduling is more relaxed and paralellized,
but the issue is real nevertheless.

The associated ThreadSanitizer warning:

    WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
      Cycle in lock order graph: M1 (0x000000000001) => M2 (0x000000000000) => M1

      Mutex M2 acquired here while holding mutex M1 in thread T1:
#0 pthread_mutex_lock <null>
#1 dns_view_findzonecut lib/dns/view.c:1326:2
#2 fctx_create lib/dns/resolver.c:5144:13
#3 dns_resolver_createfetch lib/dns/resolver.c:10977:12
#4 zone_refreshkeys lib/dns/zone.c:10830:13
#5 zone_maintenance lib/dns/zone.c:11065:5
#6 zone_timer lib/dns/zone.c:14652:2
#7 task_run lib/isc/task.c:857:5
#8 isc_task_run lib/isc/task.c:944:10
#9 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
#10 process_netievent lib/isc/netmgr/netmgr.c
#11 process_queue lib/isc/netmgr/netmgr.c:885:8
#12 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
#13 process_queues lib/isc/netmgr/netmgr.c:772:7
#14 async_cb lib/isc/netmgr/netmgr.c:671:2
#15 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
#16 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
#17 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
#18 nm_thread lib/isc/netmgr/netmgr.c:597:11
#19 isc__trampoline_run lib/isc/trampoline.c:184:11

      Mutex M1 previously acquired by the same thread here:
#0 pthread_mutex_lock <null>
#1 zone_refreshkeys lib/dns/zone.c:10717:2
#2 zone_maintenance lib/dns/zone.c:11065:5
#3 zone_timer lib/dns/zone.c:14652:2
#4 task_run lib/isc/task.c:857:5
#5 isc_task_run lib/isc/task.c:944:10
#6 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
#7 process_netievent lib/isc/netmgr/netmgr.c
#8 process_queue lib/isc/netmgr/netmgr.c:885:8
#9 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
#10 process_queues lib/isc/netmgr/netmgr.c:772:7
#11 async_cb lib/isc/netmgr/netmgr.c:671:2
#12 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
#13 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
#14 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
#15 nm_thread lib/isc/netmgr/netmgr.c:597:11
#16 isc__trampoline_run lib/isc/trampoline.c:184:11

      Mutex M1 acquired here while holding mutex M2 in thread T2:
#0 pthread_mutex_lock <null>
#1 dns_zone_flush lib/dns/zone.c:11443:2
#2 view_flushanddetach lib/dns/view.c:657:5
#3 dns_view_flushanddetach lib/dns/view.c:690:2
#4 shutdown_server bin/named/server.c:10056:4
#5 task_run lib/isc/task.c:857:5
#6 isc_task_run lib/isc/task.c:944:10
#7 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
#8 process_netievent lib/isc/netmgr/netmgr.c
#9 process_queue lib/isc/netmgr/netmgr.c:885:8
#10 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
#11 process_queues lib/isc/netmgr/netmgr.c:772:7
#12 async_cb lib/isc/netmgr/netmgr.c:671:2
#13 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
#14 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
#15 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
#16 nm_thread lib/isc/netmgr/netmgr.c:597:11
#17 isc__trampoline_run lib/isc/trampoline.c:184:11

      Mutex M2 previously acquired by the same thread here:
#0 pthread_mutex_lock <null>
#1 view_flushanddetach lib/dns/view.c:645:3
#2 dns_view_flushanddetach lib/dns/view.c:690:2
#3 shutdown_server bin/named/server.c:10056:4
#4 task_run lib/isc/task.c:857:5
#5 isc_task_run lib/isc/task.c:944:10
#6 isc__nm_async_task lib/isc/netmgr/netmgr.c:730:24
#7 process_netievent lib/isc/netmgr/netmgr.c
#8 process_queue lib/isc/netmgr/netmgr.c:885:8
#9 process_tasks_queue lib/isc/netmgr/netmgr.c:756:10
#10 process_queues lib/isc/netmgr/netmgr.c:772:7
#11 async_cb lib/isc/netmgr/netmgr.c:671:2
#12 uv__async_io /home/ondrej/Projects/tsan/libuv/src/unix/async.c:163:5
#13 uv__io_poll /home/ondrej/Projects/tsan/libuv/src/unix/linux-core.c:462:11
#14 uv_run /home/ondrej/Projects/tsan/libuv/src/unix/core.c:392:5
#15 nm_thread lib/isc/netmgr/netmgr.c:597:11
#16 isc__trampoline_run lib/isc/trampoline.c:184:11

      Thread T2 (running) created by main thread at:
#0 pthread_create <null>
#1 isc_thread_create lib/isc/pthreads/thread.c:79:8
#2 isc_nm_start lib/isc/netmgr/netmgr.c:303:3
#3 create_managers bin/named/main.c:957:15
#4 setup bin/named/main.c:1267:11
#5 main bin/named/main.c:1558:2

      Thread T2 (running) created by main thread at:
#0 pthread_create <null>
#1 isc_thread_create lib/isc/pthreads/thread.c:79:8
#2 isc_nm_start lib/isc/netmgr/netmgr.c:303:3
#3 create_managers bin/named/main.c:957:15
#4 setup bin/named/main.c:1267:11
#5 main bin/named/main.c:1558:2

    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) in __interceptor_pthread_mutex_lock

5 years agoMerge branch 'ondrej/cleanup-ISCAPI-remnants' into 'main'
Ondřej Surý [Mon, 19 Apr 2021 11:48:14 +0000 (11:48 +0000)] 
Merge branch 'ondrej/cleanup-ISCAPI-remnants' into 'main'

Cleanup the public vs private ISCAPI remnants

See merge request isc-projects/bind9!4911

5 years agoCleanup the public vs private ISCAPI remnants
Ondřej Surý [Mon, 19 Apr 2021 09:12:58 +0000 (11:12 +0200)] 
Cleanup the public vs private ISCAPI remnants

Since all the libraries are internal now, just cleanup the ISCAPI remnants
in isc_socket, isc_task and isc_timer APIs.  This means, there's one less
layer as following changes have been done:

 * struct isc_socket and struct isc_socketmgr have been removed
 * struct isc__socket and struct isc__socketmgr have been renamed
   to struct isc_socket and struct isc_socketmgr
 * struct isc_task and struct isc_taskmgr have been removed
 * struct isc__task and struct isc__taskmgr have been renamed
   to struct isc_task and struct isc_taskmgr
 * struct isc_timer and struct isc_timermgr have been removed
 * struct isc__timer and struct isc__timermgr have been renamed
   to struct isc_timer and struct isc_timermgr
 * All the associated code that dealt with typing isc_<foo>
   to isc__<foo> and back has been removed.

5 years agoMerge branch 'ondrej/fixup-bin/tests/system/resolve-win32-directories' into 'main'
Ondřej Surý [Mon, 19 Apr 2021 11:15:12 +0000 (11:15 +0000)] 
Merge branch 'ondrej/fixup-bin/tests/system/resolve-win32-directories' into 'main'

Fixup win32 paths for moved bin/tests/system/resolve

See merge request isc-projects/bind9!4916