2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00
Commit Graph

33779 Commits

Author SHA1 Message Date
Mark Andrews
ca07b8e414 Add Release Note for [GL #2642] 2021-04-29 17:18:26 +10:00
Mark Andrews
e04f06873f 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]
2021-04-29 17:18:26 +10:00
Mark Andrews
46eb21c546 Check that excessive iterations in logged by named when
loading an existing zone or transfering from the primary.
2021-04-29 17:18:26 +10:00
Mark Andrews
8ec16c378d Check NSEC3 iterations with dnssec-signzone 2021-04-29 17:18:26 +10:00
Mark Andrews
4ce8437a6e Check that named rejects excessive iterations via UPDATE 2021-04-29 17:18:26 +10:00
Mark Andrews
3fe75d9809 nsupdate: reject attempts to add NSEC3PARAM with excessive iterations 2021-04-29 17:18:26 +10:00
Mark Andrews
c9f5f8a059 Warn if there is excessive NSEC3 iterations 2021-04-29 17:18:26 +10:00
Mark Andrews
aa26cde2ae Check dnssec-policy nsec3param iterations limit 2021-04-29 17:18:26 +10:00
Mark Andrews
29126500d2 Reduce nsec3 max iterations to 150 2021-04-29 17:18:26 +10:00
Matthijs Mekking
51f94b8c7c Merge branch 'matthijs-nit-serve-stale-fixes' into 'main'
Serve-stale nit fixes

See merge request isc-projects/bind9!4940
2021-04-28 10:43:49 +00:00
Matthijs Mekking
104b676235 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
   aaed7f9d8c, 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.
2021-04-28 12:24:24 +02:00
Michał Kępień
7c7b97b916 Merge branch 'michal/limit-logging-for-verbose-system-tests' into 'main'
Limit logging for verbose system tests

See merge request isc-projects/bind9!4812
2021-04-28 06:58:34 +00:00
Michał Kępień
241e85ef0c 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.
2021-04-28 07:56:47 +02:00
Michał Kępień
17e5c2a50e 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.
2021-04-28 07:56:47 +02:00
Michał Kępień
4a8d404876 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.
2021-04-28 07:56:47 +02:00
Diego dos Santos Fronza
99a4f6119a 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
2021-04-26 14:50:15 +00:00
Diego Fronza
54aa60eef8 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.
2021-04-26 11:32:17 -03:00
Diego Fronza
efb9c540cd 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.
2021-04-26 11:32:17 -03:00
Diego dos Santos Fronza
19df09d225 Merge branch '2564-nslookup-segfaults-for-servfail' into 'main'
Add workaround for "nslookup segfaults for SERVFAIL"

See merge request isc-projects/bind9!4796
2021-04-26 14:30:46 +00:00
Mark Andrews
f2d00069c3 Add CHANGES note for [GL #2564] 2021-04-26 11:15:25 -03:00
Diego Fronza
4d6408b823 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.
2021-04-26 11:14:14 -03:00
Michał Kępień
3793733704 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
2021-04-26 11:06:00 +00:00
Matthijs Mekking
a64dd511f4 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
2021-04-26 09:29:19 +00:00
Matthijs Mekking
b99ec65745 Changes and release notes for [#2628] 2021-04-26 10:43:39 +02:00
Matthijs Mekking
668301f138 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.
2021-04-26 10:42:46 +02:00
Michał Kępień
c84399df64 Merge branch '2634-test-tkey-gssapi-credential-conditionally' into 'main'
Test "tkey-gssapi-credential" conditionally

Closes #2634

See merge request isc-projects/bind9!4938
2021-04-26 07:17:12 +00:00
Michał Kępień
a3957af864 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.
2021-04-26 07:16:38 +02:00
Michał Kępień
6feac68b50 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.
2021-04-26 07:16:38 +02:00
Mark Andrews
a26e29896a Merge branch 'marka-shutdown-sync' into 'main'
shutdown: wait for named to start

See merge request isc-projects/bind9!4921
2021-04-24 04:36:45 +00:00
Mark Andrews
8d5870f9df 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
2021-04-24 01:19:47 +00:00
Evan Hunt
f8275c30da Merge branch 'each-timeout-recovery' into 'main'
ensure read timeouts are recoverable

See merge request isc-projects/bind9!4930
2021-04-23 17:26:05 +00:00
Artem Boldariev
62033110b9 Use a constant for timeouts in soft-timeout tests
It makes it easier to change the value should the need arise.
2021-04-23 10:01:42 -07:00
Evan Hunt
7f367b0c7f 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.
2021-04-23 10:01:42 -07:00
Evan Hunt
f0d75ee7c3 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.
2021-04-23 10:01:42 -07:00
Michał Kępień
47a7b042e5 Add CHANGES entry 2021-04-23 14:26:48 +02:00
Michał Kępień
24bf4b946a 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.
2021-04-23 14:26:48 +02:00
Mark Andrews
b7cdc3583e 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.
2021-04-23 14:26:48 +02:00
Evan Hunt
b258df8562 add HTTP timeout recovery test
NOTE: this test currently fails
2021-04-22 12:40:04 -07:00
Evan Hunt
23ec011298 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.
2021-04-22 12:08:04 -07:00
Evan Hunt
c90da99180 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.
2021-04-22 12:08:04 -07:00
Evan Hunt
25ef0547a9 add TCP and TLS timeout recovery tests
NOTE: currently these tests fail
2021-04-22 12:08:04 -07:00
Evan Hunt
52f256f9ae 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.
2021-04-22 12:08:04 -07:00
Evan Hunt
bcf5b2a675 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.
2021-04-22 12:08:04 -07:00
Evan Hunt
609975ad20 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.
2021-04-22 12:08:04 -07:00
Evan Hunt
1f41d59a5e 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.
2021-04-22 12:08:04 -07:00
Diego dos Santos Fronza
289d7c2acc 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
2021-04-22 15:47:16 +00:00
Diego Fronza
6646655067 Add CHANGES note for GL #2626 2021-04-22 15:45:55 +00:00
Diego Fronza
d6224035d8 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.
2021-04-22 15:45:55 +00:00
Diego Fronza
9298dcebbd 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.
2021-04-22 15:45:55 +00:00
Petr Špaček
fa6b277b8d Merge branch '2634-test-tkey-gssapi-credential' into 'main'
Add tests for the "tkey-gssapi-credential" option

See merge request isc-projects/bind9!4905
2021-04-22 15:25:36 +00:00