Commit Graph

41621 Commits

Author SHA1 Message Date
Ondřej Surý
7cb9af430e chg: test: For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.

Additionally, drop Debian bullseye that's EOL now.

Merge branch 'ondrej/use-staging-tsan-images' into 'main'

See merge request isc-projects/bind9!9324
2024-08-15 21:03:26 +00:00
Ondřej Surý
d02d6af2b9 Remove Debian bullseye jobs
The Debian bullseye has reached end-of-life, remove it from the CI.
2024-08-15 22:23:56 +02:00
Ondřej Surý
2a46396f29 For TSAN builds, use libraries from /opt/tsan
The new TSAN images, the TSAN-enabled images install libraries to
/opt/tsan, synchronize the configure options and CFLAGS between gcc:tsan
and clang:tsan images and set the PKG_CONFIG_PATH to /opt/tsan/lib.
2024-08-15 22:23:56 +02:00
Arаm Sаrgsyаn
ebd669a830 fix: dev: Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.

Closes #4842

Merge branch '4842-shutdown-crash-in-isc_log_doit' into 'main'

Closes #4842

See merge request isc-projects/bind9!9297
2024-08-15 12:55:28 +00:00
Aram Sargsyan
656e04f48a Check if logconfig is NULL before using it in isc_log_doit()
Check if 'lctx->logconfig' is NULL before using it in isc_log_doit(),
because it's possible that isc_log_destroy() was already called, e.g.
when a 'call_rcu' function wants to log a message during shutdown.
2024-08-15 12:54:37 +00:00
Arаm Sаrgsyаn
75021765f8 fix: dev: Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.

Closes #4841

Merge branch '4841-alignment-of-_Atomic-long-long-unsigned-int' into 'main'

Closes #4841

See merge request isc-projects/bind9!9319
2024-08-15 12:51:03 +00:00
Aram Sargsyan
867066aa53 Add -Wno-psabi to CFLAGS for x86 (32-bit) builds
GCC 11.1+ emits a note during compilation when there are 64-bit
atomic fields in a structure, because it fixed a compiler bug
by changing the alignment of such fields, which caused ABI change.

Add -Wno-psabi to CFLAGS for such builds in order to silence the
warning. That shouldn't be a problem since we don't expose our
structures to the outside.
2024-08-15 12:50:41 +00:00
Aydın Mercan
936975a9ae rem: do not include config.h
The build system ensures it is always included for every source file.

Merge branch 'aydin/no-include-config-h' into 'main'

See merge request isc-projects/bind9!9320
2024-08-15 12:12:15 +00:00
Aydın Mercan
b330eb0af8 do not include config.h
The build system ensures it is always included for every source file.
2024-08-15 12:11:48 +00:00
Ondřej Surý
5275b6bc83 chg: test: Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.

Closes #4851

Merge branch '4851-generate-problematic-isc_hashmap-test-data' into 'main'

Closes #4851

See merge request isc-projects/bind9!9318
2024-08-15 11:56:49 +00:00
Ondřej Surý
2310c322c0 Reduce the size of hashmap_nodes.h file
Instead of keeping the whole array of test_node_t objects, just keep the
hashvalues and generated the rest of the test_node_t on the fly.  The
test still works this way and the file size has been reduced from 2M to
90k.
2024-08-15 10:05:32 +02:00
Ondřej Surý
43c81e2e24 fix: Change the placement of ctor/dtor attributes in the dst_api
Change the placement of the attributes to match the existing usage in
other places (after the declaration).

Merge branch 'ondrej/ISC_CONSTRUCTOR-style' into 'main'

See merge request isc-projects/bind9!9291
2024-08-14 16:21:08 +00:00
Ondřej Surý
d00ff78a3e Change the placement of ctor/dtor attributes in the dst_api
Change the placement of the attributes to match the existing usage in
other places (after the declaration).
2024-08-14 15:30:18 +00:00
Nicki Křížek
ac395b058c chg: ci: Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.

Related #4847

Merge branch 'nicki/add-changelog-entry-check' into 'main'

See merge request isc-projects/bind9!9294
2024-08-14 15:25:26 +00:00
Nicki Křížek
480dcdef9a Use python3 in shebang lines for util scripts
Some distributions (notably, debian bookworm) have deprecated the
`python` interpreter in favor of `python3`. Since our scripts are
python3 anyway, use the proper numbered version in shebang to make
scripts easily executable.
2024-08-14 17:22:22 +02:00
Nicki Křížek
bf69e8f149 Check that generated changelog entry doesn't break docs build
Since changelog entries are now generated from MR title&description,
they aren't sanity checked during a regular docs build. If these contain
special sequences that will be interpreted by sphinx, it might result in
breakage that would have to be amended manually.

Add a CI check to test a doc build with changelog after the MR is merged
to ensure that the docs can be built when generating changelog from
pristine git contents.
2024-08-14 17:22:20 +02:00
Ondřej Surý
c31cd67788 fix: dev: Fix the assertion failure in the isc_hashmap iterator
When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.

Closes #4838

Merge branch '4838-fix-assertion-failure-in-hashmap-deletion-iterator' into 'main'

Closes #4838

See merge request isc-projects/bind9!9292
2024-08-14 15:19:11 +00:00
Ondřej Surý
3e4d153453 Skip already rehashed positions in the old hashmap table
When iterating through the old internal hashmap table, skip all the
nodes that have been already migrated to the new table.  We know that
all positions with index less than .hiter are NULL.
2024-08-14 15:19:04 +00:00
Ondřej Surý
acdc57259f Fix the assertion failure in the isc_hashmap iterator
When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.
2024-08-14 15:19:04 +00:00
Ondřej Surý
482eed2e31 Add known-to-crash static hashmap iterator nodes array
Add second iterator test with a well-known configuration of the nodes
array that causes the last element of the array to migrate two times to
the previous node.
2024-08-14 15:19:04 +00:00
Nicki Křížek
2c7088a48d chg: doc: Fix ordering of gitchangelog replacement regexs
Ensure the issue number in changelog isn't accidentally removed for backport MRs.

Merge branch 'nicki/fix-gitchangelog-replacement-regexs' into 'main'

See merge request isc-projects/bind9!9295
2024-08-14 15:06:08 +00:00
Nicki Křížek
37274bebe1 Fix ordering of gitchangelog replacement regexs
Prior to this change, the issue number could be accidentally removed by
the `Backport of` text, depending on the order of the MR description
contents. Ensure all the removals for text in MR descriptions happen
first, and only then run the replacement regex for issue number, which
appends it to the end of the last non-empty line (which will no longer
be removed).

The only removals that happen after the replacement are guaranteed to
always happen after the end of MR description, since they're
auto-generated by gitlab when the merge commit is created, thus won't
affect the line with the issue number.

Also remove the needless isc-private/bind9 replacement. References
to private MRs are already removed by the very first regex.
2024-08-14 14:49:43 +00:00
Ondřej Surý
f4e0d0e460 fix: dev: Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config.  This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this.  Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.

Merge branch 'ondrej/silence-warnings-from-default-config' into 'main'

See merge request isc-projects/bind9!9304
2024-08-14 12:52:01 +00:00
Ondřej Surý
86f1ec34dc Silence all warnings that stem from the default config
As we now setup the logging very early, parsing the default config would
always print warnings about experimental (and possibly deprecated)
options in the default config.  This would even mess with commands like
`named -V` and it is also wrong to warn users about using experimental
options in the default config, because they can't do anything about
this.  Add CFG_PCTX_NODEPRECATED and CFG_PCTX_NOEXPERIMENTAL options
that we can pass to cfg parser and silence the early warnings caused by
using experimental options in the default config.
2024-08-14 12:50:31 +00:00
Ondřej Surý
f73a19bb3e rem: dev: Remove outdated perllib integration
The code in conftools/ directory hasn't been touched since 2000.
Nobody knows what it does and nobody even knows how to build it
or test it.  Just remove the whole directory.

Merge branch 'ondrej/remove-outdated-perllib-integration' into 'main'

See merge request isc-projects/bind9!9302
2024-08-14 12:49:56 +00:00
Ondřej Surý
391e743c30 Remove outdated perllib integration
The code in conftools/ directory hasn't been touched since 2000.
Nobody knows what it does and nobody even knows how to build it
or test it.  Just remove the whole directory.
2024-08-14 12:49:51 +00:00
Aydın Mercan
069c6c2265 chg: usr: use deterministic ecdsa for openssl >= 3.2
OpenSSL has added support for deterministic ECDSA (RFC 6979) with
version 3.2.

Use it by default as it removes arguably its most fragile side of ECDSA.
The derandomization doesn't pose a risk for DNS usecases and is allowed by FIPS 186-5.

Closes https://gitlab.isc.org/isc-projects/bind9/-/issues/299

Merge branch '299-change-ecdsa-to-deterministic-usage-elliptic-curve-digital-signature-algorithm-rfc-6979' into 'main'

Closes #299

See merge request isc-projects/bind9!9128
2024-08-14 12:47:06 +00:00
Aydın Mercan
596903a6b7 use deterministic ecdsa for openssl >= 3.2
OpenSSL has added support for deterministic ECDSA (RFC 6979) with
version 3.2.

Use it by default as derandomization doesn't pose a risk for DNS
usecases and is allowed by FIPS 186-5.
2024-08-14 14:34:44 +03:00
Ondřej Surý
8b70722fcb fix: dev: Don't skip the counting if fcount_incr() is called with force==true (v2)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.

Closes #4846

Merge branch '4786-forced-fcount_incr-should-still-increment-count-and-allowed-fix' into 'main'

Closes #4846

See merge request isc-projects/bind9!9298
2024-08-13 13:53:13 +00:00
Ondřej Surý
c2c9d8f01b Add fetches-per-zone 40 to qmin/ns5 configuration
The simple change causes assertion failure fixed in the previous commit.
2024-08-13 14:56:48 +02:00
Ondřej Surý
8e86e55af1 Don't skip the counting if fcount_incr() is called with force==true (v2)
The fcount_incr() was not increasing counter->count when force was set
to true, but fcount_decr() would try to decrease the counter leading to
underflow and assertion failure.  Swap the order of the arguments in the
condition, so the !force is evaluated after incrementing the .count.
2024-08-13 12:51:22 +02:00
Michal Nowak
f6fb9a4969 chg: Make every changelog entry a separate code block
LaTeX in CI and on ReadTheDocs [fails][1] to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.

[1]: https://gitlab.isc.org/isc-projects/bind9/-/jobs/4584011

Merge branch 'mnowak/fix-arm-changelog-section' into 'main'

See merge request isc-projects/bind9!9266
2024-08-08 14:25:12 +00:00
Michal Nowak
bc802359b0 Split up changelog into per-release code blocks
LaTeX in CI and on ReadTheDocs fails to render a PDF version of ARM if
the Changelog section is included. The running theory is that the
verbatim section of more than twenty thousand lines is too big to meet
LaTeX self-imposed constraints, and it fails with:

    ! TeX capacity exceeded, sorry [main memory size=5000000].

Or it just hangs if extra_mem_bot=30000000 is set in
/etc/texmf/texmf.d/01main_memory_bump.cnf:

    ! Dimension too large.
    \fb@put@frame ...p \ifdim \dimen@ >\ht \@tempboxa

    \fb@putboxa #1\fb@afterfra...
    l.56913 \end{sphinxVerbatim}

Make each BIND 9 release a separate code block to work around the issue.
Further split up the sections for some exceptionally large releases, for
the same reason.
2024-08-08 14:52:02 +02:00
Michał Kępień
9e7cd68d9f fix: dev: Move the dst__openssl_toresult to isc_tls unit
Since the enable_fips_mode() now resides inside the isc_tls unit, BIND 9
would fail to compile when FIPS mode was enabled as the DST subsystem
logging functions were missing.

Move the crypto library logging functions from the openssl_link unit to
isc_tls unit and enhance it, so it can now be used from both places
keeping the old dst__openssl_toresult* macros alive.

Merge branch 'ondrej/move-openssl-logging-to-isc_tls-unit' into 'main'

See merge request isc-projects/bind9!9286
2024-08-08 11:01:21 +00:00
Ondřej Surý
39aef50b9b Move the dst__openssl_toresult to isc_tls unit
Since the enable_fips_mode() now resides inside the isc_tls unit, BIND 9
would fail to compile when FIPS mode was enabled as the DST subsystem
logging functions were missing.

Move the crypto library logging functions from the openssl_link unit to
isc_tls unit and enhance it, so it can now be used from both places
keeping the old dst__openssl_toresult* macros alive.
2024-08-08 11:59:41 +02:00
Evan Hunt
f202937078 new: usr: Tighten 'max-recursion-queries' and add 'max-query-restarts' option
There were cases in resolver.c when the `max-recursion-queries` quota was ineffective. It was possible to craft zones that would cause a resolver to waste resources by sending excessive queries while attempting to resolve a name. This has been addressed by correcting errors in the implementation of `max-recursion-queries`, and by reducing the default value from 100 to 32.

In addition, a new `max-query-restarts` option has been added which limits the number of times a recursive server will follow CNAME or DNAME records before terminating resolution. This was previously a hard-coded limit of 16, and now defaults to 11.
 
Closes #4741

Merge branch '4741-reclimit-restarts' into 'main'

Closes #4741

See merge request isc-projects/bind9!9281
2024-08-07 21:12:07 +00:00
Evan Hunt
0d010ddebe add +restarts and +maxqueries options to delv
max-query-restarts and max-recursion-queries values can now be set
on the command line in delv for testing purposes.
2024-08-07 13:20:05 -07:00
Evan Hunt
104f3b82fb implement 'max-query-restarts'
implement, document, and test the 'max-query-restarts' option
which specifies the query restart limit - the number of times
we can follow CNAMEs before terminating resolution.
2024-08-07 13:20:05 -07:00
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