Commit Graph

41583 Commits

Author SHA1 Message Date
Evan Hunt
7e3b425dc2 reduce the max-recursion-queries default to 32
the number of iterative queries that can be sent to resolve a
name now defaults to 32 rather than 100.
2024-08-07 13:19:57 -07:00
Evan Hunt
c5588babaf make "max_restarts" a configurable value
MAX_RESTARTS is no longer hard-coded; ns_server_setmaxrestarts()
and dns_client_setmaxrestarts() can now be used to modify the
max-restarts value at runtime. in both cases, the default is 11.
2024-08-07 13:03:08 -07:00
Evan Hunt
05d78671bb reduce MAX_RESTARTS to 11
the number of steps that can be followed in a CNAME chain
before terminating the lookup has been reduced from 16 to 11.
(this is a hard-coded value, but will be made configurable later.)
2024-08-07 13:00:42 -07:00
Evan Hunt
825f3d68c5 add debug logging when creating or attaching to a query counter
fctx_create() now logs at debug level 9 when the fctx attaches
to an existing counter or creates a new one.
2024-08-07 11:21:44 -07:00
Evan Hunt
af7db89513 apply max-recursion-queries quota to validator queries
previously, validator queries for DNSKEY and DS records were
not counted toward the quota for max-recursion-queries; they
are now.
2024-08-07 11:21:44 -07:00
Evan Hunt
d3b7e92783 attach query counter to NS fetches
there were cases in resolver.c when queries for NS records were
started without passing a pointer to the parent fetch's query counter;
as a result, the max-recursion-queries quota for those queries started
counting from zero, instead of sharing the limit for the parent fetch,
making the quota ineffective in some cases.
2024-08-07 11:21:44 -07:00
Aydın Mercan
cd92a145a3 chg: dev: use only c23 or c11 noreturn specifiers
Use `[[noreturn]]` when compiling with C23 or greater.

The attribute macro name has been capitalized as `NORETURN` as defining it as `noreturn` breaks external headers.
`#define noreturn __attribute__((noreturn))` wasn't used as C11's `stdnoreturn.h`/`_Noreturn` is required to build BIND9 in the first place.

Merge branch 'aydin/noreturn-c23' into 'main'

See merge request isc-projects/bind9!9149
2024-08-07 15:42:57 +00:00
Aydın Mercan
f58ed932d8 use only c23 or c11 noreturn specifiers
Since we require C11 or greater, we can depend on using either _Noreturn
or [[noreturn]].
2024-08-07 18:27:40 +03:00
Ondřej Surý
7f2513a5aa chg: dev: Initialize the DST subsystem implicitly
Instead of calling dst_lib_init() and dst_lib_destroy() explicitly by
all the programs, create a separate memory context for the DST subsystem
and use the library constructor and destructor to initialize the DST
internals.

Merge branch 'ondrej/move-dst_lib_init-and-destroy-to-lib-ctor-dtor' into 'main'

See merge request isc-projects/bind9!9254
2024-08-07 15:05:13 +00:00
Ondřej Surý
e6f2f2a5e6 Initialize the DST subsystem implicitly
Instead of calling dst_lib_init() and dst_lib_destroy() explicitly by
all the programs, create a separate memory context for the DST subsystem
and use the library constructor and destructor to initialize the DST
internals.
2024-08-07 17:03:27 +02:00
Ondřej Surý
ab2abfc8b0 chg: test: Use new images with TSAN-enabled libraries
The new Fedora 40 TSAN images use libuv, urcu and OpenSSL libraries compiled with ThreadSanitizer.  This (in theory) should enable better detection of memory races in those (most important) libraries.

Merge branch 'ondrej/test-new-tsan-images' into 'main'

See merge request isc-projects/bind9!9264
2024-08-07 14:28:13 +00:00
Ondřej Surý
ed766efc15 Add configure for libraries in /usr/local for the gcc:tsan job
The TSAN-enabled libraries are installed to /usr/local, pass the
PKG_CONFIG_PATH and few other options to CFLAGS to the configure
arguments.
2024-08-07 14:27:06 +00:00
Ondřej Surý
1d1bc3a148 fix: dev: Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Closes #4834

Merge branch '4834-detach-SSL-from-cached-SSL_SESSION' into 'main'

Closes #4834

See merge request isc-projects/bind9!9271
2024-08-07 14:26:22 +00:00
Ondřej Surý
c11b736e44 Disassociate the SSL object from the cached SSL_SESSION
When the SSL object was destroyed, it would invalidate all SSL_SESSION
objects including the cached, but not yet used, TLS session objects.

Properly disassociate the SSL object from the SSL_SESSION before we
store it in the TLS session cache, so we can later destroy it without
invalidating the cached TLS sessions.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Artem Boldariev <artem@isc.org>
Co-authored-by: Aram Sargsyan <aram@isc.org>
2024-08-07 14:25:11 +00:00
Ondřej Surý
ee00bddf94 fix: dev: Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.

Closes #4833

Merge branch '4833-tlssock-needs-to-attach-to-child-tlslistener' into 'main'

Closes #4833

See merge request isc-projects/bind9!9270
2024-08-07 14:17:50 +00:00
Ondřej Surý
684f3eb8e6 Attach/detach to the listening child socket when accepting TLS
When TLS connection (TLSstream) connection was accepted, the children
listening socket was not attached to sock->server and thus it could have
been freed before all the accepted connections were actually closed.

In turn, this would cause us to call isc_tls_free() too soon - causing
cascade errors in pending SSL_read_ex() in the accepted connections.

Properly attach and detach the children listening socket when accepting
and closing the server connections.
2024-08-07 14:17:43 +00:00
Petr Špaček
ced1eb358d fix: pkg: Fix --enable-tracing build on systems without dtrace
Missing file util/dtrace.sh prevented builds on system without dtrace utility.
This has been corrected.

Fixes: #4835

Merge branch 'pspacek/gitattribute-fixes' into 'main'

Closes #4835

See merge request isc-projects/bind9!9262
2024-08-07 13:53:29 +00:00
Petr Špaček
9abedb7757 Include util/dtrace.sh in tarballs 2024-08-07 15:51:34 +02:00
Petr Špaček
50b8d9b674 Remove obsolete reference to mksymtbl.pl
This was a leftover from commit c463808992
2024-08-07 15:51:28 +02:00
Petr Špaček
5dd3c41676 fix: dev: Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.

Closes #4831

Merge branch '4831-isctest-make-hypothesis-optional' into 'main'

Closes #4831

See merge request isc-projects/bind9!9265
2024-08-07 10:55:21 +00:00
Nicki Křížek
e6a7695600 Make hypothesis optional for system tests
Ensure that system tests can be executed without Python hypothesis
package.
2024-08-07 10:55:06 +00:00
Mark Andrews
7facf967ac fix: usr: Dig now reports missing query section for opcode QUERY
Query responses should contain the question section with some exceptions.  Dig was not reporting this.

Closes #4808

Merge branch '4808-have-dig-report-missing-question-section-in-axfr-response' into 'main'

Closes #4808

See merge request isc-projects/bind9!9233
2024-08-07 02:20:22 +00:00
Mark Andrews
327e890910 Dig now reports a missing question section
The question section should be present in the first AXFR/IXFR
response and in other QUERY responses unless no question was sent.
Issue a warning if the question section is not present.
2024-08-07 00:49:08 +00:00
Ondřej Surý
b620b7e911 chg: usr: Remove OpenSSL 1.x Engine support
The OpenSSL 1.x Engines support has been deprecated in the OpenSSL 3.x
and is going to be removed from the upstream OpenSSL.  Remove the OpenSSL
Engine support from BIND 9 in favor of OpenSSL 3.x Providers.

Closes #4828

Merge branch '4828-remove-OpenSSL-engine-support' into 'main'

Closes #4828

See merge request isc-projects/bind9!9252
2024-08-06 14:04:56 +00:00
Ondřej Surý
cd54f9d4b9 Always use OpenSSL_version() to print OpenSSL version
OpenSSL_version() first appeared in OpenSSL 1.1.0 and have been
available since LibreSSL 2.7.1 and OpenBSD 6.3, thus we can remove the
compatibility shims with older versions that are not supported anymore.
2024-08-06 15:17:48 +02:00
Ondřej Surý
495cf18c75 Remove checks for OPENSSL_API_LEVEL define
Since the support for OpenSSL Engines has been removed, we can now also
remove the checks for OPENSSL_API_LEVEL; The OpenSSL 3.x APIs will be
used when compiling with OpenSSL 3.x, and OpenSSL 1.1.xx APIs will be
used only when OpenSSL 1.1.x is used.
2024-08-06 15:17:48 +02:00
Ondřej Surý
ef7aba7072 Remove OpenSSL Engine support
The OpenSSL 1.x Engines support has been deprecated in the OpenSSL 3.x
and is going to be removed.  Remove the OpenSSL Engine support in favor
of OpenSSL Providers.
2024-08-06 15:17:48 +02:00
Ondřej Surý
1688c96bda fix: Move matching isc_mem_destroy() outside of ifdef
The isc_mem_create() in printversion() was created outside of an #ifdef
HAVE_GEOIP, but destroyed inside the #ifdef; move it to the outside of
the #ifdef where it belongs.

This is really a nit as we immediately exit() after printing the
versions, but I found it and it would bug me for the rest of my life.

Merge branch 'ondrej/fix-missing-isc_mem_destroy-in-printversion' into 'main'

See merge request isc-projects/bind9!9255
2024-08-05 16:54:02 +00:00
Ondřej Surý
2ebcafd8c2 Move matching isc_mem_destroy() outside of ifdef
The isc_mem_create() in printversion() was created outside of an #ifdef
HAVE_GEOIP, but destroyed inside the #ifdef; move it to the outside of
the #ifdef where it belongs.

This is really a nit as we immediately exit() after printing the
versions, but I found it and it would bug me for the rest of my life.
alessio/regression/2ebcafd8c2
2024-08-05 16:35:22 +02:00
Ondřej Surý
227add4c3e fix: usr: Fix assertion failure in the glue cache
Fix an assertion failure that could happen as a result of data race between free_gluetable() and addglue() on the same headers.

Closes #4691

Merge branch '4691-fix-data-race-between-free_gluetable-and-addglue' into 'main'

Closes #4691

See merge request isc-projects/bind9!9126
alessio/regression/227add4c3e
2024-08-05 14:24:14 +00:00
Ondřej Surý
a26055f03e fix: dev: don't use 'create' flag unnecessarily in findnode()
when searching the cache for a node so that we can delete an rdataset, it isn't necessary to set the 'create' flag. if the
node doesn't exist yet, we won't be able to delete anything from it anyway.

Merge branch 'each-minor-findnode-refactor' into 'main'

See merge request isc-projects/bind9!9158
alessio/regression/a26055f03e
2024-08-05 13:36:54 +00:00
Ondřej Surý
5beae5faf9 Fix the glue table in the QP and RBT zone databases
When adding glue to the header, we add header to the wait-free stack to
be cleaned up later which sets wfc_node->next to non-NULL value.  When
the actual cleaning happens we would only cleanup the .glue_list, but
since the database isn't locked for the time being, the headers could be
reused while cleaning the existing glue entries, which creates a data
race between database versions.

Revert the code back to use per-database-version hashtable where keys
are the node pointers.  This allows each database version to have
independent glue cache table that doesn't affect nodes or headers that
could already "belong" to the future database version.
2024-08-05 15:36:54 +02:00
Evan Hunt
6b720bfe1a minor findnode optimization
when searching the cache for a node so that we can delete an
rdataset, it is not necessary to set the 'create' flag. if the
node doesn't exist yet, we then we won't be able to delete
anything from it anyway.
2024-08-05 13:36:41 +00:00
Ondřej Surý
bad8b03188 chg: Clean up calls to dns_difftuple_create()
dns_difftuple_create() could only return success, so change
its type to void and clean up all the calls to it.

Merge branch 'each-difftuple-create-cannot-fail' into 'main'

See merge request isc-projects/bind9!9151
2024-08-05 13:31:46 +00:00
Evan Hunt
a68a77ca86 dns_difftuple_create() cannot fail
dns_difftuple_create() could only return success, so change
its type to void and clean up all the calls to it.

other functions that only returned a result value because of it
have been cleaned up in the same way.
2024-08-05 13:31:38 +00:00
Ondřej Surý
6573276bad fix: usr: Raise the log level of priming failures
When a priming query is complete, it's currently logged at level ISC_LOG_DEBUG(1), regardless of success or failure. We are now raising it to ISC_LOG_NOTICE in the case of failure. [GL #3516]

Closes #3516

Merge branch '3516-log-priming-errors' into 'main'

Closes #3516

See merge request isc-projects/bind9!9121
2024-08-05 13:02:41 +00:00
Evan Hunt
a84d54c6ff raise the log level of priming failures
when a priming query is complete, it's currently logged at
level ISC_LOG_DEBUG(1), regardless of success or failure. we
are now raising it to ISC_LOG_NOTICE in the case of failure.
2024-08-05 13:56:13 +02:00
Ondřej Surý
5fafb0e7f7 chg: dev: fix the rsa exponent to 65537
There isn't a realistic reason to ever use e = 4294967297. Fortunately
its codepath wasn't reachable to users and can be safetly removed.

Keep in mind the `dns_key_generate` header comment was outdated. e = 3
hasn't been used since 2006 so there isn't a reason to panic. The
toggle was the public exponents between 65537 and 4294967297.

Merge branch 'aydin/rsa-cleanup' into 'main'

See merge request isc-projects/bind9!9133
2024-08-05 11:22:32 +00:00
Aydın Mercan
2a76352b37 fix the rsa exponent to 65537
There isn't a realistic reason to ever use e = 4294967297. Fortunately
its codepath wasn't reachable to users and can be safetly removed.

Keep in mind the `dns_key_generate` header comment was outdated. e = 3
hasn't been used since 2006 so there isn't a reason to panic. The
toggle was the public exponents between 65537 and 4294967297.
2024-08-05 11:21:59 +00:00
Ondřej Surý
9397251eb3 chg: dev: remove the crc64 implementation
CRC-64 has been added for map files. Now that the map file format has
been removed, there isn't a reason to keep the implementation.

Merge branch 'aydin/cleanup-crc' into 'main'

See merge request isc-projects/bind9!9135
2024-08-05 11:21:38 +00:00
Aydın Mercan
5dbb560747 remove the crc64 implementation
CRC-64 has been added for map files. Now that the map file format has
been removed, there isn't a reason to keep the implementation.
2024-08-05 11:21:25 +00:00
Ondřej Surý
dcee04f70c chg: dev: call rcu_barrier() in the isc_mem_destroy() just once
The previous work in this area was led by the belief that we might be
calling call_rcu() from within call_rcu() callbacks.  After carefully
checking all the current callback, it became evident that this is not
the case and the problem isn't enough rcu_barrier() calls, but something
entirely else.

Call the rcu_barrier() just once as that's enough and the multiple
rcu_barrier() calls will not hide the real problem anymore, so we can
find it.

Merge branch '4607-call-a-single-rcu_barrier' into 'main'

See merge request isc-projects/bind9!9134
2024-08-05 10:24:53 +00:00
Ondřej Surý
13941c8ca7 Call rcu_barrier() in the isc_mem_destroy() just once
The previous work in this area was led by the belief that we might be
calling call_rcu() from within call_rcu() callbacks.  After carefully
checking all the current callback, it became evident that this is not
the case and the problem isn't enough rcu_barrier() calls, but something
entirely else.

Call the rcu_barrier() just once as that's enough and the multiple
rcu_barrier() calls will not hide the real problem anymore, so we can
find it.
2024-08-05 10:24:47 +00:00
Ondřej Surý
96ccd962b7 chg: usr: require at least OpenSSL 1.1.1
OpenSSL 1.1.1 or better (or equivalent LibreSSL version) is now required to compile BIND 9.

Closes #2806

Merge branch '2806-remove-ax_check_openssl' into 'main'

Closes #2806

See merge request isc-projects/bind9!9110
2024-08-05 10:24:23 +00:00
Ondřej Surý
8ccfbcfe72 Remove no longer needed OpenSSL shims and checks
Since the minimal OpenSSL version is now OpenSSL 1.1.1, remove all kind
of OpenSSL shims and checks for functions that are now always present in
the OpenSSL libraries.

Co-authored-by: Ondřej Surý <ondrej@isc.org>
Co-authored-by: Aydın Mercan <aydin@isc.org>
2024-08-05 10:23:59 +00:00
Ondřej Surý
4d77eafd13 Remove AX_CHECK_OPENSSL macro
OpenSSL supports pkg-config method since the 0.9.8 version and we
already require pkg-config for other mandatory libraries.  Also
the way the AX_CHECK_OPENSSL macro was integrated into the configure
script was confusing - the macro would be used only if the libcrypto.pc
and libssl.pc file are not usable, so calling ./configure
--with-openssl=/usr/local would have no effect when PKG_CHECK_MODULES
would be successful.
2024-08-05 10:23:59 +00:00
Ondřej Surý
c43b74c28b Bump the minimal OpenSSL version to 1.1.1
As BIND 9.20 does not support RHEL/CentOS 7 which just reach
end-of-life, we can safely bump the OpenSSL requirements to version
1.1.1, which in turn will allow us to simplify our OpenSSL integration.
2024-08-05 10:23:59 +00:00
Ondřej Surý
00739e99f6 fix: usr: Fix assertion failure when checking named-checkconf version
Checking the version of `named-checkconf` would end with assertion failure.  This has been fixed.

Closes #4827

Merge branch '4827-cleanup-dst-only-if-initialized' into 'main'

Closes #4827

See merge request isc-projects/bind9!9243
2024-08-05 10:16:39 +00:00
Ondřej Surý
c54880e3fa Fix assertion failure when checking named-checkconf version
The dst_lib_destroy() should be called only if dst_lib_init() was called
before.  In named-checkconf, that is guarded by dst_cleanup variable
that was erroneously set to true by default.  Set the dst_cleanup to
'false' by default.
2024-08-05 10:16:33 +00:00
Ondřej Surý
7a705a3ea4 fix: usr: Valid TSIG signatures with invalid time cause crash
An assertion failure triggers when the TSIG has valid cryptographic signature, but the time is invalid. This can happen when the times between the primary and secondary servers are not synchronised.

Closes #4811

Merge branch '4811-fix-isc_buffer_putuint48-buffer-size-requirement' into 'main'

Closes #4811

See merge request isc-projects/bind9!9234
2024-08-05 09:40:10 +00:00