sec: usr: Remove purged adb names and entries from SIEVE list immediately

Both expire_name() and expire_entry() use isc_async mechanism to remove
the names and entries from the SIEVE-LRU lists on the matching isc_loop.

Under certain circumstances, this could lead to double counting the
purged named/entries when purging the SIEVE-LRU lists under the overmem
condition.  This would cause not enough memory to be cleaned up and the
ADB would then never recover from the overmem condition leading to OOM
crash of the named.

Merge branch 'ondrej/fix-runaway-memory-in-adb' into 'main'

See merge request isc-projects/bind9!11544
This commit is contained in:
Ondřej Surý 2026-02-25 07:29:23 +01:00
commit 22181ec1b8

View file

@ -696,7 +696,12 @@ expire_name(dns_adbname_t *adbname, dns_adbstatus_t astat) {
/* Remove the adbname from the hashtable... */
if (cds_lfht_del(adb->names_ht, &adbname->ht_node) == 0) {
isc_async_run(adbname->loop, expire_name_async, adbname);
if (adbname->loop == isc_loop()) {
expire_name_async(adbname);
} else {
isc_async_run(adbname->loop, expire_name_async,
adbname);
}
}
}
@ -1467,7 +1472,12 @@ expire_entry(dns_adbentry_t *adbentry) {
dns_adb_t *adb = adbentry->adb;
if (cds_lfht_del(adb->entries_ht, &adbentry->ht_node) == 0) {
isc_async_run(adbentry->loop, expire_entry_async, adbentry);
if (adbentry->loop == isc_loop()) {
expire_entry_async(adbentry);
} else {
isc_async_run(adbentry->loop, expire_entry_async,
adbentry);
}
}
}