Commit Graph
35782 Commits
Author SHA1 Message Date
Michał Kępień 52fe0b6be7 Account for changes to struct dns_rbtnode
Commit 540a5b5a2c modified the definition
of struct dns_rbtnode.  Doing that changes the layout of map-format zone
files.  Bump MAPAPI and update the offsets used in map-format zone file
checks in the "masterformat" system test, as these changes were
inadvertently omitted from the aforementioned change.
2024-03-07 09:42:38 +01:00
Michał Kępień 834c1cee09 Merge branch '4621-fix-cache-pruning-after-rndc-flush-9.16.49' into 'v9.16.49-release'
[9.16.49] Move the task creation into cache_create_db()

See merge request isc-projects/bind9!8836
2024-03-06 18:28:43 +00:00
Ondřej SurýandMichał Kępień b69383b9c3 Add CHANGES and release note for [GL #4621]
(cherry picked from commit bde5e18cb1)
2024-03-06 19:17:32 +01:00
Ondřej SurýandMichał Kępień 5f98eba608 Move the task creation into cache_create_db()
The dns_cache_flush() drops the old database and creates a new one, but
it forgets to create the task(s) that runs the node pruning and cleaning
the rbtdb when flushing it next time.  This causes the cleaning to skip
cleaning the parent nodes (with .down == NULL) leading to increased
memory usage over time until the database is unable to keep up and just
stays overmem all the time.

(cherry picked from commit d4bc4e5cc6)
2024-03-06 19:17:32 +01:00
Ondřej SurýandMichał Kępień eba7fb5f9f Create a second pruning task for rbtdb with unlimited quantum
Previously, rbtdb->task had quantum of 1 because it was originally used
just for freeing RBTDB contents, which can happen on a "best effort"
basis (does not need to be prioritized).  However, when tree pruning was
implemented, it also started sending events to that task, enabling the
latter to become clogged up with a significant event backlog because it
only pruned a single RBTDB node per event.

To prioritize tree pruning (as it is necessary for enforcing the
configured memory use limit for the cache memory context), create a
second task with a virtually unlimited quantum (UINT_MAX) and send the
tree-pruning events to this new task, to ensure that all nodes scheduled
for pruning will be processed before further nodes are queued in a
similar fashion.

This change enables dropping the prunenodes list and restoring the
originally-used logic that allocates and sends a separate event for each
node to prune.

(cherry picked from commit 540a5b5a2c)
2024-03-06 19:17:32 +01:00
Ondřej SurýandMichał Kępień a548312191 Restore the parent cleaning logic in prune_tree()
Reconstruct the variant of the prune_tree() parent cleaning to consider
all elibible parents in a single loop as we were doing before all the
changes that led to this commit.

Update code comments so that they more precisely describe what the
relevant bits of code actually do.

(cherry picked from commit 12c42a6c07)
2024-03-06 19:17:32 +01:00
Michał Kępień 336096cdd1 Merge branch '4621-fix-cache-pruning-after-rndc-flush-9.16' into 'bind-9.16'
[9.16] Move the task creation into cache_create_db()

See merge request isc-projects/bind9!8831
2024-03-06 18:16:26 +00:00
Ondřej SurýandMichał Kępień bde5e18cb1 Add CHANGES and release note for [GL #4621]
(cherry picked from commit 79ee08c337)
2024-03-06 18:43:49 +01:00
Ondřej SurýandMichał Kępień d4bc4e5cc6 Move the task creation into cache_create_db()
The dns_cache_flush() drops the old database and creates a new one, but
it forgets to create the task(s) that runs the node pruning and cleaning
the rbtdb when flushing it next time.  This causes the cleaning to skip
cleaning the parent nodes (with .down == NULL) leading to increased
memory usage over time until the database is unable to keep up and just
stays overmem all the time.

(cherry picked from commit 79040a669c)
2024-03-06 18:43:49 +01:00
Ondřej SurýandMichał Kępień 540a5b5a2c Create a second pruning task for rbtdb with unlimited quantum
Previously, rbtdb->task had quantum of 1 because it was originally used
just for freeing RBTDB contents, which can happen on a "best effort"
basis (does not need to be prioritized).  However, when tree pruning was
implemented, it also started sending events to that task, enabling the
latter to become clogged up with a significant event backlog because it
only pruned a single RBTDB node per event.

To prioritize tree pruning (as it is necessary for enforcing the
configured memory use limit for the cache memory context), create a
second task with a virtually unlimited quantum (UINT_MAX) and send the
tree-pruning events to this new task, to ensure that all nodes scheduled
for pruning will be processed before further nodes are queued in a
similar fashion.

This change enables dropping the prunenodes list and restoring the
originally-used logic that allocates and sends a separate event for each
node to prune.

(cherry picked from commit 231b2375e5)
2024-03-06 18:43:49 +01:00
Ondřej SurýandMichał Kępień 12c42a6c07 Restore the parent cleaning logic in prune_tree()
Reconstruct the variant of the prune_tree() parent cleaning to consider
all elibible parents in a single loop as we were doing before all the
changes that led to this commit.

Update code comments so that they more precisely describe what the
relevant bits of code actually do.

(cherry picked from commit 454c75a33a)
2024-03-06 18:43:49 +01:00
Michał Kępień dc50c0f978 Merge branch '4596-check-the-prunelink-member-of-the-correct-node-9.16.49' into 'v9.16.49-release'
[9.16.49] Check the prunelink member of the correct node

See merge request isc-projects/bind9!8815
2024-03-02 05:39:32 +00:00
Michał Kępień 0b59306166 Check the prunelink member of the correct node
Commit 37101c7c8a checks the prunelink
member of the node that was just pruned, not its parent node that was
intended to be examined.  Fix by checking the prunelink member of the
parent node, so that adding the latter to its relevant prunenodes list
twice is properly guarded against.

(cherry picked from commit 7d9be24bb1)
2024-03-02 06:37:53 +01:00
Michał Kępień dc7eec86fb Merge branch '4596-check-the-prunelink-member-of-the-correct-node' into 'bind-9.16'
[9.16] Check the prunelink member of the correct node

See merge request isc-projects/bind9!8814
2024-03-02 05:37:21 +00:00
Michał Kępień 7d9be24bb1 Check the prunelink member of the correct node
Commit 4b6fc97af6 checks the prunelink
member of the node that was just pruned, not its parent node that was
intended to be examined.  Fix by checking the prunelink member of the
parent node, so that adding the latter to its relevant prunenodes list
twice is properly guarded against.
2024-03-02 06:36:37 +01:00
Evan Hunt 5095a05c13 Merge branch 'each-move-rrl-broken-config-test-case-to-checkconf-bind-9.18-bind-9.16' into 'bind-9.16'
[9.16] Move RRL broken-config check to checkconf

See merge request isc-projects/bind9!8813
2024-03-02 01:11:18 +00:00
Evan Hunt 0a019e8f9e move RRL broken-config check to checkconf
the RRL test included a test case that tried to start named with
a broken configuration.  the same error could be found with
named-checkconf, so it should have been tested in the checkconf
system test.

(cherry picked from commit 05398c1488)
(cherry picked from commit 046b62bf02)
2024-03-01 16:36:51 -08:00
Michał Kępień 0640429444 Merge branch '4596-do-not-re-add-a-node-to-the-same-prunenodes-list-9.16.49' into 'v9.16.49-release'
[9.16.49] Do not re-add a node to the same prunenodes list

See merge request isc-projects/bind9!8811
2024-03-01 17:22:32 +00:00
Michał Kępień 37101c7c8a Do not re-add a node to the same prunenodes list
If a node cleaned up by prune_tree() happens to belong to the same node
bucket as its parent, the latter is directly appended to the prunenodes
list currently processed by prune_tree().  However, the relevant code
branch does not account for the fact that the parent might already be on
the list it is trying to append it to.  Fix by only calling
ISC_LIST_APPEND() for parent nodes not yet added to their relevant
prunenodes list.

(cherry picked from commit 4b6fc97af6)
2024-03-01 18:19:39 +01:00
Michał Kępień 57dbcac057 Merge branch '4596-do-not-re-add-a-node-to-the-same-prunenodes-list' into 'bind-9.16'
Do not re-add a node to the same prunenodes list

See merge request isc-projects/bind9!8810
2024-03-01 17:19:15 +00:00
Michał Kępień 4b6fc97af6 Do not re-add a node to the same prunenodes list
If a node cleaned up by prune_tree() happens to belong to the same node
bucket as its parent, the latter is directly appended to the prunenodes
list currently processed by prune_tree().  However, the relevant code
branch does not account for the fact that the parent might already be on
the list it is trying to append it to.  Fix by only calling
ISC_LIST_APPEND() for parent nodes not yet added to their relevant
prunenodes list.
2024-03-01 18:12:37 +01:00
Michał Kępień a837ba5cd2 Merge branch '4596-gracefully-handle-resending-a-node-to-prune_tree-9.16.49' into 'v9.16.49-release'
[9.16.49] Gracefully handle resending a node to prune_tree()

See merge request isc-projects/bind9!8805
2024-02-29 17:09:08 +00:00
Michał Kępień cb9928aaeb Gracefully handle resending a node to prune_tree()
Commit 801e888d03 made the prune_tree()
function use send_to_prune_tree() for triggering pruning of deleted leaf
nodes' parents.  This enabled the following sequence of events to
happen:

 1. Node A, which is a leaf node, is passed to send_to_prune_tree() and
    its pruning is queued.

 2. Node B is added to the RBTDB as a child of node A before the latter
    gets pruned.

 3. Node B, which is now a leaf node itself (and is likely to belong to
    a different node bucket than node A), is passed to
    send_to_prune_tree() and its pruning gets queued.

 4. Node B gets pruned.  Its parent, node A, now becomes a leaf again
    and therefore the prune_tree() call that handled node B calls
    send_to_prune_tree() for node A.

 5. Since node A was already queued for pruning in step 1 (but not yet
    pruned), the INSIST(!ISC_LINK_LINKED(node, prunelink)); assertion
    fails for node A in send_to_prune_tree().

The above sequence of events is not a sign of pathological behavior.
Replace the assertion check with a conditional early return from
send_to_prune_tree().

(cherry picked from commit f6289ad931)
2024-02-29 18:06:12 +01:00
Michał Kępień e368de1c92 Merge branch '4596-gracefully-handle-resending-a-node-to-prune_tree' into 'bind-9.16'
[9.16] Gracefully handle resending a node to prune_tree()

See merge request isc-projects/bind9!8804
2024-02-29 17:04:50 +00:00
Michał Kępień f6289ad931 Gracefully handle resending a node to prune_tree()
Commit 2df147cb12 made the prune_tree()
function use send_to_prune_tree() for triggering pruning of deleted leaf
nodes' parents.  This enabled the following sequence of events to
happen:

 1. Node A, which is a leaf node, is passed to send_to_prune_tree() and
    its pruning is queued.

 2. Node B is added to the RBTDB as a child of node A before the latter
    gets pruned.

 3. Node B, which is now a leaf node itself (and is likely to belong to
    a different node bucket than node A), is passed to
    send_to_prune_tree() and its pruning gets queued.

 4. Node B gets pruned.  Its parent, node A, now becomes a leaf again
    and therefore the prune_tree() call that handled node B calls
    send_to_prune_tree() for node A.

 5. Since node A was already queued for pruning in step 1 (but not yet
    pruned), the INSIST(!ISC_LINK_LINKED(node, prunelink)); assertion
    fails for node A in send_to_prune_tree().

The above sequence of events is not a sign of pathological behavior.
Replace the assertion check with a conditional early return from
send_to_prune_tree().
2024-02-29 17:38:52 +01:00
Ondřej Surý 0a2746acba Merge branch '4591-improve-ttl-based-cleaning-9.16-v9.16.49-release' into 'v9.16.49-release'
[9.16.49] Remove expired rdataset headers from the heap

See merge request isc-projects/bind9!8802
2024-02-29 15:28:16 +00:00
Ondřej Surý abef835c4c Add CHANGES note for [GL #4591]
(cherry picked from commit db69cc7891)
(cherry picked from commit 99d0ba4420)
2024-02-29 16:14:05 +01:00
Ondřej Surý d7e3c782fd Make the TTL-based cleaning more aggressive
It was discovered that the TTL-based cleaning could build up
a significant backlog of the rdataset headers during the periods where
the top of the TTL heap isn't expired yet.  Make the TTL-based cleaning
more aggressive by cleaning more headers from the heap when we are
adding new header into the RBTDB.

(cherry picked from commit d8220ca4ca)
(cherry picked from commit 496fe6bc60)
2024-02-29 16:14:05 +01:00
Ondřej Surý 1082495439 Remove expired rdataset headers from the heap
It was discovered that an expired header could sit on top of the heap
a little longer than desireable.  Remove expired headers (headers with
rdh_ttl set to 0) from the heap completely, so they don't block the next
TTL-based cleaning.

(cherry picked from commit a9383e4b95)
(cherry picked from commit abe080d16e)
2024-02-29 16:14:05 +01:00
Ondřej Surý a2b9adb1c7 Merge branch '4591-improve-ttl-based-cleaning-9.16' into 'bind-9.16'
[9.16] Remove expired rdataset headers from the heap

See merge request isc-projects/bind9!8764
2024-02-29 15:10:56 +00:00
Ondřej Surý 99d0ba4420 Add CHANGES note for [GL #4591]
(cherry picked from commit db69cc7891)
2024-02-29 16:09:37 +01:00
Ondřej Surý 496fe6bc60 Make the TTL-based cleaning more aggressive
It was discovered that the TTL-based cleaning could build up
a significant backlog of the rdataset headers during the periods where
the top of the TTL heap isn't expired yet.  Make the TTL-based cleaning
more aggressive by cleaning more headers from the heap when we are
adding new header into the RBTDB.

(cherry picked from commit d8220ca4ca)
2024-02-29 16:09:36 +01:00
Ondřej Surý abe080d16e Remove expired rdataset headers from the heap
It was discovered that an expired header could sit on top of the heap
a little longer than desireable.  Remove expired headers (headers with
rdh_ttl set to 0) from the heap completely, so they don't block the next
TTL-based cleaning.

(cherry picked from commit a9383e4b95)
2024-02-29 16:09:34 +01:00
Ondřej Surý e1db06d1a6 Merge branch '4596-regression-in-cache-cleaning-9.16-v9.16.49-release' into 'v9.16.49-release'
[9.16.49] Reduce lock contention during RBTDB tree pruning

See merge request isc-projects/bind9!8797
2024-02-29 12:45:46 +00:00
Ondřej Surý a5bbbe7553 Add CHANGES and release note for [GL #4596]
(cherry picked from commit 774204ea74)
2024-02-29 12:48:04 +01:00
Ondřej Surý 801e888d03 Reduce lock contention during RBTDB tree pruning
The log message for commit c3377cbfaa
explained:

    Instead of issuing a separate isc_task_send() call for every RBTDB node
    that triggers tree pruning, maintain a list of nodes from which tree
    pruning can be started from and only issue an isc_task_send() call if
    pruning has not yet been triggered by another RBTDB node.

    The extra queuing overhead eliminated by this change could be remotely
    exploited to cause excessive memory use.

However, it turned out that having a single queue for the nodes to be
pruned increased lock contention to a level where cleaning up nodes from
the RBTDB took too long, causing the amount of memory used by the cache
to grow indefinitely over time.

This commit makes the prunenodes list bucketed, adds a quantum of 10
items per prune_tree() run, and simplifies parent node cleaning in the
prune_tree() logic.

Instead of juggling node locks in a cycle, only clean up the node
currently being pruned and queue its parent (if it is also eligible) for
pruning in the same way (by sending an event).

This simplifies the code and also spreads the pruning load across more
task loop ticks, which is better for lock contention as less things run
in a tight loop.

(cherry picked from commit 2df147cb12)
2024-02-29 12:47:25 +01:00
Ondřej Surý 5709230a3e Merge branch '4596-regression-in-cache-cleaning-9.16' into 'bind-9.16'
[9.16] Remove the contention when pruning RBTDB nodes

See merge request isc-projects/bind9!8767
2024-02-29 11:46:55 +00:00
Ondřej SurýandMichał Kępień 774204ea74 Add CHANGES and release note for [GL #4596] 2024-02-29 12:18:00 +01:00
Ondřej SurýandMichał Kępień 2df147cb12 Reduce lock contention during RBTDB tree pruning
The log message for commit c3377cbfaa
explained:

    Instead of issuing a separate isc_task_send() call for every RBTDB node
    that triggers tree pruning, maintain a list of nodes from which tree
    pruning can be started from and only issue an isc_task_send() call if
    pruning has not yet been triggered by another RBTDB node.

    The extra queuing overhead eliminated by this change could be remotely
    exploited to cause excessive memory use.

However, it turned out that having a single queue for the nodes to be
pruned increased lock contention to a level where cleaning up nodes from
the RBTDB took too long, causing the amount of memory used by the cache
to grow indefinitely over time.

This commit makes the prunenodes list bucketed, adds a quantum of 10
items per prune_tree() run, and simplifies parent node cleaning in the
prune_tree() logic.

Instead of juggling node locks in a cycle, only clean up the node
currently being pruned and queue its parent (if it is also eligible) for
pruning in the same way (by sending an event).

This simplifies the code and also spreads the pruning load across more
task loop ticks, which is better for lock contention as less things run
in a tight loop.
2024-02-29 12:18:00 +01:00
Mark Andrews d172b933fb Merge branch '4604-fix-initial-tests-in-masterfile-system-test-bind-9.16' into 'bind-9.16'
[9.16] Resolve "Fix initial tests in masterfile system test"

See merge request isc-projects/bind9!8789
2024-02-28 01:56:11 +00:00
Mark Andrews 32b1d00afb Split the first masterfile test into 3
Additionally read the correct zone for BIND 8 ttl checks

(cherry picked from commit e02b73c7a4)
2024-02-28 12:26:31 +11:00
Ondřej Surý 90c48c7b85 Merge branch '4595-fix-expire-lru-headers-race-9.16' into 'v9.16.49-release'
[9.16] Do not use header_prev in expire_lru_headers

See merge request isc-projects/bind9!8777
2024-02-23 14:51:19 +00:00
Mark AndrewsandOndřej Surý cf6e5793c5 Add CHANGES and release note for [GL #4495]
(cherry picked from commit 4f8539ac23)
2024-02-23 12:38:31 +01:00
Mark AndrewsandOndřej Surý 742dc803a8 Do not use header_prev in expire_lru_headers
dns__cacherbt_expireheader can unlink / free header_prev underneath
it.  Use ISC_LIST_TAIL after calling dns__cacherbt_expireheader
instead to get the next pointer to be processed.

(cherry picked from commit 7ce2e86024)
2024-02-23 12:38:31 +01:00
Ondřej Surý b806c75b54 Merge branch 'michal/set-up-version-and-release-notes-for-bind-9.16.49-v9.16.49-release' into 'v9.16.49-release'
Update BIND version to 9.16.49-dev

See merge request isc-projects/bind9!8780
2024-02-23 11:29:26 +00:00
Michał KępieńandOndřej Surý 11ac625dbe Set up release notes for BIND 9.16.49
(cherry picked from commit ae9d795a13)
2024-02-23 12:28:26 +01:00
Michał KępieńandOndřej Surý b58bf82da8 Update BIND version to 9.16.49-dev
(cherry picked from commit 8e4896ffa4)
2024-02-23 12:27:04 +01:00
Michał Kępień 03fdd3f12c Merge branch 'michal/post-release-tweaks-9.16' into 'bind-9.16'
[9.16] Miscellaneous post-release tweaks

See merge request isc-projects/bind9!8740
2024-02-14 16:23:14 +00:00
Michał Kępień ec1afa639f Mention CVE-2023-50868 in CHANGES entry 6322
Since CVE-2023-50868 does not have a dedicated fix in BIND 9, mention
its CVE identifier in the CHANGES entry for CVE-2023-50387 (KeyTrap),
which accompanied the code change that addresses both of these
vulnerabilities.

(cherry picked from commit 2fd20bbaf5)
2024-02-14 17:19:44 +01:00
Michał Kępień b56c18b477 Merge tag 'v9.16.48' into bind-9.16
BIND 9.16.48
2024-02-14 13:41:33 +01:00