From b12f709f0564d7abbe2ebb4dbb78da2087988801 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 31 Oct 2023 12:00:14 +0100 Subject: [PATCH 1/3] restore isc_mem_setwater() call in the cache Commit 4db150437e14b28c5b50ae466af9ce502fd73185 incorrectly removed the call to isc_mem_setwater() from dns_cache_setcachesize(). The water() function is a no-op, but we still need to set high- and low-water marks in the memory context, otherwise overmem conditions will not be detected. --- lib/dns/cache.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/dns/cache.c b/lib/dns/cache.c index f7c3bbef99..ed93b31c8a 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -239,6 +239,13 @@ dns_cache_getname(dns_cache_t *cache) { return (cache->name); } +/* This is a no-op, but has to exist for isc_mem_setwater(). */ +static void +water(void *arg, int mark) { + UNUSED(arg); + UNUSED(mark); +} + void dns_cache_setcachesize(dns_cache_t *cache, size_t size) { REQUIRE(VALID_CACHE(cache)); @@ -254,6 +261,14 @@ dns_cache_setcachesize(dns_cache_t *cache, size_t size) { LOCK(&cache->lock); cache->size = size; UNLOCK(&cache->lock); + + size_t hi = size - (size >> 3); /* Approximately 7/8ths. */ + size_t lo = size - (size >> 2); /* Approximately 3/4ths. */ + if (size == 0U || hi == 0U || lo == 0U) { + isc_mem_clearwater(cache->mctx); + } else { + isc_mem_setwater(cache->mctx, water, cache, hi, lo); + } } size_t From 93f1518c80e07b05f6d5324bda0ba7809e8e890d Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 31 Oct 2023 12:04:38 +0100 Subject: [PATCH 2/3] CHANGES for [GL #4340] --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 1e461b986e..3e3f9a30b1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +6278. [bug] The call to isc_mem_setwater() was incorrectly + removed from dns_cache_setcachesize(), causing + cache overmem conditions not to be detected. [GL #4340] + 6277. [bug] Take into account local authoritative zones when falling back to serve-stale. [GL #4355] From 789879b5724bc82abf4a8b8c68068993240e6a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Wed, 1 Nov 2023 07:22:03 +0100 Subject: [PATCH 3/3] Add release note for GL #4340 --- doc/notes/notes-current.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/notes/notes-current.rst b/doc/notes/notes-current.rst index d90427fdb8..9713e8c5db 100644 --- a/doc/notes/notes-current.rst +++ b/doc/notes/notes-current.rst @@ -66,6 +66,10 @@ Feature Changes Bug Fixes ~~~~~~~~~ +- :any:`max-cache-size` accidentally became ineffective in BIND 9.19.16. + This has been fixed and the option now behaves as documented again. + :gl:`#4340` + - For inline-signing zones, if the unsigned version of the zone contains DNSSEC records, it was scheduled to be resigning. This unwanted behavior has been fixed. :gl:`#4350`