Merge tag 'v9.16.42' into bind-9.16
BIND 9.16.42
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
--- 9.16.42 released ---
|
||||
|
||||
6192. [security] A query that prioritizes stale data over lookup
|
||||
triggers a fetch to refresh the stale data in cache.
|
||||
If the fetch is aborted for exceeding the recursion
|
||||
quota, it was possible for 'named' to enter an infinite
|
||||
callback loop and crash due to stack overflow. This has
|
||||
been fixed. (CVE-2023-2911) [GL #4089]
|
||||
|
||||
6190. [security] Improve the overmem cleaning process to prevent the
|
||||
cache going over the configured limit. (CVE-2023-2828)
|
||||
[GL #4055]
|
||||
|
||||
6183. [bug] Fix a serve-stale bug where a delegation from cache
|
||||
could be returned to the client. [GL #3950]
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ for Microsoft Windows operating systems.
|
||||
.. include:: ../notes/notes-known-issues.rst
|
||||
|
||||
.. include:: ../notes/notes-current.rst
|
||||
.. include:: ../notes/notes-9.16.42.rst
|
||||
.. include:: ../notes/notes-9.16.41.rst
|
||||
.. include:: ../notes/notes-9.16.40.rst
|
||||
.. include:: ../notes/notes-9.16.39.rst
|
||||
|
||||
@@ -3095,6 +3095,11 @@ system.
|
||||
default value of that option (90% of physical memory for each
|
||||
individual cache) may lead to memory exhaustion over time.
|
||||
|
||||
.. note::
|
||||
|
||||
``max-cache-size`` does not work reliably for the maximum
|
||||
amount of memory of 100 MB or lower.
|
||||
|
||||
Upon startup and reconfiguration, caches with a limited size
|
||||
preallocate a small amount of memory (less than 1% of
|
||||
``max-cache-size`` for a given view). This preallocation serves as an
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
.. Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
||||
..
|
||||
.. SPDX-License-Identifier: MPL-2.0
|
||||
..
|
||||
.. This Source Code Form is subject to the terms of the Mozilla Public
|
||||
.. License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
.. file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
..
|
||||
.. See the COPYRIGHT file distributed with this work for additional
|
||||
.. information regarding copyright ownership.
|
||||
|
||||
Notes for BIND 9.16.42
|
||||
----------------------
|
||||
|
||||
Security Fixes
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
- The overmem cleaning process has been improved, to prevent the cache
|
||||
from significantly exceeding the configured ``max-cache-size`` limit.
|
||||
(CVE-2023-2828)
|
||||
|
||||
ISC would like to thank Shoham Danino from Reichman University, Anat
|
||||
Bremler-Barr from Tel-Aviv University, Yehuda Afek from Tel-Aviv
|
||||
University, and Yuval Shavitt from Tel-Aviv University for bringing
|
||||
this vulnerability to our attention. :gl:`#4055`
|
||||
|
||||
- A query that prioritizes stale data over lookup triggers a fetch to
|
||||
refresh the stale data in cache. If the fetch is aborted for exceeding
|
||||
the recursion quota, it was possible for :iscman:`named` to enter an
|
||||
infinite callback loop and crash due to stack overflow. This has been
|
||||
fixed. (CVE-2023-2911) :gl:`#4089`
|
||||
|
||||
Bug Fixes
|
||||
~~~~~~~~~
|
||||
|
||||
- Previously, it was possible for a delegation from cache to be returned
|
||||
to the client after the ``stale-answer-client-timeout`` duration.
|
||||
This has been fixed. :gl:`#3950`
|
||||
|
||||
Known Issues
|
||||
~~~~~~~~~~~~
|
||||
|
||||
- There are no new known issues with this release. See :ref:`above
|
||||
<relnotes_known_issues>` for a list of all known issues affecting this
|
||||
BIND 9 branch.
|
||||
+65
-40
@@ -605,7 +605,7 @@ static void
|
||||
expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, bool tree_locked,
|
||||
expire_t reason);
|
||||
static void
|
||||
overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, isc_stdtime_t now,
|
||||
overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, size_t purgesize,
|
||||
bool tree_locked);
|
||||
static void
|
||||
resign_insert(dns_rbtdb_t *rbtdb, int idx, rdatasetheader_t *newheader);
|
||||
@@ -6823,6 +6823,16 @@ cleanup:
|
||||
|
||||
static dns_dbmethods_t zone_methods;
|
||||
|
||||
static size_t
|
||||
rdataset_size(rdatasetheader_t *header) {
|
||||
if (!NONEXISTENT(header)) {
|
||||
return (dns_rdataslab_size((unsigned char *)header,
|
||||
sizeof(*header)));
|
||||
}
|
||||
|
||||
return (sizeof(*header));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options,
|
||||
@@ -6987,7 +6997,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
}
|
||||
|
||||
if (cache_is_overmem) {
|
||||
overmem_purge(rbtdb, rbtnode->locknum, now, tree_locked);
|
||||
overmem_purge(rbtdb, rbtnode->locknum, rdataset_size(newheader),
|
||||
tree_locked);
|
||||
}
|
||||
|
||||
NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
|
||||
@@ -7006,10 +7017,18 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
}
|
||||
|
||||
header = isc_heap_element(rbtdb->heaps[rbtnode->locknum], 1);
|
||||
if (header != NULL && header->rdh_ttl + rbtdb->serve_stale_ttl <
|
||||
now - RBTDB_VIRTUAL)
|
||||
{
|
||||
expire_header(rbtdb, header, tree_locked, expire_ttl);
|
||||
if (header != NULL) {
|
||||
dns_ttl_t rdh_ttl = header->rdh_ttl;
|
||||
|
||||
/* Only account for stale TTL if cache is not overmem */
|
||||
if (!cache_is_overmem) {
|
||||
rdh_ttl += rbtdb->serve_stale_ttl;
|
||||
}
|
||||
|
||||
if (rdh_ttl < now - RBTDB_VIRTUAL) {
|
||||
expire_header(rbtdb, header, tree_locked,
|
||||
expire_ttl);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -10547,52 +10566,58 @@ update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, isc_stdtime_t now) {
|
||||
ISC_LIST_PREPEND(rbtdb->rdatasets[header->node->locknum], header, link);
|
||||
}
|
||||
|
||||
static size_t
|
||||
expire_lru_headers(dns_rbtdb_t *rbtdb, unsigned int locknum, size_t purgesize,
|
||||
bool tree_locked) {
|
||||
rdatasetheader_t *header, *header_prev;
|
||||
size_t purged = 0;
|
||||
|
||||
for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]);
|
||||
header != NULL && purged <= purgesize; header = header_prev)
|
||||
{
|
||||
header_prev = ISC_LIST_PREV(header, link);
|
||||
/*
|
||||
* Unlink the entry at this point to avoid checking it
|
||||
* again even if it's currently used someone else and
|
||||
* cannot be purged at this moment. This entry won't be
|
||||
* referenced any more (so unlinking is safe) since the
|
||||
* TTL was reset to 0.
|
||||
*/
|
||||
ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, link);
|
||||
size_t header_size = rdataset_size(header);
|
||||
expire_header(rbtdb, header, tree_locked, expire_lru);
|
||||
purged += header_size;
|
||||
}
|
||||
|
||||
return (purged);
|
||||
}
|
||||
|
||||
/*%
|
||||
* Purge some expired and/or stale (i.e. unused for some period) cache entries
|
||||
* under an overmem condition. To recover from this condition quickly, up to
|
||||
* 2 entries will be purged. This process is triggered while adding a new
|
||||
* entry, and we specifically avoid purging entries in the same LRU bucket as
|
||||
* the one to which the new entry will belong. Otherwise, we might purge
|
||||
* entries of the same name of different RR types while adding RRsets from a
|
||||
* single response (consider the case where we're adding A and AAAA glue records
|
||||
* of the same NS name).
|
||||
* Purge some stale (i.e. unused for some period - LRU based cleaning) cache
|
||||
* entries under the overmem condition. To recover from this condition quickly,
|
||||
* we cleanup entries up to the size of newly added rdata (passed as purgesize).
|
||||
*
|
||||
* This process is triggered while adding a new entry, and we specifically avoid
|
||||
* purging entries in the same LRU bucket as the one to which the new entry will
|
||||
* belong. Otherwise, we might purge entries of the same name of different RR
|
||||
* types while adding RRsets from a single response (consider the case where
|
||||
* we're adding A and AAAA glue records of the same NS name).
|
||||
*/
|
||||
static void
|
||||
overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, isc_stdtime_t now,
|
||||
overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, size_t purgesize,
|
||||
bool tree_locked) {
|
||||
rdatasetheader_t *header, *header_prev;
|
||||
unsigned int locknum;
|
||||
int purgecount = 2;
|
||||
size_t purged = 0;
|
||||
|
||||
for (locknum = (locknum_start + 1) % rbtdb->node_lock_count;
|
||||
locknum != locknum_start && purgecount > 0;
|
||||
locknum != locknum_start && purged <= purgesize;
|
||||
locknum = (locknum + 1) % rbtdb->node_lock_count)
|
||||
{
|
||||
NODE_LOCK(&rbtdb->node_locks[locknum].lock,
|
||||
isc_rwlocktype_write);
|
||||
|
||||
header = isc_heap_element(rbtdb->heaps[locknum], 1);
|
||||
if (header && header->rdh_ttl < now - RBTDB_VIRTUAL) {
|
||||
expire_header(rbtdb, header, tree_locked, expire_ttl);
|
||||
purgecount--;
|
||||
}
|
||||
|
||||
for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]);
|
||||
header != NULL && purgecount > 0; header = header_prev)
|
||||
{
|
||||
header_prev = ISC_LIST_PREV(header, link);
|
||||
/*
|
||||
* Unlink the entry at this point to avoid checking it
|
||||
* again even if it's currently used someone else and
|
||||
* cannot be purged at this moment. This entry won't be
|
||||
* referenced any more (so unlinking is safe) since the
|
||||
* TTL was reset to 0.
|
||||
*/
|
||||
ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header,
|
||||
link);
|
||||
expire_header(rbtdb, header, tree_locked, expire_lru);
|
||||
purgecount--;
|
||||
}
|
||||
purged += expire_lru_headers(rbtdb, locknum, purgesize - purged,
|
||||
tree_locked);
|
||||
|
||||
NODE_UNLOCK(&rbtdb->node_locks[locknum].lock,
|
||||
isc_rwlocktype_write);
|
||||
|
||||
+22
-8
@@ -5719,6 +5719,7 @@ query_refresh_rrset(query_ctx_t *orig_qctx) {
|
||||
qctx.client->query.dboptions &= ~(DNS_DBFIND_STALETIMEOUT |
|
||||
DNS_DBFIND_STALEOK |
|
||||
DNS_DBFIND_STALEENABLED);
|
||||
qctx.client->nodetach = false;
|
||||
|
||||
/*
|
||||
* We'll need some resources...
|
||||
@@ -5976,7 +5977,14 @@ query_lookup(query_ctx_t *qctx) {
|
||||
"%s stale answer used, an attempt to "
|
||||
"refresh the RRset will still be made",
|
||||
namebuf);
|
||||
|
||||
qctx->refresh_rrset = STALE(qctx->rdataset);
|
||||
|
||||
/*
|
||||
* If we are refreshing the RRSet, we must not
|
||||
* detach from the client in query_send().
|
||||
*/
|
||||
qctx->client->nodetach = qctx->refresh_rrset;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
@@ -6324,7 +6332,7 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
|
||||
if (recparam_match(&client->query.recparam, qtype, qname, qdomain)) {
|
||||
ns_client_log(client, NS_LOGCATEGORY_CLIENT, NS_LOGMODULE_QUERY,
|
||||
ISC_LOG_INFO, "recursion loop detected");
|
||||
return (ISC_R_FAILURE);
|
||||
return (ISC_R_ALREADYRUNNING);
|
||||
}
|
||||
|
||||
recparam_update(&client->query.recparam, qtype, qname, qdomain);
|
||||
@@ -7288,10 +7296,21 @@ query_usestale(query_ctx_t *qctx, isc_result_t result) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (result == DNS_R_DUPLICATE || result == DNS_R_DROP) {
|
||||
if (qctx->refresh_rrset) {
|
||||
/*
|
||||
* This is a refreshing query, we have already prioritized
|
||||
* stale data, so don't enable serve-stale again.
|
||||
*/
|
||||
return (false);
|
||||
}
|
||||
|
||||
if (result == DNS_R_DUPLICATE || result == DNS_R_DROP ||
|
||||
result == ISC_R_ALREADYRUNNING)
|
||||
{
|
||||
/*
|
||||
* Don't enable serve-stale if the result signals a duplicate
|
||||
* query or query that is being dropped.
|
||||
* query or a query that is being dropped or can't proceed
|
||||
* because of a recursion loop.
|
||||
*/
|
||||
return (false);
|
||||
}
|
||||
@@ -11554,12 +11573,7 @@ ns_query_done(query_ctx_t *qctx) {
|
||||
/*
|
||||
* Client may have been detached after query_send(), so
|
||||
* we test and store the flag state here, for safety.
|
||||
* If we are refreshing the RRSet, we must not detach from the client
|
||||
* in the query_send(), so we need to override the flag.
|
||||
*/
|
||||
if (qctx->refresh_rrset) {
|
||||
qctx->client->nodetach = true;
|
||||
}
|
||||
nodetach = qctx->client->nodetach;
|
||||
query_send(qctx->client);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user