Commit graph

34096 commits

Author SHA1 Message Date
Mark Andrews
cb7511495e Add CHANGES note for [GL #3175]
(cherry picked from commit ce8703a79e)
2022-03-02 01:04:40 +00:00
Mark Andrews
c1a127643f Add seed that demonstrated INSIST triggered in isc_lex_gettoken
this is similar to the input found by ClusterFuzz Issue 45027 with
the 0xff characters replaced for readability.

(cherry picked from commit d36938321e)
2022-03-02 01:04:40 +00:00
Mark Andrews
0b6af23d61 Grow the lex token buffer in one more place
when parsing key pairs, if the '=' character fell at max_token
a protective INSIST preventing buffer overrun could be triggered.
Attempt to grow the buffer immediately before the INSIST.

Also removed an unnecessary INSIST on the opening double quote
of key buffer pair.

(cherry picked from commit 4c356d2770)
2022-03-02 01:04:40 +00:00
Mark Andrews
84a96a1bb0 Merge branch '3176-issue-45110-by-clusterfuzz-external-bind9-dns_master_load_fuzzer-undefined-shift-in-soa_get-v9_16' into 'v9_16'
Use unsigned arithmetic when shifting by 24

See merge request isc-projects/bind9!5918
2022-03-02 01:01:24 +00:00
Mark Andrews
a247d282bf Use unsigned arithmetic when shifting by 24
By default C promotes short unsigned values to signed int which
leads to undefined behaviour when the value is shifted by too much.
Force unsigned arithmetic to be perform by explicitly casting to a
unsigned type.

(cherry picked from commit b8b99603f1)
2022-03-02 11:06:53 +11:00
Ondřej Surý
98183ef28b Merge branch '3177-add-missing-isc_nm_tcpsocket-to-isc__nmsocket_reset-v9_16' into 'v9_16'
Handle TCP sockets in isc__nmsocket_reset()

See merge request isc-projects/bind9!5912
2022-02-28 11:14:14 +00:00
Ondřej Surý
ac5952aee8 Handle TCP sockets in isc__nmsocket_reset()
The isc__nmsocket_reset() was missing a case for raw TCP sockets (used
by RNDC and DoH) which would case a assertion failure when write timeout
would be triggered.

TCP sockets are now also properly handled in isc__nmsocket_reset().

(cherry picked from commit b220fb32bd)
2022-02-28 11:44:47 +01:00
Mark Andrews
604a267054 Merge branch '3170-tiny-typo-in-doc-build-script-v9_16' into 'v9_16'
correctly exclude logging-categories.rst

See merge request isc-projects/bind9!5903
2022-02-24 22:14:26 +00:00
Mark Andrews
287df673dc correctly exclude logging-categories.rst
(cherry picked from commit 0069a689a6)
2022-02-25 01:20:54 +11:00
Ondřej Surý
9f7ddf8c18 Merge branch '3166-disable-inactivehandles-caching-with-address-sanitizer-v9_16' into 'v9_16'
Disable inactive handles caching when compiled with sanitizers

See merge request isc-projects/bind9!5897
2022-02-23 23:44:58 +00:00
Ondřej Surý
fe5cd40a3a Disable inactive uvreqs caching when compiled with sanitizers
When isc__nm_uvreq_t gets deactivated, it could be just put onto array
stack to be reused later to save some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive uvreqs caching when compiled with Address or
Thread Sanitizer.

(cherry picked from commit be339b3c83)
2022-02-24 00:16:31 +01:00
Ondřej Surý
55780afdb9 Disable inactive handles caching when compiled with sanitizers
When isc_nmhandle_t gets deactivated, it could be just put onto array
stack to be reused later to safe some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive handles caching when compiled with Address or
Thread Sanitizer.

(cherry picked from commit 92cce1da65)
2022-02-24 00:10:18 +01:00
Ondřej Surý
822879f2c7 Merge branch '3167-remove-isc__nmsocket_t-ah_handles-v9_16' into 'v9_16'
Remove active handles tracking from isc__nmsocket_t

See merge request isc-projects/bind9!5895
2022-02-23 22:55:22 +00:00
Ondřej Surý
7765263e68 Remove active handles tracking from isc__nmsocket_t
The isc__nmsocket_t has locked array of isc_nmhandle_t that's not used
for anything.  The isc__nmhandle_get() adds the isc_nmhandle_t to the
locked array (and resized if necessary) and removed when
isc_nmhandle_put() finally destroys the handle.  That's all it does, so
it serves no useful purpose.

Remove the .ah_handles, .ah_size, and .ah_frees members of the
isc__nmsocket_t and .ah_pos member of the isc_nmhandle_t struct.

(cherry picked from commit e2555a306f)
2022-02-23 23:50:54 +01:00
Ondřej Surý
eff10e681a Merge branch '3166-delay-isc__nm_uvreq_t-deallocation-v9_16' into 'v9_16'
Delay isc__nm_uvreq_t deallocation to connection callback

See merge request isc-projects/bind9!5893
2022-02-23 22:47:53 +00:00
Ondřej Surý
7b8e265a40 Delay isc__nm_uvreq_t deallocation to connection callback
When the TCP, TCPDNS or TLSDNS connection times out, the isc__nm_uvreq_t
would be pushed into sock->inactivereqs before the uv_tcp_connect()
callback finishes.  Because the isc__nmsocket_t keeps the list of
inactive isc__nm_uvreq_t, this would cause use-after-free only when the
sock->inactivereqs is full (which could never happen because the failure
happens in connection timeout callback) or when the sock->inactivereqs
mechanism is completely removed (f.e. when running under Address or
Thread Sanitizer).

Delay isc__nm_uvreq_t deallocation to the connection callback and only
signal the connection callback should be called by shutting down the
libuv socket from the connection timeout callback.

(cherry picked from commit 3268627916)
2022-02-23 23:36:09 +01:00
Ondřej Surý
bfecb1b6f7 Merge branch 'ondrej-cleanup-nm_destroy-dequeue-v9_16' into 'v9_16'
Properly free up enqueued netievents in nm_destroy()

See merge request isc-projects/bind9!5890
2022-02-23 22:30:55 +00:00
Ondřej Surý
af2bddc242 Properly free up enqueued netievents in nm_destroy()
When the isc_netmgr is being destroyed, the normal and priority queues
should be dequeued and netievents properly freed.  This wasn't the case.

(cherry picked from commit 88418c3372)
2022-02-23 22:53:41 +01:00
Michał Kępień
28e9d7d222 Merge branch '3147-fix-more-ns_statscounter_recursclients-underflows-v9_16' into 'v9_16'
[v9_16] Fix more ns_statscounter_recursclients underflows

See merge request isc-projects/bind9!5881
2022-02-23 14:03:01 +00:00
Michał Kępień
ae2fa12d2d Add CHANGES entry for GL #3147
(cherry picked from commit 600f9010d2)
2022-02-23 14:45:06 +01:00
Michał Kępień
2344201385 Add release note for GL #3147
(cherry picked from commit 1c462a63ec)
2022-02-23 14:45:06 +01:00
Michał Kępień
60e82835ec Fix more ns_statscounter_recursclients underflows
Commit aab691d512 did not fix all possible
scenarios in which the ns_statscounter_recursclients counter underflows.
The solution implemented therein can be ineffective e.g. when CNAME
chaining happens with prefetching enabled.

Here is an example recursive resolution scenario in which the
ns_statscounter_recursclients counter can underflow with the current
logic in effect:

 1. Query processing starts, the answer is not found in the cache, so
    recursion is started.  The NS_CLIENTATTR_RECURSING attribute is set.
    ns_statscounter_recursclients is incremented (Δ = +1).

 2. Recursion completes, returning a CNAME.  client->recursionquota is
    non-NULL, so the NS_CLIENTATTR_RECURSING attribute remains set.
    ns_statscounter_recursclients is decremented (Δ = 0).

 3. Query processing restarts.

 4. The current QNAME (the target of the CNAME from step 2) is found in
    the cache, with a TTL low enough to trigger a prefetch.

 5. query_prefetch() attaches to client->recursionquota.
    ns_statscounter_recursclients is not incremented because
    query_prefetch() does not do that (Δ = 0).

 6. Query processing restarts.

 7. The current QNAME (the target of the CNAME from step 4) is not found
    in the cache, so recursion is started.  client->recursionquota is
    already attached to (since step 5) and the NS_CLIENTATTR_RECURSING
    attribute is set (since step 1), so ns_statscounter_recursclients is
    not incremented (Δ = 0).

 8. The prefetch from step 5 completes.  client->recursionquota is
    detached from in prefetch_done().  ns_statscounter_recursclients is
    not decremented because prefetch_done() does not do that (Δ = 0).

 9. Recursion for the current QNAME completes.  client->recursionquota
    is already detached from, i.e. set to NULL (since step 8), and the
    NS_CLIENTATTR_RECURSING attribute is set (since step 1), so
    ns_statscounter_recursclients is decremented (Δ = -1).

Another possible scenario is that after step 7, recursion for the target
of the CNAME from step 4 completes before the prefetch for the CNAME
itself.  fetch_callback() then notices that client->recursionquota is
non-NULL and decrements ns_statscounter_recursclients, even though
client->recursionquota was attached to by query_prefetch() and therefore
not accompanied by an incrementation of ns_statscounter_recursclients.
The net result is also an underflow.

Instead of trying to properly handle all possible orderings of events
set into motion by normal recursion and prefetch-triggered recursion,
adjust ns_statscounter_recursclients whenever the recursive clients
quota is successfully attached to or detached from.  Remove the
NS_CLIENTATTR_RECURSING attribute altogether as its only purpose is made
obsolete by this change.

(cherry picked from commit f7482b68b9)
2022-02-23 14:45:06 +01:00
Matthijs Mekking
2debaaddbe Merge branch '3164-fix-parental-agents-documentation-v9_16' into 'v9_16'
Fix typo in DNSSEC guide parental-agents example

See merge request isc-projects/bind9!5874
2022-02-22 13:45:34 +00:00
Matthijs Mekking
ff61d74310 Fix typo in DNSSEC guide parental-agents example
The example will not load because of the typo, the comma should be a
semicolon.

(cherry picked from commit fd5e39cc76)
2022-02-22 14:07:30 +01:00
Petr Špaček
3e17e79484 Merge branch '3132-add-send-timeout-python2-fix-v9_16' into 'v9_16'
Fix timeouts system test compatibility with python2

See merge request isc-projects/bind9!5869
2022-02-18 10:54:45 +00:00
Petr Špaček
17ff0227f8
Fix timeouts system test compatibility with python2
v9_16 branch still supports Python 2.7.
Fixup for 260b4c02cf.

Related: !5856
2022-02-18 11:26:58 +01:00
Petr Špaček
a30dac540e Merge branch 'v9_16_26-release' into 'v9_16'
Merge 9.16.26 release branch

See merge request isc-projects/bind9!5866
2022-02-18 09:12:00 +00:00
Petr Špaček
bcd07e71d6
Prepare release notes for BIND 9.16.27 2022-02-18 10:07:48 +01:00
Petr Špaček
faf800893f
Merge branch 'prep-release' into v9_16_26-release 2022-02-18 10:03:25 +01:00
Petr Špaček
0229a688a9
Merge branch 'pspacek/prepare-documentation-for-bind-9.16.26' into v9_16_26-release
Prepare documentation for BIND 9.16.26

See merge request isc-private/bind9!352
2022-02-18 10:03:25 +01:00
Petr Špaček
7394e09b50
prep 9.16.26 2022-02-18 10:03:25 +01:00
Petr Špaček
69989b1320
Prepare release notes for BIND 9.16.26 2022-02-18 10:03:20 +01:00
Petr Špaček
4ba9be8005
Tweak and reword release notes 2022-02-18 09:36:16 +01:00
Ondřej Surý
5cdc832c10 Merge branch '1897-fix-max-transfer-timeouts-v9_16' into 'v9_16'
Reimplement the max-transfer-time-out and max-transfer-idle-out (v9.16)

See merge request isc-projects/bind9!5863
2022-02-17 22:38:53 +00:00
Ondřej Surý
e9ad424cec Add CHANGES and release note for [GL #1897]
(cherry picked from commit 987ad32fac)
2022-02-17 22:59:24 +01:00
Ondřej Surý
b3efa9f7ed Add XFR max-transfer-time-out and max-tranfer-idle-out system tests
Extend the timeouts system test to ensure that the maximum outgoing
transfer time (max-transfer-time-out) and maximum outgoing transfer idle
time (max-transfer-idle-out) works as expected.  This is done by
lowering the limits to 5/1 minutes and testing that the connection has
been dropped while sleeping between the individual XFR messages.

(cherry picked from commit 8fed1b6461)
2022-02-17 22:59:24 +01:00
Ondřej Surý
cbf2bed95e Reimplement the max-transfer-time-out and max-transfer-idle-out
While refactoring the libns to use the new network manager, the
max-transfer-*-out options were not implemented and they were turned
non-operational.

Reimplement the max-transfer-idle-out functionality using the write
timer and max-transfer-time-out using the new isc_nm_timer API.

(cherry picked from commit 8643bbab84)
2022-02-17 22:59:24 +01:00
Ondřej Surý
6de1b12f59 Remove unused client->shutdown and client->shutdown_arg
While refactoring the lib/ns/xfrout.c, it was discovered that .shutdown
and .shutdown_arg members of ns_client_t structure are unused.

Remove the unused members and associated code that was using in it in
the ns_xfrout.

(cherry picked from commit 037549c405)
2022-02-17 22:59:24 +01:00
Ondřej Surý
914a7e14e2 Add network manager based timer API
This commits adds API that allows to create arbitrary timers associated
with the network manager handles.

(cherry picked from commit 3c7b04d015)
2022-02-17 22:59:24 +01:00
Evan Hunt
3ec9c711d8 Merge branch '3157-test-blackhole-v9_16' into 'v9_16'
backport regression test from GL #3157

See merge request isc-projects/bind9!5859
2022-02-17 18:15:24 +00:00
Evan Hunt
d822a87804 backport regression test from GL #3157
add "blackhole { none; };" to a secondary server in the xfer system
test to ensure that the error in GL #3157 is not present in 9.16.
2022-02-17 09:38:26 -08:00
Ondřej Surý
421a1dfa82 Merge branch '3132-add-send-timeout-v9_16' into 'v9_16'
Add TCP, TCPDNS and TLSDNS write timer

See merge request isc-projects/bind9!5856
2022-02-17 11:08:19 +00:00
Ondřej Surý
132bed0014 Add CHANGES and release note for [GL #3132]
(cherry picked from commit 0c35bda762)
2022-02-17 11:26:16 +01:00
Ondřej Surý
3f24bd2bce Update writetimeout to be T_IDLE in netmgr_test.c
Use the isc_nmhandle_setwritetimeout() function in the netmgr unit test
to allow more time for writing and reading the responses because some of
the intervals that are used in the unit tests are really small leaving a
little room for any delays.

(cherry picked from commit ee359d6ffa)
2022-02-17 11:26:16 +01:00
Ondřej Surý
1d0f2eb2c4 Add isc_nmhandle_setwritetimeout() function
In some situations (unit test and forthcoming XFR timeouts MR), we need
to modify the write timeout independently of the read timeout.  Add a
isc_nmhandle_setwritetimeout() function that could be called before
isc_nm_send() to specify a custom write timeout interval.

(cherry picked from commit a89d9e0fa6)
2022-02-17 11:26:16 +01:00
Ondřej Surý
260b4c02cf Add TCP write timeout system test
Extend the timeouts system test that bursts the queries for large TXT
record and never read any responses back filling up the server TCP write
buffer.  The test should work with the default wmem_max value on
Linux (208k).

(cherry picked from commit b735182ae0)
2022-02-17 10:05:24 +01:00
Ondřej Surý
6a88131d03 Add TCP, TCPDNS and TLSDNS write timer
When the outgoing TCP write buffers are full because the other party is
not reading the data, the uv_write() could wait indefinitely on the
uv_loop and never calling the callback.  Add a new write timer that uses
the `tcp-idle-timeout` value to interrupt the TCP connection when we are
not able to send data for defined period of time.

(cherry picked from commit 408b362169)
2022-02-17 10:05:24 +01:00
Ondřej Surý
11ae4399d9 Add uv_tcp_close_reset compat
The uv_tcp_close_reset() function was added in libuv 1.32.0 and since we
support older libuv releases, we have to add a shim uv_tcp_close_reset()
implementation loosely based on libuv.

(cherry picked from commit cd3b58622c)
2022-02-17 09:50:10 +01:00
Ondřej Surý
eb2463115f Rename sock->timer to sock->read_timer
Before adding the write timer, we have to remove the generic sock->timer
to sock->read_timer.  We don't touch the function names to limit the
impact of the refactoring.

(cherry picked from commit 45a73c113f)
2022-02-17 09:50:07 +01:00
Ondřej Surý
9b7a0cb778 Merge branch 'ondrej/add-UV_RUNTIME_CHECK-macro-v9_16' into 'v9_16'
Add UV_RUNTIME_CHECK() macro to print uv_strerror()

See merge request isc-projects/bind9!5846
2022-02-16 11:30:07 +00:00