bind: 9.18.11 -> 9.18.17
PATCH 1/1 bind: 9.18.11 -> 9.18.17
From: Chee Yang Lee <[email protected]>
upgrade also include fix for CVE-2023-2829.
License-Update: removed trailing whitespace from COPYRIGHT
Signed-off-by Chee Yang Lee <[email protected]>
---
.../bind/bind-9.18.11/CVE-2023-2828.patch | 197 ------------------
.../bind/bind-9.18.11/CVE-2023-2911.patch | 97 ---------
...1-avoid-start-failure-with-bind-user.patch | 0
...d-V-and-start-log-hide-build-options.patch | 0
...ching-for-json-headers-searches-sysr.patch | 0
.../bind/{bind-9.18.11 => bind-9.18.17}/bind9 | 0
.../{bind-9.18.11 => bind-9.18.17}/conf.patch | 0
.../generate-rndc-key.sh | 0
...t.d-add-support-for-read-only-rootfs.patch | 0
.../make-etc-initd-bind-stop-work.patch | 0
.../named.service | 0
.../bind/{bind_9.18.11.bb => bind_9.18.17.bb} | 8 +-
12 files changed, 3 insertions(+), 299 deletions(-)
delete mode 100644 meta/recipes-connectivity/bind/bind-9.18.11/CVE-2023-2828.patch
delete mode 100644 meta/recipes-connectivity/bind/bind-9.18.11/CVE-2023-2911.patch
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/0001-avoid-start-failure-with-bind-user.patch (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/0001-named-lwresd-V-and-start-log-hide-build-options.patch (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/bind-ensure-searching-for-json-headers-searches-sysr.patch (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/bind9 (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/conf.patch (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/generate-rndc-key.sh (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/init.d-add-support-for-read-only-rootfs.patch (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/make-etc-initd-bind-stop-work.patch (100%)
rename meta/recipes-connectivity/bind/{bind-9.18.11 => bind-9.18.17}/named.service (100%)
rename meta/recipes-connectivity/bind/{bind_9.18.11.bb => bind_9.18.17.bb} (92%)meta/recipes-connectivity/bind/bind-9.18.11/CVE-2023-2828.patch deleted +0 -197
@@ -1,197 +0,0 @@ -From e9d5219fca9f6b819d953990b369d6acfb4e952b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <[email protected]> -Date: Tue, 30 May 2023 08:46:17 +0200 -Subject: [PATCH] Improve RBT overmem cache cleaning - -When cache memory usage is over the configured cache size (overmem) and -we are cleaning unused entries, it might not be enough to clean just two -entries if the entries to be expired are smaller than the newly added -rdata. This could be abused by an attacker to cause a remote Denial of -Service by possibly running out of the operating system memory. - -Currently, the addrdataset() tries to do a single TTL-based cleaning -considering the serve-stale TTL and then optionally moves to overmem -cleaning if we are in that condition. Then the overmem_purge() tries to -do another single TTL based cleaning from the TTL heap and then continue -with LRU-based cleaning up to 2 entries cleaned. - -Squash the TTL-cleaning mechanism into single call from addrdataset(), -but ignore the serve-stale TTL if we are currently overmem. - -Then instead of having a fixed number of entries to clean, pass the size -of newly added rdatasetheader to the overmem_purge() function and -cleanup at least the size of the newly added data. This prevents the -cache going over the configured memory limit (`max-cache-size`). - -Additionally, refactor the overmem_purge() function to reduce for-loop -nesting for readability. - -Patch taken from : https://downloads.isc.org/isc/bind9/9.18.16/patches/0001-CVE-2023-2828.patch - -Upstream-Status: Backport [https://gitlab.isc.org/isc-projects/bind9/-/commit/e9d5219fca9f6b819d953990b369d6acfb4e952b] -CVE: CVE-2023-2828 -Signed-off-by: Hitendra Prajapati <[email protected]> ---- - lib/dns/rbtdb.c | 106 +++++++++++++++++++++++++++++------------------- - 1 file changed, 65 insertions(+), 41 deletions(-) - -diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c -index d1aee54..ba60a49 100644 ---- a/lib/dns/rbtdb.c -+++ b/lib/dns/rbtdb.c -@@ -561,7 +561,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); -@@ -6787,6 +6787,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, -@@ -6951,7 +6961,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, -@@ -6970,11 +6981,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 + STALE_TTL(header, rbtdb) < -- 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 += STALE_TTL(header, rbtdb); -+ } -+ -+ if (rdh_ttl < now - RBTDB_VIRTUAL) { -+ expire_header(rbtdb, header, tree_locked, -+ expire_ttl); -+ } - } - - /* -@@ -10114,52 +10132,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); --- -2.25.1 -
meta/recipes-connectivity/bind/bind-9.18.11/CVE-2023-2911.patch deleted +0 -97
97 lines not on this page · raw message
meta/recipes-connectivity/bind/bind-9.18.17/0001-avoid-start-failure-with-bind-user.patch renamed from meta/recipes-connectivity/bind/bind-9.18.11/0001-avoid-start-failure-with-bind-user.patch +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/0001-named-lwresd-V-and-start-log-hide-build-options.patch renamed from meta/recipes-connectivity/bind/bind-9.18.11/0001-named-lwresd-V-and-start-log-hide-build-options.patch +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/bind-ensure-searching-for-json-headers-searches-sysr.patch renamed from meta/recipes-connectivity/bind/bind-9.18.11/bind-ensure-searching-for-json-headers-searches-sysr.patch +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/bind9 renamed from meta/recipes-connectivity/bind/bind-9.18.11/bind9 +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/conf.patch renamed from meta/recipes-connectivity/bind/bind-9.18.11/conf.patch +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/generate-rndc-key.sh renamed from meta/recipes-connectivity/bind/bind-9.18.11/generate-rndc-key.sh +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/init.d-add-support-for-read-only-rootfs.patch renamed from meta/recipes-connectivity/bind/bind-9.18.11/init.d-add-support-for-read-only-rootfs.patch +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/make-etc-initd-bind-stop-work.patch renamed from meta/recipes-connectivity/bind/bind-9.18.11/make-etc-initd-bind-stop-work.patch +0 -0
meta/recipes-connectivity/bind/bind-9.18.17/named.service renamed from meta/recipes-connectivity/bind/bind-9.18.11/named.service +0 -0
meta/recipes-connectivity/bind/bind_9.18.17.bb renamed from meta/recipes-connectivity/bind/bind_9.18.11.bb +3 -5
@@ -4,7 +4,7 @@ DESCRIPTION = "BIND 9 provides a full-featured Domain Name Server system" SECTION = "console/network" LICENSE = "MPL-2.0" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=d8cf7bd9c4fd5471a588e7e66e672408" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=c7a0b6d9a1b692a5da9af9d503671f43" DEPENDS = "openssl libcap zlib libuv"
@@ -18,11 +18,9 @@ SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.xz \ file://bind-ensure-searching-for-json-headers-searches-sysr.patch \ file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \ file://0001-avoid-start-failure-with-bind-user.patch \ - file://CVE-2023-2828.patch \ - file://CVE-2023-2911.patch \ " -SRC_URI[sha256sum] = "8ff3352812230cbcbda42df87cad961f94163d3da457c5e4bef8057fd5df2158" +SRC_URI[sha256sum] = "bde1c5017b81d1d79c69eb8f537f2e5032fd3623acdd5ee830d4f74bc2483458" UPSTREAM_CHECK_URI = "https://ftp.isc.org/isc/bind9/" # follow the ESV versions divisible by 2
@@ -41,7 +39,7 @@ PACKAGECONFIG[readline] = "--with-readline=readline,,readline" PACKAGECONFIG[libedit] = "--with-readline=libedit,,libedit" PACKAGECONFIG[dns-over-http] = "--enable-doh,--disable-doh,nghttp2" -EXTRA_OECONF = " --disable-devpoll --disable-auto-validation --enable-epoll \ +EXTRA_OECONF = " --disable-auto-validation \ --with-gssapi=no --with-lmdb=no --with-zlib \ --sysconfdir=${sysconfdir}/bind \ --with-openssl=${STAGING_DIR_HOST}${prefix} \
Signature · 1 line
2.37.3