2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

38396 Commits

Author SHA1 Message Date
Evan Hunt
55f00de18e CHANGES for [GL #3886] 2023-02-24 08:30:33 +00:00
Evan Hunt
4e93d44c74 fix a bug in dns_dispatch_getnext()
when a message arrives over a TCP connection matching an expected
QID, the dispatch is updated so it no longer expects that QID,
but continues reading. subsequent messages with the same QID are
ignored, unless the dispatch entry has called dns_dispatch_getnext()
or dns_dispatch_resume().

however, a coding error caused those functions to have no effect
when the dispatch was reading, so streams of messages with the same
QID could not be received over a single TCP connection, breaking *XFR.

this has been corrected by changing the order of operations in
tcp_dispatch_getnext() so that disp->reading isn't checked until
after the dispatch entry has been reactivated.
2023-02-24 08:30:33 +00:00
Evan Hunt
f0c766abec refactor dns_xfrin to use dns_dispatch
the dns_xfrin module was still using the network manager directly to
manage TCP connections and send and receive messages.  this commit
changes it to use the dispatch manager instead.
2023-02-24 08:30:33 +00:00
Evan Hunt
a4c8decc6a implement refcount tracing in xfrin.c
use ISC_REFCOUNT_IMPL for dns_xfrin_ctx_t (which has been renamed
to dns_xfrin_t to keep the function names dns_xfrin_attach() and
dns_xfrin_detach() unchanged).
2023-02-24 08:30:33 +00:00
Evan Hunt
d72419d1f5 minor cleanups in dispatch.c
- simplified tcp_startrecv()
- removed a short function that was only called once
- removed an unnecessary if statement
2023-02-24 08:30:33 +00:00
Evan Hunt
1dd42a80d6 log the xfrin pointer address in xfrin_log()
to make it easier to trace xfrin events in the log, include
the address of the dns_xfrin_t object in all xfrin log messages.
2023-02-24 08:30:33 +00:00
Evan Hunt
9d37621012 remove dead code in dns_request
the 'connected' variable in 'dns_request_create()` was always false.
2023-02-24 08:30:33 +00:00
Evan Hunt
ae5ba54fbe move dispatchmgr from resolver to view
the 'dispatchmgr' member of the resolver object is used by both
the dns_resolver and dns_request modules, and may in the future
be used by others such as dns_xfrin. it doesn't make sense for it
to live in the resolver object; this commit moves it into dns_view.
2023-02-24 08:30:33 +00:00
Michal Nowak
ec33efe351 Merge branch 'mnowak/update_TEST_PARALLEL_JOBS_for_BSD' into 'main'
Disable OpenBSD system test parallelism in CI

See merge request isc-projects/bind9!7585
2023-02-24 08:16:14 +00:00
Michal Nowak
d73eba57bd
Disable OpenBSD system test parallelism in CI
Make OpenBSD system tests more stable by disabling parallelism in CI.

Accordingly, they will run 3-4 times longer.
2023-02-24 08:59:18 +01:00
Michal Nowak
cf46addf51
Do not set TEST_PARALLEL_JOBS in FreeBSD system test
Setting TEST_PARALLEL_JOBS to 4 in FreeBSD system test jobs is a no-op
because it's already set to 4, one level above, on the global level.
2023-02-24 08:59:18 +01:00
Tony Finch
dfed03f094 Merge branch 'fanf-qsbr' into 'main'
QSBR: safe memory reclamation for lock-free data structures

See merge request isc-projects/bind9!7290
2023-02-23 16:43:56 +00:00
Tony Finch
9b7aa536ba QSBR: safe memory reclamation for lock-free data structures
This "quiescent state based reclamation" module provides support for
the qp-trie module in dns/qp. It is a replacement for liburcu, written
without reference to the urcu source code, and in fact it works in a
significantly different way.

A few specifics of BIND make this variant of QSBR somewhat simpler:

  * We can require that wait-free access to a qp-trie only happens in
    an isc_loop callback. The loop provides a natural quiescent state,
    after the callbacks are done, when no qp-trie access occurs.

  * We can dispense with any API like rcu_synchronize(). In practice,
    it takes far too long to wait for a grace period to elapse for each
    write to a data structure.

  * We use the idea of "phases" (aka epochs or eras) from EBR to
    reduce the amount of bookkeeping needed to track memory that is no
    longer needed, knowing that the qp-trie does most of that work
    already.

I considered hazard pointers for safe memory reclamation. They have
more read-side overhead (updating the hazard pointers) and it wasn't
clear to me how to nicely schedule the cleanup work. Another
alternative, epoch-based reclamation, is designed for fine-grained
lock-free updates, so it needs some rethinking to work well with the
heavily read-biased design of the qp-trie. QSBR has the fastest read
side of the basic SMR algorithms (with no barriers), and fits well
into a libuv loop. More recent hybrid SMR algorithms do not appear to
have enough benefits to justify the extra complexity.
2023-02-23 15:57:53 +00:00
Tony Finch
5e8aa4982b Merge branch 'fanf-refcount-trace-tid' into 'main'
Include thread ID in refcount trace output

See merge request isc-projects/bind9!7584
2023-02-23 14:28:34 +00:00
Tony Finch
63cd73d43e Include thread ID in refcount trace output 2023-02-23 14:28:27 +00:00
Arаm Sаrgsyаn
4e1bddc6e0 Merge branch 'aram/catz-remove-unused-catzs-loop' into 'main'
Remove catzs->loop

See merge request isc-projects/bind9!7569
2023-02-23 09:39:17 +00:00
Aram Sargsyan
18d67fa916 Remove catzs->loop
The 'loop' member of the dns_catz_zones structure is not used.
2023-02-23 08:56:37 +00:00
Evan Hunt
211ec73f41 Merge branch '3778-empty-include' into 'main'
fix a crash from using an empty string for "include"

Closes #3778

See merge request isc-projects/bind9!7572
2023-02-22 17:36:13 +00:00
Evan Hunt
dc27552c30 remove isc_glob
the isc_glob module was originally needed to support posix-style glob
processing on Windows, but is now just an unnecessary wrapper around
glob(3). this commit removes it.
2023-02-22 17:35:29 +00:00
Evan Hunt
4dfc3f056d fix a crash from using an empty string for "include"
the parser could crash when "include" specified an empty string in place
of the filename. this has been fixed by returning ISC_R_FILENOTFOUND
when the string length is 0.
2023-02-22 17:35:29 +00:00
Tony Finch
7aa0ee4f5e Merge branch 'fanf-atomic-lists' into 'main'
Simple lock-free singly-linked stack

See merge request isc-projects/bind9!7470
2023-02-22 17:05:51 +00:00
Ondřej Surý
6eb1340d1b Use atomic stack for async job queue
Previously, the async job queue would use a locked-list (ISC_LIST).
With introduction of atomic stack (that has to be drained at once), we
could use it to remove some contention between the threads and simplify
the async queue.

Fortunately, the reverse order still works for us - instead of append
and tail/prev operation on the list, we are now using prepend and
head/next operation on the atomic stack.
2023-02-22 16:13:37 +00:00
Tony Finch
36e56923ce Simple lock-free stack in <isc/stack.h>
Add a singly-linked stack that supports lock-free prepend and drain (to
empty the list and clean up its elements).  Intended for use with QSBR
to collect objects that need safe memory reclamation, or any other user
that works with adding objects to the stack and then draining them in
one go like various work queues.

In <isc/atomic.h>, add an `atomic_ptr()` macro to make type
declarations a little less abominable, and clean up a duplicate
definition of `atomic_compare_exchange_strong_acq_rel()`
2023-02-22 16:13:37 +00:00
Tom Krizek
29a7507b04 Merge branch '3622-serve-stale-rrsig-test' into 'main'
[CVE-2022-3736] Test RRSIG queries with serve-stale enabled

Closes #3622

See merge request isc-projects/bind9!7578
2023-02-22 12:57:09 +00:00
Mark Andrews
add40273df
Test RRSIG queries with serve-stale enabled
Make RRSIG queries where the existing tests trigger a DNS_EVENT_TRYSTALE
event.
2023-02-22 13:22:02 +01:00
Tom Krizek
af33cd479b Merge branch '3619-serve-stale-client-timeout-crash-test' into 'main'
[CVE-2022-3924] Add a reproducer for the serve-stale crash when recursive clients soft quota is reached

Closes #3619

See merge request isc-projects/bind9!7575
2023-02-22 11:54:42 +00:00
Aram Sargsyan
4b52b0b4a9
Add tests for CVE-2022-3924
Reproduce the assertion by configuring a 'named' resolver with
'recursive-clients 10;' configuration option and running 20
queries is parallel.

Also tweak the 'ans2/ans.pl' to simulate a 50ms network latency
when qname starts with "latency". This makes sure that queries
running in parallel don't get served immediately, thus allowing
the configured recursive clients quota limitation to be activated.
2023-02-22 10:39:06 +01:00
Evan Hunt
1fb5d42416 Merge branch '3873-cleanup-task-timer-refs' into 'main'
remove references to obsolete isc_task/timer functions

Closes #3873

See merge request isc-projects/bind9!7568
2023-02-22 08:13:47 +00:00
Evan Hunt
b058f99cb8 remove references to obsolete isc_task/timer functions
removed references in code comments, doc/dev documentation, etc, to
isc_task, isc_timer_reset(), and isc_timertype_inactive. also removed a
coccinelle patch related to isc_timer_reset() that was no longer needed.
2023-02-22 08:13:30 +00:00
Evan Hunt
ee186855bf Merge branch 'each-no-sdb' into 'main'
remove SDB API and refactor builtin databases

Closes #3882

See merge request isc-projects/bind9!7558
2023-02-22 06:32:37 +00:00
Evan Hunt
dee4939299 CHANGES for [GL #3882] 2023-02-21 10:13:34 -08:00
Evan Hunt
aea4f10817 make builtin a standalone dns_db implementation
instead of using the SDB API as a wrapper to register and
unregister and provide a call framework for the builtin databases,
this commit flattens things so that the builtin databases implement
dns_db directly.
2023-02-21 10:13:10 -08:00
Evan Hunt
603cdb6332 move the dns_sdb API
move all dns_sdb code into bin/named/builtin.c, which is the
only place from which it's called.

(note this is temporary: later we'll refactor builtin so that it's a
standalone dns_db implementation on its own instead of using SDB
as a wrapper.)
2023-02-21 10:13:10 -08:00
Evan Hunt
77e7eac54c enable detailed db tracing
move database attach/detach functions to db.c, instead of
requiring them to be implemented for every database type.
instead, they must implement a 'destroy' function that is
called when references go to zero.

this enables us to use ISC_REFCOUNT_IMPL for databases,
with detailed tracing enabled by setting DNS_DB_TRACE to 1.
2023-02-21 10:13:10 -08:00
Evan Hunt
8da43bb7f5 simplify dns_sdb API
SDB is currently (and foreseeably) only used by the named
builtin databases, so it only needs as much of its API as
those databases use.

- removed three flags defined for the SDB API that were always
  set the same by builtin databases.

- there were two different types of lookup functions defined for
  SDB, using slightly different function signatures. since backward
  compatibility is no longer a concern, we can eliminate the 'lookup'
  entry point and rename 'lookup2' to 'lookup'.

- removed the 'allnodes' entry point and all database iterator
  implementation code

- removed dns_sdb_putnamedrr() and dns_sdb_putnamedrdata() since
  they were never used.
2023-02-21 10:13:10 -08:00
Evan Hunt
ffa4757c79 use member name initialization for methods
initialize dns_dbmethods, dns_sdbmethods and dns_rdatasetmethods
using explicit struct member names, so we don't have to keep track
of NULLs for unimplemented functions any longer.
2023-02-21 10:13:10 -08:00
Evan Hunt
8036412aaa make fewer dns_db functions mandatory-to-implement
some dns_db functions would have crashed if the DB implementation failed
to implement them, requiring the implementations to add functions that
did nothing but return ISC_R_NOTIMPLEMENTED or some obvious default
value. we can just have the dns_db wrapper functions themselves return
those values, and clean up the implementations accordingly.
2023-02-21 10:13:10 -08:00
Evan Hunt
c90fafa45d remove rdatalist_p.h
make the private isc__rdatalist_* functions public dns_rdatalist
functions so that all the rdatalist primitives can be used by
callers to libdns. (this will be needed later for moving SDB and
SDLZ out of libdns.)
2023-02-21 10:13:10 -08:00
Matthijs Mekking
c283850cc3 Merge branch 'matthijs-fix-kasp-attach-detach-usage' into 'main'
Fix kasp attach detach usage

See merge request isc-projects/bind9!7563
2023-02-21 15:45:12 +00:00
Mark Andrews
b41882cc75 Fix dns_kasp_attach / dns_kasp_detach usage
The kasp pointers in dns_zone_t should consistently be changed by
dns_kasp_attach and dns_kasp_detach so the usage is balanced.
2023-02-21 15:47:44 +01:00
Tony Finch
caafb15e1e Merge branch 'fanf-prune-libbind9' into 'main'
Move the last bits of libbind9 into libisc

See merge request isc-projects/bind9!7462
2023-02-21 13:12:44 +00:00
Tony Finch
8bb5f37fd4 Add CHANGES and release note
[cleanup]	Move bind9_getaddresses() to isc_getaddresses()
		and remove the now empty libbind9.
2023-02-21 13:12:26 +00:00
Tony Finch
4da9c582b8 Remove libbind9
It is now empty.
2023-02-21 13:12:26 +00:00
Tony Finch
3fef7c626a Move bind9_getaddresses() to isc_getaddresses()
No need to have a whole library for one function.
2023-02-21 13:12:26 +00:00
Mark Andrews
b2923ce356 Merge branch '3884-cid-436299-null-pointer-dereference-in-lib-dns-resolver-c' into 'main'
Resolve "CID 436299: Null pointer dereference in lib/dns/resolver.c"

Closes #3884

See merge request isc-projects/bind9!7562
2023-02-21 12:58:25 +00:00
Mark Andrews
9c17f4353b Cleanup left over 'fctx != NULL' test following refactoring
This was causing 'CID 436299: Null pointer dereferences (REVERSE_INULL)'
in Coverity.  Also removed an 'INSIST(fctx != NULL);' that should
no longer be needed.
2023-02-21 12:22:27 +00:00
Arаm Sаrgsyаn
69b39899d5 Merge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration' into 'main'
Detach rpzs and catzs from the previous view

Closes #3880

See merge request isc-projects/bind9!7552
2023-02-21 09:01:27 +00:00
Aram Sargsyan
b086374b1d Add a CHANGES note for [GL #3880] 2023-02-21 08:23:59 +00:00
Aram Sargsyan
121a095a22 Detach rpzs and catzs from the previous view
When switching to a new view during a reconfiguration (or reverting
to the old view), detach the 'rpzs' and 'catzs' from the previuos view.

The 'catzs' case was earlier solved slightly differently, by detaching
from the new view when reverting to the old view, but we can not solve
this the same way for 'rpzs', because now in BIND 9.19 and BIND 9.18
a dns_rpz_shutdown_rpzs() call was added in view's destroy() function
before detaching the 'rpzs', so we can not leave the 'rpzs' attached to
the previous view and let it be shut down when we intend to continue
using it with the new view.

Instead, "re-fix" the issue for the 'catzs' pointer the same way as
for 'rpzs' for consistency, and also because a similar shutdown call
is likely to be implemented for 'catzs' in the near future.
2023-02-21 08:23:13 +00:00
Aram Sargsyan
95f4bac002 Add an "rpz" system test check for a failed reconfiguration
The faulty "DLZ" configuration triggers a reconfiguration failure
in such a place where view reverting code is covered.
2023-02-21 08:23:13 +00:00