2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

38716 Commits

Author SHA1 Message Date
Ondřej Surý
b1cd4a066a
Unlock catzs during dns__catz_update_cb()
Instead of holding the catzs->lock the whole time we process the catz
update, only hold it for hash table lookup and then release it.  This
should unblock any other threads that might be processing updates to
catzs triggered by extra incoming transfer.
2023-02-24 17:04:33 +01:00
Aram Sargsyan
0b96c9234f
Offload catalog zone updates
Offload catalog zone processing so that the network manager threads
are not interrupted by a large catalog zone update.

Introduce a new 'updaterunning' state alongside with 'updatepending',
like it is done in the RPZ module.

Note that the dns__catz_update_cb() function currently holds the
catzs->lock during the whole process, which is far from being optimal,
but the issue is going to be addressed separately.
2023-02-24 15:18:02 +01:00
Ondřej Surý
afdb16dc01 Merge branch 'aram/catz-add-shutdown-signaling' into 'main'
Add shutdown signaling for catalog zones

See merge request isc-projects/bind9!7602
2023-02-24 14:08:20 +00:00
Aram Sargsyan
c76cc58803
Add a CHANGES note for [GL !7571] 2023-02-24 15:07:14 +01:00
Aram Sargsyan
246b7084d6
Add shutdown signaling for catalog zones
This change should make sure that catalog zone update processing
doesn't happen when the catalog zone is being shut down. This
should help avoid races when offloading the catalog zone updates
in the follow-up commit.
2023-02-24 15:06:54 +01:00
Ondřej Surý
94ee6f6672 Merge branch 'aram/catz-light-refactoring-and-reference-count-tracing' into 'main'
Implement reference count tracing for dns_catz_zone_t and dns_catz_zones_t

See merge request isc-projects/bind9!7570
2023-02-24 14:06:06 +00:00
Aram Sargsyan
c29299aa15
Add a CHANGES note for [GL !7570] 2023-02-24 15:00:44 +01:00
Aram Sargsyan
2a52d30660
Call dns_catz_new_zones() only when it is needed
The configure_catz() function creates the catalog zones structure
for the view even when it is not needed, in which case it then
discards it (by detaching) later.

Instead, call dns_catz_new_zones() only when it is needed, i.e. when
there is no existing "previous" view with an existing 'catzs', that
is going to be reused.
2023-02-24 15:00:26 +01:00
Aram Sargsyan
53f0c5a9ac
Add reference count tracing for dns_catz_zone_t and dns_catz_zones_t
Tracing can be activated by defining DNS_RPZ_TRACE in catz.h.
2023-02-24 15:00:26 +01:00
Aram Sargsyan
8cb79fec9d
Light refactoring of catz.c
* Change 'dns_catz_new_zones()' function's prototype (the order of the
  arguments) to synchronize it with the similar function in rpz.c.
* Rename 'refs' to 'references' in preparation of ISC_REFCOUNT_*
  macros usage for reference tracking.
* Unify dns_catz_zone_t naming to catz, and dns_catz_zones_t naming to
  catzs, following the logic of similar changes in rpz.c.
* Use C compound literals for structure initialization.
* Synchronize the "new zone version came too soon" log message with the
  one in rpz.c.
* Use more of 'sizeof(*ptr)' style instead of the 'sizeof(type_t)' style
  expressions when allocating or freeing memory for 'ptr'.
2023-02-24 15:00:26 +01:00
Michal Nowak
52c9a5b2f5 Merge branch 'mnowak/freebsd-12.4' into 'main'
Add FreeBSD 12.4

See merge request isc-projects/bind9!7169
2023-02-24 12:58:38 +00:00
Michal Nowak
2307661b1a
Add FreeBSD 12.4 2023-02-24 13:40:30 +01:00
Michal Nowak
5f805417cf Merge branch 'mnowak/alpine-3.17' into 'main'
Add Alpine Linux 3.17

See merge request isc-projects/bind9!7586
2023-02-24 11:46:50 +00:00
Michal Nowak
5783280b10
Drop date from "Regularly Tested Platforms" section
Changing the date is easy to forget and may be outdated.
2023-02-24 11:50:57 +01:00
Michal Nowak
345089ad23
Add Alpine Linux 3.17 2023-02-24 11:50:57 +01:00
Tony Finch
d2a450d308 Merge branch 'fanf-prune-libirs' into 'main'
Move irs_resconf into libdns and remove libirs

See merge request isc-projects/bind9!7463
2023-02-24 10:01:05 +00:00
Tony Finch
330ff06d4a Move irs_resconf into libdns and remove libirs
`libirs` used to be a reference implementation of `getaddrinfo` and
related modern resolver APIs. It was stripped down in BIND 9.18
leaving only the `irs_resconf` module, which parses
`/etc/resolv.conf`. I have kept its include path and namespace prefix,
so it remains a little fragment of libirs now embedded in libdns.
2023-02-24 09:38:59 +00:00
Ondřej Surý
5ad1fe3570 Merge branch 'ondrej-restore-sonarcloud-analysis' into 'main'
Add SonarCloud GitHub Action

See merge request isc-projects/bind9!7589
2023-02-24 08:53:45 +00:00
Ondřej Surý
4bfbb4ddf7 Add SonarCloud GitHub Action
Add new SonarCloud GitHub Action and configuration; something (maybe
the way the builds were submitted) has apparently changed and the
project got deleted and the analysis wasn't working.
2023-02-24 08:53:41 +00:00
Evan Hunt
14bba4688c Merge branch '3886-xfrin-dispatch' into 'main'
refactor dns_xfrin to use dns_dispatch

Closes #3886

See merge request isc-projects/bind9!7573
2023-02-24 08:30:48 +00:00
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