2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

42507 Commits

Author SHA1 Message Date
Michał Kępień
da23a0c4e1 Update CVE checklist 2025-02-11 17:34:52 +01:00
Andoni Duarte Pintado
8a742d084f Tweak and reword release notes 2025-02-11 17:34:52 +01:00
Andoni Duarte Pintado
b23b0d991a Prepare release notes for BIND 9.21.5 2025-02-11 17:34:52 +01:00
Andoni Duarte Pintado
af174fe816 Generate changelog for BIND 9.21.5 2025-02-11 17:34:52 +01:00
Michal Nowak
9b15715558 fix: ci: Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.

Merge branch 'mnowak/fix-CI_PROJECT_DIR-variable-evaluation' into 'main'

See merge request isc-projects/bind9!10075
2025-02-05 15:01:03 +00:00
Michal Nowak
dab7d28b09
Do not evaluate $CI_PROJECT_DIR in generate-stress-test-configs.py
GitLab CI Runner's $builds_dir variable is set to "/builds" by default.
For technical reasons, the FreeBSD Runners, using the "instance"
executor, sets the path differently.

The value of $CI_PROJECT_DIR is based on $builds_dir, so if the
generate-stress-test-configs.py script generates jobs with
$CI_PROJECT_DIR (or variables like $INSTALL_PATH that are based on it)
evaluated, it is calcified to whatever was the value in the particular
environment, disregarding the FreeBSD "instance" executor specifics in
the child pipeline.

Instead of evaluating $CI_PROJECT_DIR in the script, evaluate it in the
runtime environment.
2025-02-05 15:46:14 +01:00
Ondřej Surý
d4a7bff0b6 fix: dev: Reduce the false sharing the dns_qpcache and dns_qpzone
Instead of having many node_lock_count * sizeof(<member>) arrays, pack all
the members into a qpcache_bucket_t that is cacheline aligned to prevent
false sharing between RWLocks.

Merge branch 'ondrej/prevent-nodelock-false-sharing' into 'main'

See merge request isc-projects/bind9!10072
2025-02-04 22:24:20 +00:00
Ondřej Surý
732fc338a9
Switch the locknum generation for qpznode to random
Instead of using on hash of the name modulo number of the buckets,
assign the locknum randomly with isc_random_uniform().  This makes
the locknum assignment aligned with qpcache and allows the bucket
number to be non-prime in the future.
2025-02-04 22:50:49 +01:00
Ondřej Surý
1fa5219fdf
Rely on call_rcu() to destroy the qpzone outside of locks
Reduce the number of qpzone_ref() and qpzone_unref() calls in
qpzone_detachnode() by relying on the call_rcu to delay
the destruction of the lock buckets.
2025-02-04 21:37:46 +01:00
Ondřej Surý
6dcc398726
Reduce false sharing in dns_qpzone
Instead of having many node_lock_count * sizeof(<member>) arrays, pack
all the members into a qpzone_bucket_t that is cacheline aligned and have
a single array of those.
2025-02-04 21:37:46 +01:00
Ondřej Surý
c602d76c1f
Reduce false sharing in dns_qpcache
Instead of having many node_lock_count * sizeof(<member>) arrays, pack
all the members into a qpcache_bucket_t struct that is cacheline aligned
and have a single array of those.

Additionaly, make both the head and the tail of isc_queue_t padded, not
just the head, to prevent false sharing of the lock-free structure with
the lock that follows it.
2025-02-04 21:37:46 +01:00
Michal Nowak
a1ca49683a chg: test: Rewrite stub system test to pytest
Merge branch 'mnowak/pytest_rewrite_stub' into 'main'

See merge request isc-projects/bind9!9190
2025-02-04 12:38:25 +00:00
Michal Nowak
1069eb1969 Rewrite stub system test to pytest 2025-02-04 12:35:38 +00:00
Michal Nowak
b19fb37080 Add isctest.check.notauth() 2025-02-04 12:35:38 +00:00
Nicki Křížek
a24f71bae4 Allow to use an arbitrary numeric identifier for NamedInstance
In some cases, the numeric identifier doesn't correspond to the
directory name (i.e. `resolver` server in `shutdown` test, which is
supposed to be 10.53.0.3). These are typically servers that shouldn't be
auto-started by the runner, thus avoiding the typical `*ns<X>` name.

Support these server by allowing a fallback initialization with custom
numeric identifier in case it can't be parsed from the directory name.
2025-02-04 12:35:38 +00:00
Nicki Křížek
37699ad84b Add start/stop wrappers to control NamedInstance
The start()/stop() functions can be used in the pytests in the same way
as start_server and stop_server functions were used in shell tests. Note
that the servers obtained through the servers fixture are still started
and stopped by the test runner at the start and end of the test. This
makes these functions mostly useful for restarting the server(s)
mid-test.
2025-02-04 12:35:38 +00:00
Nicki Křížek
b6d645410c Move shell and perl util functions to isctest.run
Previously, these functions have been provided as fixtures. This was
limiting re-use, because it wasn't possible to call these outside of
tests / other fixtures without passing these utility functions around.
Move them into isctest.run package instead.
2025-02-04 12:35:38 +00:00
Michal Nowak
d2f6e236a2 fix: ci: Supress the leak detection in __xmlDefaultBufferSize
Closes #5157

Merge branch '5157-suppress-lsan-libxml2-leak' into 'main'

See merge request isc-projects/bind9!10067
2025-02-04 12:34:41 +00:00
Michal Nowak
ca859563aa Supress the leak detection in __xmlDefaultBufferSize 2025-02-04 12:34:02 +00:00
Arаm Sаrgsyаn
166c324142 chg: usr: Include destination address port number in query logging
When query logging is enabled, named will now include the destination
address port in the logged message.

Closes #5060

Merge branch '5060-log-query-incoming-port' into 'main'

See merge request isc-projects/bind9!9972
2025-02-04 11:48:52 +00:00
Aram Sargsyan
19843f6c9d Include destination address port number in query logging
When query logging is enabled, named will now include the destination
address port in the logged message.

Example messages for before and after this change:

    before: client @0x7608b2026000 10.53.0.1#52136 (example.test): query: example.test IN A +E(0)K (10.53.0.1)
    after:  client @0x729bf5c26000 10.53.0.1#35976 (example.test): query: example.test IN A +E(0)K (10.53.0.1#53)
2025-02-04 10:49:26 +00:00
Mark Andrews
f8802cbfa0 fix: test: Fix 'ans' servers so they respond with consistent answers to NS queries at QNAME.
The ANS servers were not to written to handle NS queries at the QNAME, resulting in gratuitous protocol errors that will break tests when NS requests are made for the QNAME: i.e., NXDOMAIN for NS vs data for expected type,  CNAME not being returned for all query types.

Prerequisite for !9155 

Closes #5062

Merge branch '5062-fix-ans-servers-ns-at-qname' into 'main'

See merge request isc-projects/bind9!9786
2025-02-04 02:35:33 +00:00
Mark Andrews
0680eb6f64 Fix gratuitious DNS protocol errors in the ANS servers
The ANS servers were not to written to handle NS queries at the
QNAME resulting in gratuitious protocol errors that will break tests
when NS requests are made for the QNAME.
2025-02-04 12:49:50 +11:00
Ondřej Surý
ae73ac81a3 new: usr: Print the expiration time of the stale records
Print the expiration time of the stale RRsets in the cache dump.

Merge branch 'ondrej/print-expiration-time-of-stale-records' into 'main'

See merge request isc-projects/bind9!10057
2025-02-03 15:18:31 +00:00
Ondřej Surý
355fc48472
Print the expiration time of the stale records (not ancient)
In #1870, the expiration time of ANCIENT records were printed, but
actually the ancient records are very short lived, and the information
carries a little value.

Instead of printing the expiration of ANCIENT records, print the
expiration time of STALE records.
2025-02-03 15:47:06 +01:00
Ondřej Surý
517c5b6b28 fix: usr: Recently expired records could be returned with timestamp in future
Under rare circumstances, the RRSet that expired at the time of
the query could be returned with TTL far in the future.  This
has been fixed.

As a side-effect, the expiration time of expired RRSets are no
longer printed out in the cache dump.

Closes #5094

Merge branch '5094-fix-timestamp-in-ttl' into 'main'

See merge request isc-projects/bind9!10048
2025-02-03 13:39:39 +00:00
Ondřej Surý
36a3ceb19f
Restore the .ttl field for slabheader in dns_qpzone
The original .ttl field was actually used as TTL in the dns_qpzone unit.
Restore the field by adding it to union with the .expire struct member
and cleanup all the code that added or subtracted 'now' from the ttl
field as that was misleading as 'now' would be always 0 for qpzone
database.
2025-02-03 14:39:06 +01:00
Ondřej Surý
60f6b88c63
Remove duplicate 'now' argument from find_coveringnsec()
The find_coveringnsec() was getting the 'now' from two sources -
search->now and separate now argument.  Things like this are ticking
bombs, remove the extra 'now' argument and use single source of 'now'.
2025-02-03 14:39:06 +01:00
Ondřej Surý
58179e6a19
Expand the usage of mark_ancient() helper functions
When the mark_ancient() helper function was introduced, couple of places
with duplicate (or almost duplicate) code was missed.  Move the
mark_ancient() function closer to the top of the file, and correctly use
it in places that mark the header as ANCIENT.
2025-02-03 14:39:06 +01:00
Ondřej Surý
cfee6aa565
Add better ZEROTTL handling in bindrdataset()
If we know that the header has ZEROTTL set, the server should never send
stale records for it and the TTL should never be anything else than 0.
The comment was already there, but the code was not matching the
comment.
2025-02-03 14:39:06 +01:00
Ondřej Surý
e07f5a4a5b
In dns_slabheader_t structure, change .ttl to .expire
The old name was misleading as it never meant time-to-live, e.g. number
of seconds from now when the header should expire.  The true meaning was
an expiration time e.g. now + ttl.  This was the original design bug
that caused the slip when we assigned header->ttl to rdataset->ttl.
Because the name was matching, nobody has questioned the correctness of
the code both during the MR review and during the numerous re-reviews
when we were searching for the cause of the 54 year TTL.
2025-02-03 14:39:06 +01:00
Ondřej Surý
1bbb57f81b
In cache, set rdataset TTL to 0 when the header is not active
When the header has been marked as ANCIENT, but the ttl hasn't been
reset (this happens in couple of places), the rdataset TTL would be
set to the header timestamp instead to a reasonable TTL value.

Since this header has been already expired (ANCIENT is set), set the
rdataset TTL to 0 and don't reuse this field to print the expiration
time when dumping the cache.  Instead of printing the time, we now
just print 'expired (awaiting cleanup'.
2025-02-03 14:39:06 +01:00
Mark Andrews
d9eb272b69 fix: usr: validate adb fetches
ADB responses were not being validated, allowing spoofed responses to be accepted and used for further lookups. This should not be possible when the servers for the zone are in a signed zone, except with CD=1 requests or when glue is needed. This has been fixed.

Closes #5066

Merge branch '5066-validate-adb-fetches' into 'main'

See merge request isc-projects/bind9!10052
2025-02-03 02:18:09 +00:00
Mark Andrews
88c31fdd52 Check recovery from spoofed server addresses
Named was failing to recover when spoofed nameserver address from
a signed zone for a peer zone were returned to a previous CD=1
query. Validate non-glue interior server addresses before using them.
2025-02-03 00:24:34 +00:00
Mark Andrews
6469ebd08e Set PENDINGOK if STARTATZONE is set
When there are parent and child zones on the same server, the DNSKEY
lookup was failing as the pending record we are validating is needed
to fetch the DNSKEY records.  This change allows that to happen.
The caller is already setting STARTATZONE when the name being looked
up is a subdomain of the current domain.
2025-02-03 00:24:34 +00:00
Mark Andrews
ea9d7080cd Validate address lookups from ADB
The address lookups from ADB were not being validated, allowing
spoofed responses to be accepted and used for other lookups.

Validate the answers except when CD=1 is set in the triggering
request.  Separate ADB names looked up with CD=1 from those without
CD=1, to prevent the use of unvalidated answers in the normal lookup
case (CD=0).  Set the TTL on unvalidated (pending) responses to
ADB_CACHE_MINIMUM when adding them to the ADB.
2025-02-03 00:24:34 +00:00
Ondřej Surý
282b0ed514 fix: dev: Fix the cache findzonecut() implementation
The search for the deepest known zone cut in the cache could improperly reject a node if it contained any stale data, regardless of whether it was the NS RRset that was stale.

Closes #5155

Merge branch '5155-fix-findzonecut' into 'main'

See merge request isc-projects/bind9!10047
2025-02-02 18:54:24 +00:00
Evan Hunt
1f095b902c
fix the cache findzonecut implementation
the search for the deepest known zone cut in the cache could
improperly reject a node containing stale data, even if the
NS rdataset wasn't the data that was stale.

this change also improves the efficiency of the search by
stopping it when both NS and RRSIG(NS) have been found.
2025-02-02 18:43:50 +01:00
Petr Špaček
32518f7de3 fix: ci: Fix shell escaping in post-merge before_script
Merge branch 'pspacek/no-cross-project-after-merge-jobs-fix' into 'main'

See merge request isc-projects/bind9!10042
2025-01-31 13:34:59 +00:00
Petr Špaček
6276e0b23b Fix shell escaping in post-merge before_script
Fixup for commit 60140607740bf8e07c0f223c18798bef36ef439c
"Do not trigger post-merge jobs for cross-project pushes".

Related: isc-projects/bind9!10029
2025-01-31 14:20:09 +01:00
Petr Špaček
98325fabeb fix: ci: Do not trigger post-merge jobs for cross-project pushes
Merge branch 'pspacek/no-cross-project-after-merge-jobs' into 'main'

See merge request isc-projects/bind9!10029
2025-01-31 12:10:41 +00:00
Petr Špaček
6014060774 Do not trigger post-merge jobs for cross-project pushes
We need to avoid double-triggering of post-merge jobs in the following
scenario:

 1. A private MR gets merged into the private BIND 9 repository.

 2. This merge operation triggers a "push" pipeline in the private
    repository, which correctly runs post-merge jobs, e.g. to set MR
    metadata in the private project.

 3. When a release is published, a script is run to change the
    automatically assigned milestone value ("Not released yet") to
    something else.

 4. Shortly afterwards, the result of the merge from step 1 is merged
    back into a maintenance branch in the public repository.

 5. The push operation triggers another "push" pipeline, this time in
    the public project.

At this point there are two problems:

  - If the script is dumb (like it currently is), it will extract the
    merge request ID from the merge commit description and change the
    milestone for a merge request in the wrong project namespace.

  - Even if the script was fixed to extract and use the correct GitLab
    project reference, it would reset the milestone for the merge
    request in the private repository back to "Not released yet" - while
    the milestone set in step 3 should be retained.

An alternative would be to change the order of operations so that
post-release milestoning happens at a later stage, while also fixing the
script to correctly follow cross-project references, but that approach
seems more fragile than simply failing on all cross-project pushes.  The
rule to enforce is: each project should only take care of its own
post-merge tasks.
2025-01-31 13:07:57 +01:00
Michał Kępień
5a688130e5 chg: nil: Update CVE checklist
This MR adds an extra CVE checklist step suggested by @pspacek after
CVE-2024-0760.  See [Mattermost][1] for context.

It also syncs checklist steps with their corresponding links to the
explanations wiki page as these have been out-of-sync since !9307.

[1]: https://mattermost.isc.org/isc/pl/156npi4bwtr6pechbj6sfs6jjo

Merge branch 'michal/update-cve-checklist' into 'main'

See merge request isc-projects/bind9!9949
2025-01-31 11:27:51 +00:00
Michał Kępień
35604a2cad
Sync checklist steps with links to explanations 2025-01-31 12:26:10 +01:00
Michał Kępień
ebeafd93ad
Update CVE checklist 2025-01-31 12:26:10 +01:00
Michał Kępień
0ba2b5585d chg: ci: Use default cloning depth for the Danger CI job
With shallow fetching working reliably in pygit2 1.17.0+, there is no
longer any need for GitLab CI runners to clone the BIND 9 repository
with a fixed depth of 1000 during every "danger" CI job as Hazard is now
able to fetch remote refs with an arbitrary depth, controlled by the
HAZARD_FETCH_DEPTH environment variable.  The latter can be defined via
GitLab project's CI settings and adjusted as needed over time, without
the need to update .gitlab-ci.yml every time its value needs to be
changed.

Merge branch 'michal/use-default-cloning-depth-for-the-danger-ci-job' into 'main'

See merge request isc-projects/bind9!9946
2025-01-31 09:26:25 +00:00
Michał Kępień
e39e7afc16
Use default cloning depth for the Danger CI job
With shallow fetching working reliably in pygit2 1.17.0+, there is no
longer any need for GitLab CI runners to clone the BIND 9 repository
with a fixed depth of 1000 during every "danger" CI job as Hazard is now
able to fetch remote refs with an arbitrary depth, controlled by the
HAZARD_FETCH_DEPTH environment variable.  The latter can be defined via
GitLab project's CI settings and adjusted as needed over time, without
the need to update .gitlab-ci.yml every time its value needs to be
changed.
2025-01-31 10:25:56 +01:00
Evan Hunt
f43bf94ece chg: dev: Refactor decref() in both QPDB
Clean up the pattern in the newref() and decref() functions in QP databases.  Replace the `db_nodelock_t` structure with plain reference counting for every active database node in QPDB.

Related to #5134

Merge branch '5134-refactor-decref-functions-in-qpdb' into 'main'

See merge request isc-projects/bind9!10006
2025-01-31 04:45:07 +00:00
Evan Hunt
d4f791793e Clarify reference counting in QP databases
Change the names of the node reference counting functions
and add comments to make the mechanism easier to understand:

- newref() and decref() are now called qpcnode_acquire()/
  qpznode_acquire() and qpcnode_release()/qpznode_release()
  respectively; this reflects the fact that they modify both
  the internal and external reference counters for a node.

- qpcnode_newref() and qpznode_newref() are now called
  qpcnode_erefs_increment() and qpznode_erefs_increment(), and
  qpcnode_decref() and qpznode_decref() are now called
  qpcnode_erefs_decrement() and qpznode_erefs_decrement(),
  to reflect that they only increase and decrease the node's
  external reference counters, not internal.
2025-01-30 20:08:46 -08:00
Ondřej Surý
431513d8b3
Remove db_nodelock_t in favor of reference counted qpdb
This removes the db_nodelock_t structure and changes the node_locks
array to be composed only of isc_rwlock_t pointers.  The .reference
member has been moved to qpdb->references in addition to
common.references that's external to dns_db API users.  The .exiting
members has been completely removed as it has no use when the reference
counting is used correctly.
2025-01-30 16:43:02 +01:00