]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
3 years agoExecute the system test workflow in pytest runner
Tom Krizek [Thu, 12 Jan 2023 16:27:07 +0000 (17:27 +0100)] 
Execute the system test workflow in pytest runner

This is basically the pytest re-implementation of the run.sh script.

The fixture is applied to every module and ensures complete test
setup/teardown, such as starting/stopping servers, detecting coredumps
etc.

Note that the fixture system_test_dir is not defined yet. It is omitted
now for review readability and it's added in follow-up commits.

3 years agoUtility fixtures for pytest runner
Tom Krizek [Thu, 12 Jan 2023 16:01:36 +0000 (17:01 +0100)] 
Utility fixtures for pytest runner

Add fixtures for deriving system test name from the directory name and
for a module-specific logger.

Add fixtures to execute shell and perl scripts. Similar to how run.sh
calls commands, this functionality is also needed in pytest. The
fixtures take care of switching to a proper directory, logging
everything and handling errors.

Note that the fixture system_test_dir is not defined yet. It is omitted
now for review readability and it's added in follow-up commits.

3 years agoAssign unique ports to pytest modules
Tom Krizek [Thu, 12 Jan 2023 15:52:49 +0000 (16:52 +0100)] 
Assign unique ports to pytest modules

This is basically a pytest re-implementation of the get_ports.sh script.
The main difference is that ports are assigned on a module basis, rather
than a directory basis. Module is the new atomic unit for parallel
execution, therefore it needs to have unique ports to avoid collisions.

Each module gets its ports through the env fixture which is updated with
ports and other module-specific variables.

3 years agoEnsure system test programs and deps are compiled
Tom Krizek [Thu, 12 Jan 2023 15:47:55 +0000 (16:47 +0100)] 
Ensure system test programs and deps are compiled

Some system tests require extra programs and/or dependencies to be
compiled first. This is done via `make check` with the automake
framework when using check_* variables such as check_PROGRAMS.

To avoid running any tests via the automake framework, set the TESTS
env variable to empty string and utilize `make -e check` to override
default Makefile variables with environment ones. This ensures automake
will only compile the needed dependencies without running any tests.

Additional consideration needs to be taken for xdist. The compilation
command should be called just once before any tests are executed. To
achieve that, use the pytest_configure() hook and check that the
PYTEST_XDIST_WORKER env variable isn't set -- if it is, it indicates
we're in the spawned xdist worker and the compilation was already done
by the main pytest process that spawned the workers.

This is mostly done to have on-par functionality with legacy test
framework. In the future, we should get rid of the need to run "empty"
make -e check and perhaps compile test-stuff by default.

3 years agoObtain env vars from conf.sh in pytest runner
Tom Krizek [Thu, 12 Jan 2023 15:41:41 +0000 (16:41 +0100)] 
Obtain env vars from conf.sh in pytest runner

The commands executed by pytest during a system test need to have the
same environment variables set as if they were executed by the run.sh
shell script.

It was decided that for the moment, legacy way of executing system tests
with run.sh should be kept, which complicates things a bit. In order to
avoid duplicating the required variables in both conf.sh and pytest, it
was decided to use the existing conf.sh as the only authoritative
place for the variables.

It is necessary to process the environment variables from conf.sh right
when conftest.py is loaded, since they might be needed right away (e.g.
to test for feature support during test collection).

This solution is a bit hacky and is only meant to be used during the
transitory phase when both pytest and the legacy run.sh are both
supported. In the future, a superior pytest-only solution should be
used.

For discussion of other options, refer to
https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/6809#note_318889

3 years agoCollect existing tests in pytest runner
Tom Krizek [Thu, 12 Jan 2023 15:26:25 +0000 (16:26 +0100)] 
Collect existing tests in pytest runner

Ensure pytest picks up our python test modules, since we're using
tests_*.py convention, which is different from the default.

Configure pytest logging to display the output from all tests (even the
ones that passed). This ensures we have sufficient amount of information
to debug test post-mortem just from the artifacts.

3 years agoSupport both pytest and legacy system test runner
Tom Krizek [Thu, 12 Jan 2023 14:48:55 +0000 (15:48 +0100)] 
Support both pytest and legacy system test runner

The legacy system test framework uses pytest to execute some tests.
Since it'd be quite difficult to convince pytest to decide whether to
include conftest.py (or which ones to include when launching from
subdir), it makes more sense to have a shared conftest.py which is used
by both the legacy test runner invocations of pytest and the new pytest
system test runner. It is ugly, but once we drop support for the legacy
runner, we'll get rid of it.

Properly scope the *port fixtures in order to ensure they'll work as
expected with the new pytest runner. Instead of using "session" (which
means the fixture is only evaluated once for the entire execution of
pytest), use "module" scope, which is evaluated separately for each
module. The legacy runner invoked pytest for each system test
separately, while the new pytest runner is invoked once for all system
tests -- therefore it requires the more fine-grained "module" scope to
for the fixtures to work properly.

Remove python shebang, as conftest.py isn't supposed to be an executable
script.

3 years agoMerge branch '4070-tsan-qpmulti-destroy' into 'main'
Tony Finch [Sat, 20 May 2023 07:27:44 +0000 (07:27 +0000)] 
Merge branch '4070-tsan-qpmulti-destroy' into 'main'

Acquire qpmulti->mutex during destruction

Closes #4070 and #4073

See merge request isc-projects/bind9!7938

3 years agoAcquire qpmulti->mutex during destruction
Tony Finch [Wed, 17 May 2023 09:57:16 +0000 (10:57 +0100)] 
Acquire qpmulti->mutex during destruction

Thread sanitizer warns that parts of the qp-trie are accessed
both with and without the mutex; the unlocked accesses happen during
destruction, so they should be benign, but there's no harm locking
anyway to convince tsan it is clean.

Also, ensure .tsan-suppress and .tsan-suppress-extra are in sync.

3 years agoMerge branch 'mnowak/danger-test-pairwise-hint' into 'main'
Michal Nowak [Fri, 19 May 2023 12:31:28 +0000 (12:31 +0000)] 
Merge branch 'mnowak/danger-test-pairwise-hint' into 'main'

Add a friendly Danger plea to run the pairwise CI job

See merge request isc-projects/bind9!7876

3 years agoAdd a friendly Danger plea to run the pairwise CI job
Michal Nowak [Fri, 28 Apr 2023 08:24:17 +0000 (10:24 +0200)] 
Add a friendly Danger plea to run the pairwise CI job

Sometimes a pairwise definition for a new ./configure switch is added
but not tested in the CI.

3 years agoMerge branch 'mnowak/fedora-38' into 'main'
Michal Nowak [Fri, 19 May 2023 11:53:40 +0000 (11:53 +0000)] 
Merge branch 'mnowak/fedora-38' into 'main'

Add Fedora 38

See merge request isc-projects/bind9!7936

3 years agoAdd Fedora 38
Michal Nowak [Mon, 17 Apr 2023 17:15:17 +0000 (19:15 +0200)] 
Add Fedora 38

3 years agoMerge branch '4077-add-RUNTIME_CHECK-around-wrap' into 'main'
Michal Nowak [Fri, 19 May 2023 09:07:18 +0000 (09:07 +0000)] 
Merge branch '4077-add-RUNTIME_CHECK-around-wrap' into 'main'

Ensure "wrap" variable is non-NULL

Closes #4077

See merge request isc-projects/bind9!7948

3 years agoEnsure "wrap" variable is non-NULL
Michal Nowak [Thu, 18 May 2023 15:57:14 +0000 (17:57 +0200)] 
Ensure "wrap" variable is non-NULL

RUNTIME_CHECK on the "wrap" variable avoids possible NULL dereference:

    thread.c: In function 'thread_wrap':
    thread.c:60:15: error: dereference of possibly-NULL 'wrap' [CWE-690] [-Werror=analyzer-possible-null-dereference]
       60 |         *wrap = (struct thread_wrap){

The RUNTIME_CHECK was there before
7d1ceaf35dbc25dfbca32deffa7f6ff8f452e75f.

3 years agoMerge branch 'mnowak/get_core_dumps-fix-misplaced-tsan-line' into 'main'
Michal Nowak [Fri, 19 May 2023 07:18:11 +0000 (07:18 +0000)] 
Merge branch 'mnowak/get_core_dumps-fix-misplaced-tsan-line' into 'main'

TSAN summarising line was misplaced in get_core_dumps.sh

See merge request isc-projects/bind9!7870

3 years agoTSAN summarising line was misplaced in get_core_dumps.sh
Michal Nowak [Wed, 26 Apr 2023 10:48:40 +0000 (12:48 +0200)] 
TSAN summarising line was misplaced in get_core_dumps.sh

The line summarising TSAN reports was misplaced in the ASAN territory
and thus never used.

I also made core dumps, assertion failures, and TSAN reports detection
independent of each other.

3 years agoMerge branch 'michal/cmocka-future-proofing' into 'main'
Michał Kępień [Thu, 18 May 2023 13:30:48 +0000 (13:30 +0000)] 
Merge branch 'michal/cmocka-future-proofing' into 'main'

cmocka future-proofing

See merge request isc-projects/bind9!7939

3 years agoRemove <isc/cmocka.h>
Michał Kępień [Thu, 18 May 2023 13:12:23 +0000 (15:12 +0200)] 
Remove <isc/cmocka.h>

The last use of the cmocka_add_test_byname() helper macro was removed in
commit 63fe9312ff8f54bc79e399bdbd5aaa15cd3e5459.  Remove the
<isc/cmocka.h> header that defines it.

3 years agoFix cmocka-related compiler warnings in ht_test
Michał Kępień [Thu, 18 May 2023 13:12:23 +0000 (15:12 +0200)] 
Fix cmocka-related compiler warnings in ht_test

tests/isc/ht_test.c triggers the following compiler warnings when built
against development versions of cmocka:

    In file included from ht_test.c:24:
    ht_test.c: In function ‘test_ht_full’:
    ht_test.c:68:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion]
       68 |                 assert_ptr_equal((void *)i, (uintptr_t)f);
    /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’
     1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__)
          |                                                        ^
    /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’
     2907 |                        const void *b,
          |                        ~~~~~~~~~~~~^
    ht_test.c:163:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion]
      163 |                 assert_ptr_equal((void *)i, (uintptr_t)f);
    /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’
     1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__)
          |                                                        ^
    /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’
     2907 |                        const void *b,
          |                        ~~~~~~~~~~~~^

These are caused by a change to the definitions of pointer assert
functions in cmocka's development branch [1].  Fix by casting the
affected variables to (void *) instead of (uintptr_t).

[1] https://git.cryptomilk.org/projects/cmocka.git/commit/?id=09621179af67535788a67957a910d9f17c975b45

3 years agoInclude <inttypes.h> whenever including <cmocka.h>
Michał Kępień [Thu, 18 May 2023 13:12:23 +0000 (15:12 +0200)] 
Include <inttypes.h> whenever including <cmocka.h>

Development versions of cmocka require the intmax_t and uintmax_t types
to be defined by the time the test code includes the <cmocka.h> header.
These types are defined in the <stdint.h> header, which is included by
the <inttypes.h> header, which in turn is already explicitly included by
some of the programs in the tests/ directory.  Ensure all programs in
that directory that include the <cmocka.h> header also include the
<inttypes.h> header to future-proof the code while keeping the change
set minimal and the resulting code consistent.  Also prevent explicitly
including the <stdint.h> header in those programs as it is included by
the <inttypes.h> header.

3 years agoMerge tag 'v9.19.13'
Michał Kępień [Thu, 18 May 2023 12:06:04 +0000 (14:06 +0200)] 
Merge tag 'v9.19.13'

BIND 9.19.13

3 years agoMerge branch '4022-three-dnssec-failures-on-fedora-38' into 'main'
Mark Andrews [Thu, 18 May 2023 00:42:17 +0000 (00:42 +0000)] 
Merge branch '4022-three-dnssec-failures-on-fedora-38' into 'main'

Resolve "Three "dnssec" failures on Fedora 38"

Closes #4022

See merge request isc-projects/bind9!7932

3 years agoLet RSASHA1 signing keys be ignored in FIPS mode
Mark Andrews [Tue, 16 May 2023 00:15:00 +0000 (10:15 +1000)] 
Let RSASHA1 signing keys be ignored in FIPS mode

When the FIPS provider is available, RSASHA1 signing keys for zone
"example.com." are ignored if the zone is attempted to be signed with
the dnssec-signzone "-F" (FIPS mode) option:

    "fatal: No signing keys specified or found"

3 years agoMerge branch '4071-placeholder' into 'main'
Michał Kępień [Wed, 17 May 2023 14:28:22 +0000 (14:28 +0000)] 
Merge branch '4071-placeholder' into 'main'

Add placeholder for GL #4071

Closes #4071

See merge request isc-projects/bind9!7941

3 years agoAdd placeholder for GL #4071
Michał Kępień [Wed, 17 May 2023 14:26:39 +0000 (16:26 +0200)] 
Add placeholder for GL #4071

3 years agoMerge branch '4069-upforwd-wait' into 'main'
Tony Finch [Tue, 16 May 2023 15:29:29 +0000 (15:29 +0000)] 
Merge branch '4069-upforwd-wait' into 'main'

Fix the `upforwd` system test

Closes #4069

See merge request isc-projects/bind9!7931

3 years agoCHANGES for [GL #4069]
Tony Finch [Tue, 16 May 2023 12:38:05 +0000 (13:38 +0100)] 
CHANGES for [GL #4069]

[test] Fix the `upforwd` system test to be more reliable,
especially when using thread sanitizer.

3 years agoMatch UQ and UR stats to domain name
Evan Hunt [Mon, 15 May 2023 20:22:24 +0000 (13:22 -0700)] 
Match UQ and UR stats to domain name

The upforwd test for forwarding updates to a dead primary can continue
running a little bit past its end, causing update replies to be
recorded during a subsequent test case. Correct this by only looking
for update requests and replies for the specific domain name being
tested at any given time.

3 years agoFix the `upforwd` system test
Tony Finch [Mon, 15 May 2023 19:04:14 +0000 (20:04 +0100)] 
Fix the `upforwd` system test

After the RCU changes were merged, the `upforwd` test started
consistenly failing when run under thread sanitizer. After some
investigation, it turned out that retry attempts were continuing after
the "update forwarding to dead primary" test. This caused mismatches
in the DNSTAP message counts for the subsequent tests, because they
were also counting retries.

Fix this problem by `wait`ing for the `nsupdate` processes to exit.

While investigating the bug, I replaced several fixed 15 second delays
with `wait_for_log`, so the test runs faster.

3 years agoMerge branch '4066-resolv-conf-parsing-eats-lines-if-more-than-3-nameservers-set...
Mark Andrews [Tue, 16 May 2023 03:25:34 +0000 (03:25 +0000)] 
Merge branch '4066-resolv-conf-parsing-eats-lines-if-more-than-3-nameservers-set' into 'main'

Resolve "resolv.conf parsing eats lines if more than 3 nameservers set"

Closes #4066

See merge request isc-projects/bind9!7922

3 years agoAdd CHANGES for [GL #4066]
Mark Andrews [Mon, 15 May 2023 00:39:50 +0000 (10:39 +1000)] 
Add CHANGES for [GL #4066]

3 years agoProperly process extra nameserver lines in resolv.conf
Mark Andrews [Mon, 15 May 2023 00:34:16 +0000 (10:34 +1000)] 
Properly process extra nameserver lines in resolv.conf

The whole line needs to be read rather than just the token "nameserver"
otherwise the next line in resolv.conf is not properly processed.

3 years agoMerge branch 'fanf-urcu-qsbr-build' into 'main'
Tony Finch [Mon, 15 May 2023 20:49:47 +0000 (20:49 +0000)] 
Merge branch 'fanf-urcu-qsbr-build' into 'main'

Fixes for liburcu-qsbr

Closes #4067

See merge request isc-projects/bind9!7925

3 years agoFixes for liburcu-qsbr
Tony Finch [Mon, 15 May 2023 10:42:33 +0000 (11:42 +0100)] 
Fixes for liburcu-qsbr

Move registration and deregistration of the main thread from
`isc_loopmgr_run()` into `isc__initialize()` / `isc__shutdown()`:
liburcu-qsbr fails an assertion if we try to use it from an
unregistered thread, and we need to be able to use it when the
event loops are not running.

Use `rcu_assign_pointer()` and `rcu_dereference()` in qp-trie
transactions so that they properly mark threads as online. The
RCU-protected pointer is no longer declared atomic because
liburcu does not (yet) use standard C atomics.

Fix the definition of `isc_qsbr_rcu_dereference()` to return
the referenced value, and to call the right function inside
liburcu.

Change the thread sanitizer suppressions to match any variant of
`rcu_*_barrier()`

3 years agoMerge branch '4068-coverity-uv_async_send' into 'main'
Tony Finch [Mon, 15 May 2023 20:49:23 +0000 (20:49 +0000)] 
Merge branch '4068-coverity-uv_async_send' into 'main'

Check the return value from uv_async_send()

Closes #4068

See merge request isc-projects/bind9!7926

3 years agoCheck the return value from uv_async_send()
Tony Finch [Mon, 15 May 2023 14:35:57 +0000 (15:35 +0100)] 
Check the return value from uv_async_send()

An omission pointed out by the following report from Coverity:

    /lib/isc/loop.c: 483 in isc_loopmgr_pause()
    >>>     CID 455002:  Error handling issues  (CHECKED_RETURN)
    >>>     Calling "uv_async_send" without checking return value (as is done elsewhere 5 out of 6 times).
    483      uv_async_send(&loop->pause_trigger);

3 years agoMerge branch 'mnowak/openbsd-7.3' into 'main'
Michal Nowak [Mon, 15 May 2023 17:46:44 +0000 (17:46 +0000)] 
Merge branch 'mnowak/openbsd-7.3' into 'main'

Add OpenBSD 7.3

See merge request isc-projects/bind9!7847

3 years agoAdd OpenBSD 7.3
Michal Nowak [Mon, 17 Apr 2023 16:50:55 +0000 (18:50 +0200)] 
Add OpenBSD 7.3

3 years agoMerge branch 'mnowak/freebsd-13.2' into 'main'
Michal Nowak [Mon, 15 May 2023 16:31:38 +0000 (16:31 +0000)] 
Merge branch 'mnowak/freebsd-13.2' into 'main'

Add FreeBSD 13.2

See merge request isc-projects/bind9!7846

3 years agoAdd FreeBSD 13.2
Michal Nowak [Mon, 17 Apr 2023 16:46:43 +0000 (18:46 +0200)] 
Add FreeBSD 13.2

3 years agoMerge branch '4064-read-timeout-failure' into 'main'
Evan Hunt [Mon, 15 May 2023 16:25:45 +0000 (16:25 +0000)] 
Merge branch '4064-read-timeout-failure' into 'main'

allow streamdns read to resume after timeout

Closes #4064

See merge request isc-projects/bind9!7921

3 years agoallow streamdns read to resume after timeout
Evan Hunt [Sun, 14 May 2023 06:31:45 +0000 (23:31 -0700)] 
allow streamdns read to resume after timeout

when reading on a streamdns socket failed due to timeout, but
the dispatch was still waiting for other responses, it would
resume reading by calling isc_nm_read() again. this caused
an assertion because the socket was already reading.

we now check that either the socket is reading, or that it was
already reading on the same handle.

3 years agoMerge branch 'fanf-urcu-qp' into 'main'
Tony Finch [Fri, 12 May 2023 20:43:30 +0000 (20:43 +0000)] 
Merge branch 'fanf-urcu-qp' into 'main'

Replace isc_qsbr with liburcu-qsbr

Closes #3936 and #4019

See merge request isc-projects/bind9!7668

3 years agoCHANGES note for [GL #3936]
Tony Finch [Thu, 9 Mar 2023 11:11:41 +0000 (11:11 +0000)] 
CHANGES note for [GL #3936]

[cleanup] Refactor the loop manager and qp-trie code to remove
isc_qsbr and use liburcu instead. [GL #3936]

3 years agoRemove the now-unused ISC_STACK
Tony Finch [Fri, 12 May 2023 11:20:42 +0000 (12:20 +0100)] 
Remove the now-unused ISC_STACK

We are using the liburcu concurrent data structures instead.

3 years agoUse per-CPU RCU helper threads
Tony Finch [Fri, 5 May 2023 07:12:35 +0000 (08:12 +0100)] 
Use per-CPU RCU helper threads

Create and free per-CPU helper threads from the main thread and tell
thread sanitizer to suppress leaking threads. (We are not leaking
threads ourselves and we can safely ignore the Userspace-RCU thread
leaks.)

3 years agoHelp thread sanitizer to cope with liburcu
Tony Finch [Thu, 4 May 2023 14:26:13 +0000 (15:26 +0100)] 
Help thread sanitizer to cope with liburcu

All the places the qp-trie code was using `call_rcu()` needed
`__tsan_release()` and `__tsan_acquire()` annotations, so
add a couple of wrappers to encapsulate this pattern.

With these wrappers, the tests run almost clean under thread
sanitizer. The remaining problems are due to `rcu_barrier()`
which can be suppressed using `.tsan-suppress`. It does not
suppress the whole of `liburcu`, because we would like thread
sanitizer to detect problems in `call_rcu()` callbacks, which
are called from `liburcu`.

The CI jobs have been updated to use `.tsan-suppress` by
default, except for a special-case job that needs the
additional suppressions in `.tsan-suppress-extra`.

We might be able to get rid of some of this after liburcu gains
support for thread sanitizer.

Note: the `rcu_barrier()` suppression is not entirely effective:
tsan sometimes reports races that originate inside `rcu_barrier()`
but tsan has discarded the stack so it does not have the
information required to suppress the report. These "races" can
be made much easier to reproduce by adding `atexit_sleep_ms=1000`
to `TSAN_OPTIONS`. The problem with tsan's short memory can be
addressed by increasing `history_size`: when it is large enough
(6 or 7) the `rcu_barrier()` stack usually survives long enough
for suppression to work.

3 years agoAvoid using the zone timer after its loop has gone
Tony Finch [Wed, 3 May 2023 14:29:43 +0000 (15:29 +0100)] 
Avoid using the zone timer after its loop has gone

Shutdown and cleanup of zones is more asynchronous with the qp-trie
zone table. As a result it's possible that some activity is delayed
until after a zone has been released from its zonemanager.

Previously, the dns_zone code was not very strict in the way it
refers to the loop it is running on: The loop pointer was stashed when
dns_zonemgr_managezone() was called and never cleared. Now, zones
properly attach to and detach from their loops.

The zone timer depends on its loop. The shutdown crashes occurred
when asynchronous calls tried to modify the zone timer after
dns_zonemgr_releasezone() has been called and the loop was
invalidated. In these cases the attempt to set the timer is now
ignored, with a debug log message.

3 years agoGet the tests working with liburcu
Tony Finch [Wed, 8 Mar 2023 14:52:30 +0000 (14:52 +0000)] 
Get the tests working with liburcu

Mostly a few qp-trie details to adjust.

3 years agoThe zone table no longer depends on the loop manager
Tony Finch [Thu, 27 Apr 2023 11:47:03 +0000 (12:47 +0100)] 
The zone table no longer depends on the loop manager

This reverts some of the changes in commit b171cacf4f0123ba
because now it isn't necessary to pass the loopmgr around.

3 years agoRefactor the core qp-trie code to use liburcu
Tony Finch [Wed, 8 Mar 2023 14:28:06 +0000 (14:28 +0000)] 
Refactor the core qp-trie code to use liburcu

A `dns_qmpulti_t` no longer needs to know about its loopmgr. We no
longer keep a linked list of `dns_qpmulti_t` that have reclamation
work, and we no longer mark chunks with the phase in which they are to
be reclaimed. Instead, empty chunks are listed in an array in a
`qp_rcu_t`, which is passed to call_rcu().

3 years agoRemove isc_qsbr (we are using liburcu instead)
Tony Finch [Wed, 8 Mar 2023 10:20:16 +0000 (10:20 +0000)] 
Remove isc_qsbr (we are using liburcu instead)

This commit breaks the qp-trie code.

3 years agoSlightly more sanitary thread dispatch
Tony Finch [Wed, 3 May 2023 14:44:36 +0000 (15:44 +0100)] 
Slightly more sanitary thread dispatch

Tell thread sanitizer that the thread wrapper is released before
passing it to a new thread.

3 years agoWait for RCU to finish before destroying a memory context
Tony Finch [Fri, 28 Apr 2023 13:10:03 +0000 (14:10 +0100)] 
Wait for RCU to finish before destroying a memory context

Memory reclamation by `call_rcu()` is asynchronous, so during shutdown
it can lose a race with the destruction of its memory context. When we
defer memory reclamation, we need to attach to the memory context to
indicate that it is still in use, but that is not enough to delay its
destruction. So, call `rcu_barrier()` in `isc_mem_destroy()` to wait
for pending RCU work to finish before proceeding to destroy the memory
context.

3 years agoA macro for the size of a struct with a flexible array member
Tony Finch [Thu, 9 Mar 2023 10:43:53 +0000 (10:43 +0000)] 
A macro for the size of a struct with a flexible array member

It can be fairly long-winded to allocate space for a struct with a
flexible array member: in general we need the size of the struct, the
size of the member, and the number of elements. Wrap them all up in a
STRUCT_FLEX_SIZE() macro, and use the new macro for the flexible
arrays in isc_ht and dns_qp.

3 years agoMerge branch '4046-rndc-t-option' into 'main'
Evan Hunt [Fri, 12 May 2023 19:37:36 +0000 (19:37 +0000)] 
Merge branch '4046-rndc-t-option' into 'main'

add 'rndc -t' option to set timeout

Closes #4046

See merge request isc-projects/bind9!7889

3 years agoCHANGES and release note for part 2 of [GL #4046]
Evan Hunt [Wed, 3 May 2023 21:34:39 +0000 (14:34 -0700)] 
CHANGES and release note for part 2 of [GL #4046]

3 years agoadd 'rndc -t' option to set timeout
Evan Hunt [Wed, 3 May 2023 21:28:37 +0000 (14:28 -0700)] 
add 'rndc -t' option to set timeout

Allow an arbitrary TCP timeout value to be specified when running
rndc, so that commands that take a long time to execute (for example,
reloading a very large configuration) can be given time to do so.

3 years agoMerge branch '4054-zone_resigninc-bugfix' into 'main'
Arаm Sаrgsyаn [Fri, 12 May 2023 13:37:46 +0000 (13:37 +0000)] 
Merge branch '4054-zone_resigninc-bugfix' into 'main'

zone_resigninc(): check whether zone->db is a valid pointer before attaching

Closes #4054

See merge request isc-projects/bind9!7914

3 years agoAdd a CHANGES note for [GL #4054]
Aram Sargsyan [Thu, 11 May 2023 12:20:58 +0000 (12:20 +0000)] 
Add a CHANGES note for [GL #4054]

3 years agoCheck whether zone->db is a valid pointer before attaching
Aram Sargsyan [Thu, 11 May 2023 12:08:13 +0000 (12:08 +0000)] 
Check whether zone->db is a valid pointer before attaching

The zone_resigninc() function does not check the validity of
'zone->db', which can crash named if the zone was unloaded earlier,
for example with "rndc delete".

Check that 'zone->db' is not 'NULL' before attaching to it, like
it is done in zone_sign() and zone_nsec3chain() functions, which
can similarly be called by zone maintenance.

3 years agoMerge branch 'ondrej/convert-isc_async-to-use-urcu-wfcqueue' into 'main'
Ondřej Surý [Fri, 12 May 2023 13:24:27 +0000 (13:24 +0000)] 
Merge branch 'ondrej/convert-isc_async-to-use-urcu-wfcqueue' into 'main'

Change the isc_async and isc_quota API to use cds_wfcqueue internally

See merge request isc-projects/bind9!7894

3 years agoAdd Userspace-RCU to global CFLAGS and LIBS
Ondřej Surý [Tue, 9 May 2023 11:38:37 +0000 (13:38 +0200)] 
Add Userspace-RCU to global CFLAGS and LIBS

The Userspace-RCU headers are now needed for more parts of the libisc
and libdns, thus we need to add it globally to prevent compilation
failures on systems with non-standard Userspace-RCU installation path.

3 years agoChange the isc_quota API to use cds_wfcqueue internally
Ondřej Surý [Mon, 8 May 2023 21:31:54 +0000 (23:31 +0200)] 
Change the isc_quota API to use cds_wfcqueue internally

The isc_quota API was using locked list of isc_job_t objects to keep the
waiting TCP accepts.  Change the isc_quota implementation to use
cds_wfcqueue internally - the enqueue is wait-free and only dequeue
needs to be locked.

3 years agoAdjust the udp_shutdown_connect to delay the check
Ondřej Surý [Tue, 9 May 2023 08:24:37 +0000 (10:24 +0200)] 
Adjust the udp_shutdown_connect to delay the check

The teardown jobs are not executed immediately, so we need to delay the
check for ISC_R_SHUTTINGDOWN even more (as the UDP connect is
synchronous, it makes it harder to test it).

3 years agoChange the isc_async API to use cds_wfcqueue internally
Ondřej Surý [Mon, 8 May 2023 21:31:54 +0000 (23:31 +0200)] 
Change the isc_async API to use cds_wfcqueue internally

The isc_async API was using lock-free stack (where enqueue operation was
not wait-free).  Change the isc_async to use cds_wfcqueue internally -
enqueue and splice (move the queue members from one list to another) is
nonblocking and wait-free.

3 years agoMerge branch '4045-refactor-rbtdb-glue_cache' into 'main'
Ondřej Surý [Fri, 12 May 2023 11:26:58 +0000 (11:26 +0000)] 
Merge branch '4045-refactor-rbtdb-glue_cache' into 'main'

Replace glue_cache hashtable with direct link in rdatasetheader

Closes #4045

See merge request isc-projects/bind9!7895

3 years agoAdd CHANGES and release note for [GL #4045]
Ondřej Surý [Tue, 9 May 2023 12:53:28 +0000 (14:53 +0200)] 
Add CHANGES and release note for [GL #4045]

3 years agoReplace glue_cache hashtable with direct link in rdatasetheader
Ondřej Surý [Wed, 3 May 2023 17:38:05 +0000 (19:38 +0200)] 
Replace glue_cache hashtable with direct link in rdatasetheader

Instead of having a global hashtable with a global rwlock for the GLUE
cache, move the glue_list directly into rdatasetheader and use
Userspace-RCU to update the pointer when the glue_list is empty.

Additionally, the cached glue_lists needs to be stored in the RBTDB
version for early cleaning, otherwise the circular dependencies between
nodes and glue_lists will prevent nodes to be ever cleaned up.

3 years agoMerge branch 'mnowak/coverity-scan-2022.12' into 'main'
Michal Nowak [Fri, 12 May 2023 08:13:42 +0000 (08:13 +0000)] 
Merge branch 'mnowak/coverity-scan-2022.12' into 'main'

Use the latest Coverity Scan

See merge request isc-projects/bind9!7881

3 years agoUse the latest Coverity Scan
Michal Nowak [Wed, 3 May 2023 09:55:57 +0000 (11:55 +0200)] 
Use the latest Coverity Scan

3 years agoMerge branch '4050-cdnskey-no' into 'main'
Matthijs Mekking [Fri, 12 May 2023 07:46:17 +0000 (07:46 +0000)] 
Merge branch '4050-cdnskey-no' into 'main'

Add option to not generate CDNSKEY record

Closes #4050

See merge request isc-projects/bind9!7917

3 years agoAdd release note and CHANGES for cdnskey option
Matthijs Mekking [Thu, 11 May 2023 14:20:47 +0000 (16:20 +0200)] 
Add release note and CHANGES for cdnskey option

3 years agoRead from kasp whether to publish CDNSKEY
Matthijs Mekking [Thu, 11 May 2023 14:15:57 +0000 (16:15 +0200)] 
Read from kasp whether to publish CDNSKEY

Check the policy and feed 'dns_dnssec_syncupdate() the right value
to enable/disable CDSNKEY publication.

3 years agoAdd test case for cdnskey no;
Matthijs Mekking [Thu, 11 May 2023 13:13:03 +0000 (15:13 +0200)] 
Add test case for cdnskey no;

Change one of the test cases to disable publication of CDNSKEY.

3 years agoAdd configuration option 'cdnskey'
Matthijs Mekking [Thu, 11 May 2023 12:11:45 +0000 (14:11 +0200)] 
Add configuration option 'cdnskey'

Add the 'cdnskey' configuration option to 'dnssec-policy'.

3 years agoAdd functions to set CDNSKEY publication
Matthijs Mekking [Thu, 11 May 2023 12:00:58 +0000 (14:00 +0200)] 
Add functions to set CDNSKEY publication

Add kasp API functions to enable/disable publication of CDNSKEY records.

3 years agoMerge branch 'mnowak/pytest_rewrite_ttl' into 'main'
Michal Nowak [Thu, 11 May 2023 14:09:42 +0000 (14:09 +0000)] 
Merge branch 'mnowak/pytest_rewrite_ttl' into 'main'

Rewrite the ttl system test to pytest

See merge request isc-projects/bind9!7896

3 years agoRewrite the ttl system test to pytest
Michal Nowak [Thu, 4 May 2023 18:05:30 +0000 (20:05 +0200)] 
Rewrite the ttl system test to pytest

3 years agoMerge branch 'mnowak/clang-16' into 'main'
Michal Nowak [Thu, 11 May 2023 12:18:16 +0000 (12:18 +0000)] 
Merge branch 'mnowak/clang-16' into 'main'

Bump the LLVM version to 16

See merge request isc-projects/bind9!7721

3 years agoUpdate sources to Clang 16 formatting
Michal Nowak [Thu, 30 Mar 2023 17:08:41 +0000 (19:08 +0200)] 
Update sources to Clang 16 formatting

3 years agoUpdate clang to version 16
Michal Nowak [Fri, 24 Mar 2023 10:18:09 +0000 (11:18 +0100)] 
Update clang to version 16

3 years agoMerge branch '4023-nsupdate-disable-asan-for-fatal-cases' into 'main'
Michal Nowak [Thu, 11 May 2023 11:41:47 +0000 (11:41 +0000)] 
Merge branch '4023-nsupdate-disable-asan-for-fatal-cases' into 'main'

Disable ASAN in nsupdate for fatal cases

Closes #4023

See merge request isc-projects/bind9!7871

3 years agoDisable ASAN in nsupdate for fatal cases
Michal Nowak [Thu, 27 Apr 2023 08:30:54 +0000 (10:30 +0200)] 
Disable ASAN in nsupdate for fatal cases

Clang 16 LeakSanitizer reports a memory leak when dns_request_create()
returned a TLS error in the nsupdate system test. While technically a
memory leak on error handling, it's not a problem because the program is
immediately terminated; nsupdate is not expected to run for a prolonged
time.

3 years agoMerge branch 'fanf-noreturn-lossage' into 'main'
Tony Finch [Thu, 11 May 2023 10:41:01 +0000 (10:41 +0000)] 
Merge branch 'fanf-noreturn-lossage' into 'main'

Avoid lossage from <stdnoreturn.h>

See merge request isc-projects/bind9!7906

3 years agoAvoid lossage from <stdnoreturn.h>
Tony Finch [Wed, 10 May 2023 16:15:21 +0000 (17:15 +0100)] 
Avoid lossage from <stdnoreturn.h>

A few of the source files in `tests/ns` included `<isc/util.h>`
before `<cmocka.h>`. This could cause compile failures because the
`CMOCKA_NORETURN` macro is defined as `__attribute__((noreturn))`
and `<stdnoreturn.h>` defines `noreturn` as `_Noreturn` which does
not work as a gcc-style attribute.

3 years agoMerge branch 'mnowak/pytest_rewrite_hooks' into 'main'
Michal Nowak [Thu, 11 May 2023 10:26:33 +0000 (10:26 +0000)] 
Merge branch 'mnowak/pytest_rewrite_hooks' into 'main'

Rewrite the hooks system test to pytest

See merge request isc-projects/bind9!7883

3 years agoRewrite the hooks system test to pytest
Michal Nowak [Wed, 3 May 2023 18:06:38 +0000 (20:06 +0200)] 
Rewrite the hooks system test to pytest

Also, enable the test under TSAN.

3 years agoMerge branch '4049-detect-formerr-with-an-echoed-dns-cookie-client-cookie-and-retry...
Mark Andrews [Thu, 11 May 2023 01:16:19 +0000 (01:16 +0000)] 
Merge branch '4049-detect-formerr-with-an-echoed-dns-cookie-client-cookie-and-retry-without-dns-cookie' into 'main'

Resolve "Detect FORMERR with an echoed DNS COOKIE client cookie and retry without DNS COOKIE"

Closes #4049

See merge request isc-projects/bind9!7888

3 years agoAdd CHANGES note for [GL #4049]
Mark Andrews [Mon, 8 May 2023 09:39:54 +0000 (19:39 +1000)] 
Add CHANGES note for [GL #4049]

3 years agoCheck fallback on FORMERR to EDNS options
Mark Andrews [Mon, 8 May 2023 06:26:29 +0000 (16:26 +1000)] 
Check fallback on FORMERR to EDNS options

3 years agoAdd a server which returns FORMERR to all EDNS options
Mark Andrews [Mon, 8 May 2023 06:07:19 +0000 (16:07 +1000)] 
Add a server which returns FORMERR to all EDNS options

The server also echoes back the EDNS options and EDNS flags.

3 years agoHandle FORMERR on unknown EDNS option that are echoed
Mark Andrews [Mon, 8 May 2023 07:39:51 +0000 (17:39 +1000)] 
Handle FORMERR on unknown EDNS option that are echoed

If the resolver received a FORMERR response to a request with
an DNS COOKIE option present that echoes the option back, resend
the request without an DNS COOKIE option present.

3 years agoMerge branch '4039-dighost-fix-double-shutdown-call' into 'main'
Arаm Sаrgsyаn [Wed, 10 May 2023 11:36:23 +0000 (11:36 +0000)] 
Merge branch '4039-dighost-fix-double-shutdown-call' into 'main'

dighost.c: don't call check_if_done() twice successively

Closes #4039

See merge request isc-projects/bind9!7878

3 years agoAdd a CHANGES note for [GL #4039]
Aram Sargsyan [Tue, 2 May 2023 13:21:35 +0000 (13:21 +0000)] 
Add a CHANGES note for [GL #4039]

3 years agodighost.c: don't call check_if_done() twice successively
Aram Sargsyan [Tue, 2 May 2023 12:24:34 +0000 (12:24 +0000)] 
dighost.c: don't call check_if_done() twice successively

The check_if_done() function can pass control back out to
dighost_shutdown() (which is part of dig.c, host.c, or nslookup.c),
and calling that twice can cause unexpected problems, if it is not
designed to be idempotent.

Since cancel_lookup() calls check_if_done() implicitly, don't call
check_if_done() again when 'next' is NULL.

3 years agoMerge branch 'tkrizek/shutdown-test-exc-handling' into 'main'
Tom Krizek [Wed, 10 May 2023 10:54:48 +0000 (10:54 +0000)] 
Merge branch 'tkrizek/shutdown-test-exc-handling' into 'main'

Ensure named always terminates in the shutdown test

See merge request isc-projects/bind9!7819

3 years agoReplace dnspython resolver.query with resolver.resolve
Tom Krizek [Thu, 6 Apr 2023 12:33:27 +0000 (14:33 +0200)] 
Replace dnspython resolver.query with resolver.resolve

The resolver.query() has been deprecated in favor of resolver.resolve();
used that.

This is an omission from 3b1756d45012a66f08693c17145a8484ec68bd47

3 years agoEnsure named always terminates in the shutdown test
Tom Krizek [Thu, 6 Apr 2023 12:05:30 +0000 (14:05 +0200)] 
Ensure named always terminates in the shutdown test

Previously, if an exception would happen inside the `with` block, the
error handler would wait indefinitely for the process to end. That would
never happen, since the termination signal was never sent to named and
the test would get stuck.

Using the try-finally block ensures that the named process is always
killed and any exception or errors will be handled gracefully.