2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

56 Commits

Author SHA1 Message Date
Ondřej Surý
c13a1d8b01 Improve the reference counting checks in newref()
In qpcache (and rbtdb), there are some functions that acquire
neither the tree lock nor the node lock when calling newref().
In theory, this could lead to a race in which a new reference
is added to a node that was about to be deleted.

We now detect this condition by passing the current tree and node
lock status to newref(). If the node was previously unreferenced
and we don't hold at least one read lock, we will assert.
2024-04-30 08:41:56 +02:00
Evan Hunt
2c88946590 dns_name_dupwithoffsets() cannot fail
this function now always returns success; change it to void and
clean up its callers.
2024-04-10 22:51:07 -04:00
Evan Hunt
ea6659a5e9 update foundname when detecting a zonecut above qname
an assertion could be triggered in the QPDB cache if a DNAME
was found above a queried NS, because the 'foundname' value was
not correctly updated to point to the zone cut.

the same mistake existed in qpzone and has been fixed there as well.
2024-04-02 10:00:03 +02:00
Evan Hunt
8b67476249 reduce memory consumption of qpcache database
as with qpzone, use a dynamically-allocated dns_name instead
of a dns_fixedname object to store node names in the QP database.
2024-03-14 10:20:52 -07:00
Matthijs Mekking
659fa0cbc3 Fix Coverity CID 487884: Dead code in qpcache.c
Adding a changed record is zonedb related and does not belong in
the cache code. This is a leftover dead code and can be safely
removed.

/lib/dns/qpcache.c: 3459 in add()
3453     			}
3454     			newheader->next = topheader->next;
3455     			newheader->down = topheader;
3456     			topheader->next = newheader;
3457     			qpnode->dirty = 1;
3458     			if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3459     				changed->dirty = true;
3460     			}
3461     		} else {
3462     			/*
3463     			 * No rdatasets of the given type exist at the node.
3464     			 */
/lib/dns/qpcache.c: 3409 in add()
3403     			}
3404     			newheader->next = topheader->next;
3405     			newheader->down = topheader;
3406     			topheader->next = newheader;
3407     			qpnode->dirty = 1;
3408     			if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3409     				changed->dirty = true;
3410     			}
3411     			mark_ancient(header);
3412     			if (sigheader != NULL) {
3413     				mark_ancient(sigheader);
3414
2024-03-14 10:42:30 +00:00
Evan Hunt
5709f7bad9 rename qpdb to qpcache
move qpdb.c to qpcache.c and rename the "qp" database implementation
to "qpcache", in order to make it more clearly distinguishable from
"qpzone".
2024-03-08 15:36:56 -08:00