2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00
Commit Graph

39533 Commits

Author SHA1 Message Date
Mark Andrews
80bc0ee075 Skip some QNAME mininisation queries if possible
If we know that the NS RRset for an intermediate label doesn't exist
on cache contents don't query using that name when looking for a
referral.
2023-06-28 11:47:56 +10:00
Mark Andrews
dd00b3c50b Use NS rather than A records for qname-minimization relaxed
Remove all references to DNS_FETCHOPT_QMIN_USE_A and adjust
the expected tests results in the qmin system test.
2023-06-28 11:45:59 +10:00
Ondřej Surý
f6b281f7dd Merge branch 'fanf-overflow-checks' into 'main'
Prevent integer overflow when allocating arrays

Closes #4120, #4121, and #4122

See merge request isc-projects/bind9!8007
2023-06-27 13:13:14 +00:00
Tony Finch
a8dbf61bb1 CHANGES entry
[cleanup]	Ensure that the size calculation does not overflow
		when allocating memory for an array.
		[GL #4120] [GL #4121] [GL #4122]
2023-06-27 12:38:09 +02:00
Tony Finch
e2eaefbf7a Check for overflow when resizing a heap
Ensure that the heap size calculations produce the correct answers,
and use `isc_mem_reget()` instead of calling `get` and `put`.

Closes #4122
2023-06-27 12:38:09 +02:00
Tony Finch
14f5b79c74 Check for overflow in jemalloc_shim
When compiled using a malloc that lacks an equivalent to sallocx(),
the jemalloc_shim adds a size prefix to each allocation. We must check
that this does not overflow.

Closes #4121
2023-06-27 12:38:09 +02:00
Tony Finch
92fcb7457c Use isc_mem_callocate() in http_calloc()
Closes #4120
2023-06-27 12:38:09 +02:00
Tony Finch
81d73600c1 Add isc_mem_callocate() for safer array allocation
As well as clearing the fresh memory, `calloc()`-like functions must
ensure that the count and size do not overflow when multiplied.

Use `isc_mem_callocate()` in `isc__uv_calloc()`.
2023-06-27 12:38:09 +02:00
Tony Finch
7474cad4ad Add <isc/overflow.h> for checked mul, add, and sub
The `ISC_OVERFLOW_XXX()` macros are usually wrappers around
`__builtin_xxx_overflow()`, with alternative implementations
for compilers that lack the builtins.

Replace the overflow checks in `isc/time.c` with the new macros.
2023-06-27 12:38:09 +02:00
Ondřej Surý
bf6f8abb2a Merge branch 'ondrej-use-loop-mctx-in-dns_resolver' into 'main'
Use per-loop memory contexts for dns_resolver child objects

See merge request isc-projects/bind9!8015
2023-06-27 09:31:00 +00:00
Ondřej Surý
5e7b75c504 Add CHANGES note for [GL !8015] 2023-06-27 10:53:02 +02:00
Ondřej Surý
519481dcdb Use per-loop memory contexts for dns_resolver child objects
The dns_resolver creates a lot of smaller objects (fetch context, fetch
counter, query, response, ...) and those are all loop-bound.
Previously, those objects were allocated from the a single resolver
context, which in turn increases contention between threads - remember
"dead by thousand atomic paper cuts".  Instead of using a single memory
context, use the per-loop memory contexts that are bound to a specific
loop and thus there's no contention between them when doing the memory
accounting.
2023-06-27 10:51:54 +02:00
Ondřej Surý
6d309eed05 Merge branch '4163-dont-create-and-destroy-call_rcu-threads-by-hand' into 'main'
Remove the explicit call_rcu thread creating and destruction

Closes #4163

See merge request isc-projects/bind9!8060
2023-06-27 06:00:32 +00:00
Ondřej Surý
90d4ba2a11 Add CHANGES note for [GL #4163] 2023-06-27 07:59:00 +02:00
Ondřej Surý
5bd9343c4e Remove the explicit call_rcu thread creating and destruction
The free_all_cpu_call_rcu_data() call can consume hundreds of
milliseconds on shutdown.  Don't try to be smart and let the RCU library
handle this internally.
2023-06-27 07:59:00 +02:00
Evan Hunt
bcda40db48 Merge branch '950-test-validation' into 'main'
explicitly set dnssec-validation in system tests

Closes #950

See merge request isc-projects/bind9!7999
2023-06-26 21:59:06 +00:00
Evan Hunt
0b09ee8cdc explicitly set dnssec-validation in system tests
the default value of dnssec-validation is 'auto', which causes
a server to send a key refresh query to the root zone when starting
up. this is undesirable behavior in system tests, so this commit
sets dnssec-validation to either 'yes' or 'no' in all tests where
it had not previously been set.

this change had the mostly-harmless side effect of changing the cached
trust level of unvalidated answer data from 'answer' to 'authanswer',
which caused a few test cases in which dumped cache data was examined in
the serve-stale system test to fail. those test cases have now been
updated to expect 'authanswer'.
2023-06-26 13:41:56 -07:00
Tom Krizek
73b09653d4 Merge branch 'tkrizek-system-test-fixes' into 'main'
Fix a couple of oversights in system tests

See merge request isc-projects/bind9!8051
2023-06-26 11:06:36 +00:00
Tom Krizek
5f809e50b6 Check for proper file size output in dnstap test
Previously, the first check silently failed, as 454 is apparently (in my
local setup) the minimum output size for the dnstap output, rather than
470 which the test was expecting. Effectively, the check served as a 5
second sleep rather than waiting for the proper file size.

Additionally, check the expected file sizes and fail if expectations
aren't met.
2023-06-22 19:19:08 +02:00
Tom Krizek
1dd4c2b9e2 Check for proper log message in kasp test
The log message is supposed to contain the zone name which was
erroneously omitted, but didn't pop up during tests, since return code
was silently ignored.

Now it actually waits for the proper log message rather than being an
equivalent of 3 second sleep (which was also sufficient to make the test
pass, thus we detected no failure).
2023-06-22 19:19:05 +02:00
Tom Krizek
d437b7043a Merge branch 'tkrizek-forward-test-echo-i' into 'main'
Fix echo_i typo in forward test

See merge request isc-projects/bind9!8050
2023-06-22 17:15:50 +00:00
Tom Krizek
946d3131fa Fix echo_i typo in forward test 2023-06-22 19:12:46 +02:00
Michal Nowak
71439d0c3a Merge tag 'v9.19.14'
BIND 9.19.14
2023-06-21 19:31:57 +02:00
Arаm Sаrgsyаn
1bdec05d69 Merge branch '4044-placeholder' into 'main'
Add a CHANGES placeholder for [GL #4044]

See merge request isc-projects/bind9!8046
2023-06-20 10:20:43 +00:00
Aram Sargsyan
33a005e23c Add a CHANGES placeholder for [GL #4044] 2023-06-20 10:13:12 +00:00
Michał Kępień
f4f1d6fddf Merge branch '2354-add-a-tool-for-reproducing-isc-spnego-bugs' into 'main'
[CVE-2020-8625] [CVE-2021-25216] Add a tool for reproducing ISC SPNEGO bugs

Closes #2354

See merge request isc-projects/bind9!7574
2023-06-19 09:06:56 +00:00
Michał Kępień
a47dc810f7 Add a tool for reproducing ISC SPNEGO bugs
Extend the "tsiggss" system test with reproducers for CVE-2020-8625 and
CVE-2021-25216.
2023-06-19 09:20:03 +02:00
Tony Finch
5f9790feca Merge branch '4126-statschannel-connection-close-keepalive' into 'main'
Improve statschannel HTTP Connection: header logic

See merge request isc-projects/bind9!8014
2023-06-15 16:03:51 +00:00
Tony Finch
e18ca83a3b Improve statschannel HTTP Connection: header protocol conformance
In HTTP/1.0 and HTTP/1.1, RFC 9112 section 9.6 says the last response
in a connection should include a `Connection: close` header, but the
statschannel server omitted it.

In an HTTP/1.0 response, the statschannel server can sometimes send a
`Connection: keep-alive` header when it is about to close the
connection. There are two ways:

If the first request on a connection is keep-alive and the second
request is not, then _both_ responses have `Connection: keep-alive`
but the connection is (correctly) closed after the second response.

If a single request contains

	Connection: close
	Connection: keep-alive

then RFC 9112 section 9.3 says the keep-alive header is ignored, but
the statschannel sends a spurious keep-alive in its response, though
it correctly closes the connection.

To fix these bugs, make it more clear that the `httpd->flags` are part
of the per-request-response state. The Connection: flags are now
described in terms of the effect they have instead of what causes them
to be set.
2023-06-15 17:03:09 +01:00
Michał Kępień
a0efcf0e58 Merge branch '4150-fix-entity-renumbering-in-parse_tsan.py' into 'main'
Fix entity renumbering in util/parse_tsan.py

Closes #4150

See merge request isc-projects/bind9!8037
2023-06-15 14:18:30 +00:00
Michał Kępień
7f0790c82f Fix entity renumbering in util/parse_tsan.py
util/parse_tsan.py builds tables of mutexes, threads, and pointers it
finds in the TSAN report provided to it as a command-line argument and
then replaces all mentions of each of these entities so that they are
numbered sequentially in the processed report.  For example, this line:

    Cycle in lock order graph: M0 (...) => M5 (...) => M9 (...) => M0

is expected to become:

    Cycle in lock order graph: M1 (...) => M2 (...) => M3 (...) => M1

Problems arise when the gaps between mutex/thread identifiers present on
a single line are smaller than the total number of mutexes/threads found
by the script so far.  For example, the following line:

    Cycle in lock order graph: M0 (...) => M1 (...) => M2 (...) => M0

first gets turned into:

    Cycle in lock order graph: M1 (...) => M1 (...) => M2 (...) => M1

and then into:

    Cycle in lock order graph: M2 (...) => M2 (...) => M2 (...) => M2

In other words, lines like this become garbled due to information loss.

The problem stems from the fact that the numbering scheme the script
uses for identifying mutexes and threads is exactly the same as the one
used by TSAN itself.  Update util/parse_tsan.py so that it uses
zero-padded numbers instead, making the "overlapping" demonstrated above
impossible.
2023-06-15 16:17:14 +02:00
Ondřej Surý
f22046d61b Merge branch '4149-make-isc_result-tables-more-compact' into 'main'
Make isc_result tables smaller

Closes #4149

See merge request isc-projects/bind9!8034
2023-06-15 13:46:52 +00:00
Ondřej Surý
0a35c0da9b Add CHANGES note for [GL #4149] 2023-06-15 15:32:24 +02:00
Ondřej Surý
a8e6c3b8f7 Make isc_result tables smaller
The isc_result_t enum was to sparse when each library code would skip to
next << 16 as a base.  Remove the huge holes in the isc_result_t enum to
make the isc_result tables more compact.

This change required a rewrite how we map dns_rcode_t to isc_result_t
and back, so we don't ever return neither isc_result_t value nor
dns_rcode_t out of defined range.
2023-06-15 15:32:04 +02:00
Ondřej Surý
b53d1d7069 Refactor how we map isc_result_t <-> dns_rcode_t
The mapping functions between isc_result_t and dns_rcode_t could return
both isc_result_t values not defined in the header and dns_rcode_t
values not defined in the header because it blindly maps anything
withing full 12-bits defined for RCODEs to isc_result_t and back.

Refactor the dns_result_{from,to}rcode() functions to always return
valid isc_result_t and dns_rcode_t values by explicitly mapping the
values to each other and returning DNS_R_SERVFAIL (dns_rcode_servfail)
when encountering value out of the defined range.
2023-06-15 15:32:04 +02:00
Tom Krizek
189aadbab9 Merge branch 'tkrizek/ci-system-clang-tsan-disallow-failure' into 'main'
Mark CI failure of system:clang:tsan as an error again

See merge request isc-projects/bind9!8035
2023-06-15 11:09:48 +00:00
Tom Krizek
e556097e81 Mark CI failure of system:clang:tsan as an error again
Both the issues causing frequent failures have been resolved. The job
seems to have stabilized and there's no longer a need to mark the
failure as a mere warnings.
2023-06-15 13:09:18 +02:00
Arаm Sаrgsyаn
14d4bf9136 Merge branch '4132-catz-data-race-in-db.c' into 'main'
Fix a data race between the dns_zone and dns_catz modules

Closes #4132

See merge request isc-projects/bind9!8031
2023-06-15 09:50:15 +00:00
Aram Sargsyan
f73007afe7 Add a CHANGES note for [GL #4132] 2023-06-15 08:50:04 +00:00
Aram Sargsyan
6f1f5fc307 Fix a data race between the dns_zone and dns_catz modules
The dns_zone_catz_enable_db() and dns_zone_catz_disable_db()
functions can race with similar operations in the catz module
because there is no synchronization between the threads.

Add catz functions which use the view's catalog zones' lock
when registering/unregistering the database update notify callback,
and use those functions in the dns_zone module, instead of doing it
directly.
2023-06-15 08:49:20 +00:00
Tony Finch
68cfbd2bd1 Merge branch '4134-zonefile-erofs' into 'main'
Translate POSIX errorcode EROFS to ISC_R_NOPERM

Closes #4134

See merge request isc-projects/bind9!8017
2023-06-14 12:44:54 +00:00
Tony Finch
82401f0f0e CHANGES note for [GL #4134]
[cleanup]	Report "permission denied" instead of "unexpected error"
		when trying to update a zone file is on a read-only file
		system. Thanks to Midnight Veil. [GL #4134]
2023-06-14 13:13:39 +01:00
Midnight Veil
dd6acc1cac Translate POSIX errorcode EROFS to ISC_R_NOPERM
Report "permission denied" instead of "unexpected error"
when trying to update a zone file on a read-only file system.
2023-06-14 13:12:45 +01:00
Mark Andrews
06bbe6a2db Merge branch '4021-tsan-error-view-adb-detached-too-early' into 'main'
Resolve "TSAN error: view->adb detached too early."

Closes #4021

See merge request isc-projects/bind9!8016
2023-06-14 10:36:08 +00:00
Mark Andrews
0da3370642 Add CHANGES note for [GL #4021] 2023-06-14 19:22:00 +10:00
Mark Andrews
971f49b3ad Use RCU for view->adb access
view->adb may be referenced while the view is shutting down as the
zone uses a weak reference to the view and examines view->adb but
dns_view_detach call dns_adb_detach to clear view->adb.
2023-06-14 19:21:28 +10:00
Evan Hunt
984decc563 Merge branch 'each-tsig-refactoring' into 'main'
TSIG/TKEY refactoring

See merge request isc-projects/bind9!7828
2023-06-14 08:14:47 +00:00
Evan Hunt
885c132f4a improve code flow
the code in dns_tkey_processquery() was unnecessarily hard to follow.
2023-06-14 08:14:38 +00:00
Evan Hunt
f4084ff543 minor tkey-related fixups
- style fixes and general tidying-up in tkey.c
- remove the unused 'intoken' parameter from dns_tkey_buildgssquery()
- remove an unnecessary call to dns_tkeyctx_create() in ns_server_create()
  (the TKEY context that was created there would soon be destroyed and
  another one created when the configuration was loaded).
2023-06-14 08:14:38 +00:00
Evan Hunt
96e8b0e782 rename 'ret' to 'result'
purely to assuage my desire for consistency across modules,
result variables have been renamed to 'result' as they are
throughout most of BIND. there are no other changes.
2023-06-14 08:14:38 +00:00