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

41024 Commits

Author SHA1 Message Date
Ondřej Surý
315aa3135a
Fix UAF in ccmsg.c when reading stopped before sending
When shutting down the whole server, the reading could stop and detach
from controlconnection before sending is done.  If send callback then
detaches from the last controlconnection handle, the ccmsg would be
invalidated after the send callback and thus we must not access ccmsg
after calling the send_cb().
2024-02-08 17:24:11 +01:00
Ondřej Surý
88a14985db
Add isc_nm_read_stop() and remove .reading member from ccmsg
We need to stop reading when calling isc_ccmsg_disconnect() as the
reading handle doesn't have to be last because sending might be in
progress.  After that, we can safely remove .reading member because the
reading would not be called after the disconnect has been called.

The ccmsg_senddone() should also not call the recv callback if the
sending failed, that's the job of the caller's send callback - in fact
it already does that, so the code in ccmsg_senddone() was superfluous.
2024-02-08 17:23:39 +01:00
Ondřej Surý
5964eb4796
Refactor the normal vs error path in control_senddone()
The code flow in control_senddone() was modified to be simpler to follow
and superfluous INSIST() was zapped from control_recvmessage().
2024-02-08 17:16:41 +01:00
Ondřej Surý
de25743e00 Merge branch 'ondrej/reduce-netmgr-memory-usage' into 'main'
Reduce memory sizes of common structures

See merge request isc-projects/bind9!8299
2024-02-08 14:45:25 +00:00
Ondřej Surý
15329d471e
Add memory pools for isc_nmsocket_t structures
To reduce memory pressure, we can add light per-loop (netmgr worker)
memory pools for isc_nmsocket_t structures.  This will help in
situations where there's a lot of churn creating and destroying the
nmsockets.
2024-02-08 15:13:47 +01:00
Ondřej Surý
750bd364b5
Reduce the isc_nmsocket_t size from 1840 to 1208 bytes
Embedding isc_nmsocket_h2_t directly inside isc_nmsocket_t had increased
the size of isc_nmsocket_t to 1840 bytes.  Making the isc_nmsocket_h2_t
to be a pointer to the structure and allocated on demand allows us to
reduce the size to 1208 bytes.  While there are still some possible
reductions in the isc_nmsocket_t (embedded tlsstream, streamdns
structures), this was the far biggest drop in the memory usage.
2024-02-08 15:13:47 +01:00
Ondřej Surý
eada7b6e13
Reduce struct isc__nm_uvreq size from 1560 to 560 bytes
The uv_req union member of struct isc__nm_uvreq contained libuv request
types that we don't use.  Turns out that uv_getnameinfo_t is 1000 bytes
big and unnecessarily enlarged the whole structure.  Remove all the
unused members from the uv_req union.
2024-02-08 15:13:47 +01:00
Ondřej Surý
2367b6a2e1
Reduce sizeof isc_sockaddr from 152 to 48 bytes
After removing sockaddr_unix from isc_sockaddr, we can also remove
sockaddr_storage and reduce the isc_sockaddr size from 152 bytes to just
48 bytes needed to hold IPv6 addresses.
2024-02-08 15:13:47 +01:00
Tom Krizek
2133e5f4f7 Merge branch '4560-pytest-junit-xml-compat' into 'main'
Support older junit XML format in test result processing

Closes #4560

See merge request isc-projects/bind9!8696
2024-02-08 13:57:07 +00:00
Tom Krizek
06a977a699
Add CHANGES note for [GL #4560] 2024-02-08 14:15:41 +01:00
Tom Krizek
bec3dd10b3
Support older junit XML format in test result processing
When running `make check` on a platform which has older (but still
supported) pytest, e.g. 3.4.2 on EL8, the junit to trs conversion would
fail because the junit format has different structure. Make the junit
XML processing more lenient to support both the older and newer junit
XML formats.
2024-02-08 14:14:26 +01:00
Tom Krizek
eb2e158172 Merge branch '4562-use-source-port-for-ditch-pl' into 'main'
Use a single local port for ditch.pl

Closes #4562

See merge request isc-projects/bind9!8698
2024-02-08 12:42:23 +00:00
Tom Krizek
339fa5690a
Use a single local port for ditch.pl
The ditch.pl script is used to generate burst traffic without waiting
for the responses. When running other tests in parallel, this can result
in a ephemeral port clash, since the ditch.pl process closes the socket
immediately. In rare occasions when the message ID also clashes with
other tests' queries, it might result in an UnexpectedSource error from
dnspython.

Use a dedicated port EXTRAPORT8 which is reserved for each test as a
source port for the burst traffic.
2024-02-08 13:41:23 +01:00
Ondřej Surý
381763120b Merge branch '4187-auto-vectorize-compiler-optimization-causing-exception-crash' into 'main'
Use proper padding instead of using alignas()

Closes #4187

See merge request isc-projects/bind9!8530
2024-02-08 11:17:58 +00:00
Ondřej Surý
306124b385
Add CHANGES note for [GL #4187] 2024-02-08 10:54:57 +01:00
Ondřej Surý
2463e5232d
Use proper padding instead of using alignas()
As it was pointed out, the alignas() can't be used on objects larger
than `max_align_t` otherwise the compiler might miscompile the code to
use auto-vectorization on unaligned memory.

As we were only using alignas() as a way to prevent false memory
sharing, we can use manual padding in the affected structures.
2024-02-08 10:54:35 +01:00
Ondřej Surý
05e60a0af6 Merge branch 'ondrej/various-rbtdb-fixes' into 'main'
Various rbtdb fixes and optimizations

See merge request isc-projects/bind9!8675
2024-02-08 07:34:07 +00:00
Ondřej Surý
8404129471
Use DNS_QPGC_MAYBE instead of DNS_QPGC_ALL for more realistic load
In the benchmarks, DNS_QPGC_ALL was trying to hard to cleanup QP
and this was slowing down QP too much.  Use DNS_QPGC_MAYBE instead
that we are going to use anyway for more realistic load - this also
shows the memory usage matching the real loads.
2024-02-08 08:33:36 +01:00
Ondřej Surý
6e81717cff
Add CHANGES note for [GL !8675] 2024-02-08 08:33:36 +01:00
Ondřej Surý
3f774c2a8a
Optimize cname_and_other_data to stop as earliest as possible
Stop the cname_and_other_data processing if we already know that the
result is true.  Also, we know that CNAME will be placed in the priority
headers, so we can stop looking for CNAME if we haven't found CNAME and
we are past the priority headers.
2024-02-08 08:33:36 +01:00
Ondřej Surý
3ac482be7f
Optimize the slabheader placement for certain RRTypes
Mark the infrastructure RRTypes as "priority" types and place them at
the beginning of the rdataslab header data graph.  The non-priority
types either go right after the priority types (if any).
2024-02-08 08:33:36 +01:00
Ondřej Surý
5070c7f5c7
Fix missing RRSIG for CNAME with different slabheader order
The cachedb was missing piece of code (already found in zonedb) that
would make lookups in the slabheaders to miss the RRSIGs for CNAME if
the order of CNAME and RRSIG(CNAME) was reversed in the node->data.
2024-02-08 08:02:48 +01:00
Ondřej Surý
f89e3e04cf Merge branch 'ondrej/isc-mem-rcu-barrier-improvements' into 'main'
Use _exit() in the fatal() function

See merge request isc-projects/bind9!8703
2024-02-08 07:02:21 +00:00
Ondřej Surý
0c18ed7ec6
Remove isc__tls_setfatalmode() function and the calls
With _exit() instead of exit() in place, we don't need
isc__tls_setfatalmode() mechanism as the atexit() calls will not be
executed including OpenSSL atexit hooks.
2024-02-08 08:01:58 +01:00
Ondřej Surý
76997983fd
Use EXIT_SUCCESS and EXIT_FAILURE
Instead of randomly using -1 or 1 as a failure status, properly utilize
the EXIT_FAILURE define that's platform specific (as it should be).
2024-02-08 08:01:58 +01:00
Ondřej Surý
e140743e6a
Improve the rcu_barrier() call when destroying the mem context
Instead of crude 5x rcu_barrier() call in the isc__mem_destroy(), change
the mechanism to call rcu_barrier() until the memory use and references
stops decreasing.  This should deal with any number of nested call_rcu()
levels.

Additionally, don't destroy the contextslock if the list of the contexts
isn't empty.  Destroying the lock could make the late threads crash.
2024-02-08 08:01:58 +01:00
Ondřej Surý
4bec711fe3
Use _exit() in the fatal() function
Since the fatal() isn't a correct but rather abrupt termination of the
program, we want to skip the various atexit() calls because not all
memory might be freed during fatal() call, etc.  Using _exit() instead
of exit() has this effect - the program will end, but no destructors or
atexit routines will be called.
2024-02-08 08:01:58 +01:00
Ondřej Surý
4e2e2a13b7 Merge branch 'ondrej/use-error-checking-mutex-on-linux' into 'main'
Always use adaptive mutexes on Linux and use error checking mutexes in developer mode

See merge request isc-projects/bind9!8693
2024-02-07 21:55:31 +00:00
Ondřej Surý
2c98ccbdba
Use error checking mutex in developer mode on Linux
When developer mode is enabled, use error checking mutex type, so we can
discover wrong use of mutexes faster.
2024-02-07 20:54:05 +01:00
Ondřej Surý
01038d894f
Always use adaptive mutexes on Linux
When adaptive mutexes are available (with glibc), always use them.
Remove the autoconf switch and also fix the static initializer.
2024-02-07 20:54:05 +01:00
Ondřej Surý
cb1d2e57e9
Remove unused mutex from netmgr
The netmgr->lock was dead code, remove it.
2024-02-07 20:54:05 +01:00
Mark Andrews
8c6531d326 Merge branch '4519-check-return-value-of-snprintf-in-lib-isccfg-check-c' into 'main'
Resolve "Check return value of snprintf in lib/isccfg/check.c"

Closes #4519

See merge request isc-projects/bind9!8624
2024-02-07 13:49:19 +00:00
Mark Andrews
2f87c429a2 cleanup isc_symtab_define with isc_symexists_replace 2024-02-07 13:52:10 +11:00
Mark Andrews
1fb61494a8 Add RUNTIME_CHECK 2024-02-07 13:40:03 +11:00
Mark Andrews
95de7f829c Ensure keyname buffer is big enough
Use a temporary string rather than a fixed buffer to construct
the keyname.
2024-02-07 13:39:51 +11:00
Mark Andrews
7cced1732d cleanup isc_symtab_undefine callers
isc_symtab_undefine now only return ISC_R_SUCCESS and ISC_R_EXISTS.
Cleanup callers looking for other values.
2024-02-07 12:56:39 +11:00
Mark Andrews
248b713b0c Merge branch '4561-shutdown-test-doesn-t-log-everything-to-named-run' into 'main'
Resolve "Shutdown test doesn't log everything to named.run"

Closes #4561

See merge request isc-projects/bind9!8695
2024-02-07 01:03:05 +00:00
Tom Krizek
fb70c4d475 Re-enable rndc shutdown test
The issue preventing a proper rndc shutdown was recently fixed and
the test now passes.
2024-02-07 11:29:47 +11:00
Mark Andrews
3651c58a6a Capture the resolver's startup and shutdown logging
Also set the debugging to 99.
2024-02-07 11:29:47 +11:00
Mark Andrews
65a3450b8b Merge branch '4529-abort-in-nsupdate-2' into 'main'
Resolve "Abort in nsupdate"

Closes #4529

See merge request isc-projects/bind9!8658
2024-02-06 23:27:05 +00:00
Mark Andrews
4087a75fd6 Add CHANGES entry for [GL #4529] 2024-02-07 09:53:03 +11:00
Mark Andrews
4b93ae74c7 Restore dns_requestmgr_shutdown re-entrancy
In the conversion to rcu the ability to call dns_requestmgr_shutdown
multiple times was lost.  nsupdate depended on this.  Restore support
for that.
2024-02-07 09:52:32 +11:00
Arаm Sаrgsyаn
97b3477d0a Merge branch '4241-expose-zone-first-time-refreshes' into 'main'
Resolve "Expose data about 'first time' zone maintenance in-progress"

Closes #4241

See merge request isc-projects/bind9!8481
2024-02-06 11:26:28 +00:00
Aram Sargsyan
1d064d3257 Add a release note for [GL #4241] 2024-02-05 17:45:19 +00:00
Aram Sargsyan
e17079e375 Add a CHANGES note for [GL #4241] 2024-02-05 17:41:53 +00:00
Aram Sargsyan
e3557f8661 Add a check for the 'first refresh' data in rndc status
Check that 'rndc status' correctly indicates the expected number
of the secondary zones which have the 'first refresh' flag set.
2024-02-05 17:41:14 +00:00
Aram Sargsyan
0b6ee6b953 Add a check for the 'first refresh' data in the stats channel
Currently we test the incoming zone transfers data in the statistics
channel by retransfering the zones in slow mode and capturing the XML
and JSON outputs in the meantime to check their validity. Add a new
transfer to the test, and check that the XML and JSON files correctly
indicate that we have 3 retransfers and 1 new (first time) transfer.
2024-02-05 17:41:14 +00:00
Aram Sargsyan
2ec041b719 Expose the 'first refresh' zone flag in rndc status
Expose the newly added 'first refresh' flag in the information
provided by the 'rndc staus' command, by showing the number of
zones, which are not yet fully ready, and their first refresh
is pending or is in-progress.
2024-02-05 17:41:14 +00:00
Aram Sargsyan
0a1f05987f Expose 'first refresh' zone flag in stats channel
Add a new zone flag to indicate that a secondary type zone is
not yet fully ready, and a first time refresh is pending or is
in progress.

Expose this new flag in the statistics channel's "Incoming Zone
Transfers" section.
2024-02-05 17:41:14 +00:00
Arаm Sаrgsyаn
87942ee0b4 Merge branch '4373-dnssec-validation-yes-should-fail-without-trust-anchors' into 'main'
'dnssec-validation yes' should fail when no trust anchors are configured

Closes #4373

See merge request isc-projects/bind9!8575
2024-02-02 19:55:00 +00:00