]> git.ipfire.org Git - thirdparty/bind9.git/commit
Account transient delegsets against the caller's memory context
authorOndřej Surý <ondrej@isc.org>
Thu, 9 Apr 2026 10:45:30 +0000 (12:45 +0200)
committerColin Vidal <colin@isc.org>
Thu, 16 Apr 2026 09:28:13 +0000 (11:28 +0200)
commit876a896f0fc70c04f4263c33b1fde310e7aee0c6
treee613371fb2d8b4e024376dd4668d7ffa7f557e34
parent9191dc7acbdf4a6a4a6a06cedad2d90baed0fcee
Account transient delegsets against the caller's memory context

dns_delegset_fromnsrdataset() used isc_g_mctx for the transient
delegset it builds from a DNS NS rdataset.  That hides delegation
data in the global default context instead of accounting it against
the subsystem that owns it: a resolver fctx, a view, or a query
context.

Take an explicit mctx parameter so callers can direct the allocation
to the right place, and update the three call sites:
- lib/dns/view.c:1189 (dns_view_bestzonecut fallback) uses view->mctx
- lib/dns/resolver.c:7071 (resume_dslookup) uses fctx->mctx
- lib/ns/query.c:8672 (query_delegation_recurse) uses the client
  manager's mctx

Also tighten delegdb cleanup to run inside the same write transaction
as the insert: delegdb_node_prepare() now returns the size of the new
node, and delegdb_cleanup() takes the caller's open qp so that the
overmem reclamation and the insert share one commit instead of doing
two nested write transactions.
lib/dns/deleg.c
lib/dns/include/dns/deleg.h
lib/dns/resolver.c
lib/dns/view.c
lib/ns/query.c
tests/dns/deleg_test.c