Commit graph

7491 commits

Author SHA1 Message Date
Ondřej Surý
364f232da8 Add failure handling when iterators don't end with ISC_R_NOMORE
(cherry picked from commit bff83b9480)
2019-12-20 22:02:32 +11:00
Ondřej Surý
a2cf6090b2 Refactor receive_secure_db to make the variables and code flow around the iterator more local
(cherry picked from commit 6012479419)
2019-12-20 22:02:32 +11:00
Mark Andrews
37567e0106 Call dns_dbiterator_destroy earlier to prevent potential deadlock.
(cherry picked from commit 9d8f9cc8f2)
2019-12-20 22:02:32 +11:00
Ondřej Surý
f42d1be5fa Change the (acl)->node_count macro to dns_acl_node_count(acl) macro to clean the global namespace
(cherry picked from commit 8120088ec7)
2019-12-18 11:11:31 +11:00
Ondřej Surý
8eac1d365d Ensure all zone_settimer() calls are done on locked zone
(cherry picked from commit cf48e8eb32)
2019-12-12 16:12:51 +01:00
Mark Andrews
02874aa472 make resolver->zspill atomic to prevent potential deadlock
(cherry picked from commit 62abb6aa82)
2019-12-12 20:22:22 +11:00
Tinderbox User
84e68460cc prep 9.14.9 2019-12-12 06:09:19 +00:00
Mark Andrews
e40c1582d6 Note bucket lock requirements and move REQUIRE inside locked section.
(cherry picked from commit 13aaeaa06f)
2019-12-11 11:01:59 +11:00
Mark Andrews
0de313fff7 lock access to fctx->nqueries
(cherry picked from commit 5589748eca)
2019-12-11 11:01:59 +11:00
Mark Andrews
8bd8ed26ed address deadlock introduced in cd2469d3cd
(cherry picked from commit fd52417f71)
2019-12-10 23:38:53 +11:00
Mark Andrews
e9704327c4 r/w of rbtdb->current_version requires that rbtdb->lock be held
(cherry picked from commit cd2469d3cd)
2019-12-03 09:09:52 +00:00
Mark Andrews
d0796289dc Assign fctx->client when fctx is created rather when the join happens.
This prevents races on fctx->client whenever a new fetch joins a existing
fetch (by calling fctx_join) as it is now invariant for the active life of
fctx.

(cherry picked from commit 9ca6ad6311)
2019-12-03 17:00:02 +11:00
Mark Andrews
c712f40676 Make fctx->attributes atomic.
FCTX_ATTR_SHUTTINGDOWN needs to be set and tested while holding the node
lock but the rest of the attributes don't as they are task locked. Making
fctx->attributes atomic allows both behaviours without races.

(cherry picked from commit 912ce87479)
2019-12-03 10:52:02 +11:00
Mark Andrews
1a7b62916c rdataset_setownercase and rdataset_getownercase need to obtain a node lock
(cherry picked from commit 637b2c4e51)
2019-11-29 07:12:44 +11:00
Mark Andrews
da0fb0fdc0 add comments 'tree_lock(write) must be held'
(cherry picked from commit 8f6aaa7230)
2019-11-27 21:59:19 +11:00
Mark Andrews
e53af115da rbtnode->nsec needs to be read while holding the tree lock
(cherry picked from commit 7cad3b2e91)
2019-11-27 21:59:18 +11:00
Mark Andrews
d53ce94d36 move maxbuffers test to allocate_udp_buffer
(cherry picked from commit 26a93d77aa)
2019-11-26 11:53:19 +11:00
Mark Andrews
25306ea1ad Lock dispatch manager buffer_lock before accessing buffers;
Only test buffers for UDP dispatches.

(cherry picked from commit 011af4de71)
2019-11-26 11:53:19 +11:00
Mark Andrews
fbcf160346 lock disp->mgr before reading disp->mgr->buffers
(cherry picked from commit afc7389ce8)
2019-11-26 11:53:19 +11:00
Mark Andrews
e99156043f lock dispatch before reporting state
(cherry picked from commit 3075445ed6)
2019-11-23 08:25:33 +11:00
Evan Hunt
ff2a28351a BIND 9.14.8
-----BEGIN PGP SIGNATURE-----
 
 iQKTBAABCgB9FiEEMLkz2A/OPZgaLTj7DJm3DvT8uwcFAl3DPEZfFIAAAAAALgAo
 aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDMw
 QjkzM0Q4MEZDRTNEOTgxQTJEMzhGQjBDOTlCNzBFRjRGQ0JCMDcACgkQDJm3DvT8
 uwegDA/+KanAT7LMyK0WAqIBVtDAt+b0iO3EKviEGUs5M/GT2QUZyUy3nCKLGO4T
 UHi9CaGKgv1DUFG4/PX2CqJLZqVTFneaZ8P4Q402A9I16K9pWHfNeMnTtv5omjbw
 LQzWIn7KEeNdoZzVUDfachVM1kb0DttQBsVAjYW7HxQrBMfJOfB5WZljtAhxZ+42
 Zi3c7EjutP+hB+fDtm95pRwxpKvW/pV6UcvqYNpt0Qq5YyEaYTRuSh6tMgGJPLFY
 yRJbXhkz+xSUXg7W7r+ZJBTR9xlXZemnIT2sM+4bvsXqXtTdlSlsQm6DLDSZJ4G2
 Qoa00ggOriZDMVHMTGYWqKTEZ1izGoxQdo7x3Do7kJMUfCfdA5fBcDLzaX97Gu0o
 h7pruWyZxcGIFfkTwSkX3dbvOrRCJ0hLjq3nPSvWywp4Ysx/zteFM6JKuZ+3zpJx
 cuoGbZReRmf2SDvuihsbKWpTVJ+5VOCbs9aUu0LtMaKKUquYHu/Wa8aBItOeZyP8
 n6QThvM+lQ8f25xwmW+c8CbqGz58Km/Kj+ifdXLUQi7/ru6YR+8vxJJ8a5dXzjjq
 3JsLoVSGfgStxejR2ZUMl/9waZGbRZ1HWnxdODTDjA7DFBlfXO1a2OY7jS8iUj1i
 HSL00s0tKoNBNM0vv4KrRd1ULFaV0L5df4jQIfrq4LGTwbVjmRU=
 =ZGQl
 -----END PGP SIGNATURE-----

Merge tag 'v9_14_8' into merge-v9_14_8
2019-11-20 13:39:46 -08:00
Mark Andrews
637fb4cdb4 use update_recordsandbytes in rbt_datafixer
(cherry picked from commit 7d4d64340e)
2019-11-20 00:59:12 +08:00
Mark Andrews
83ce99a389 always obtain write lock when updating version->{records,bytes}
(cherry picked from commit 0cda448248)
2019-11-20 00:59:12 +08:00
Ondřej Surý
dc8eafee57 lib/dns/resolver.c: Call dns_adb_endudpfetch() only for UDP queries
The dns_adb_beginudpfetch() is called only for UDP queries, but
the dns_adb_endudpfetch() is called for all queries, including
TCP.  This messages the quota counting in adb.c.

(cherry picked from commit a5189eefa5)
2019-11-19 03:48:32 +08:00
Samuel Thibault
1100d198e4 hurd: Fix build
Move PATH_MAX, NAME_MAX, IOV_MAX default definitions to the common
<isc/platform.h>.

(cherry picked from commit d10fbdec84)
2019-11-12 09:27:19 +01:00
Tinderbox User
efee30c516 prep 9.14.8 2019-11-06 21:29:08 +00:00
Witold Kręcicki
662d10cba7 Jitter signatures times when adding dynamic records.
When doing regular signing expiry time is jittered to make sure
that the re-signing times are not clumped together. This expands
this behaviour to expiry times of dynamically added records.

When incrementally re-signing a zone use the full jitter range if
the server appears to have been offline for greater than 5 minutes
otherwise use a small jitter range of 3600 seconds.  This will stop
the signatures becoming more clustered if the server has been off
line for a significant period of time (> 5 minutes).

(cherry picked from commit 6b2fd40269)
2019-11-06 15:14:16 +01:00
Ondřej Surý
1ab5685d25 Describe the polynomial backoff curve used in the quota adjustment
(cherry picked from commit 56ef09c3a1)
2019-11-05 11:06:04 +01:00
Ondřej Surý
027f2c1518 libdns: add missing checks for return values in dnstap unit test
Related scan-build report:

dnstap_test.c:169:2: warning: Value stored to 'result' is never read
        result = dns_test_makeview("test", &view);
        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dnstap_test.c:193:2: warning: Value stored to 'result' is never read
        result = dns_compress_init(&cctx, -1, dt_mctx);
        ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

(cherry picked from commit e9acad638e)
2019-11-05 09:49:24 +01:00
Ondřej Surý
72f9846be6 libdns: Change check_dnskey_sigs() return type to void to match the reality how the function is used
(cherry picked from commit 64cf5144a6)
2019-11-05 09:48:51 +01:00
Ondřej Surý
1be8170888 libdns: Remove useless checks for ISC_R_MEMORY, which cannot happen now
(cherry picked from commit 80b55d25de)
2019-11-05 09:48:50 +01:00
Michał Kępień
b2ee3fa0bb Prevent TCP failures from affecting EDNS stats
EDNS mechanisms only apply to DNS over UDP.  Thus, errors encountered
while sending DNS queries over TCP must not influence EDNS timeout
statistics.

(cherry picked from commit fce3c93ea2)
2019-10-31 09:54:23 +01:00
Michał Kępień
61370994fc Prevent query loops for misbehaving servers
If a TCP connection fails while attempting to send a query to a server,
the fetch context will be restarted without marking the target server as
a bad one.  If this happens for a server which:

  - was already marked with the DNS_FETCHOPT_EDNS512 flag,
  - responds to EDNS queries with the UDP payload size set to 512 bytes,
  - does not send response packets larger than 512 bytes,

and the response for the query being sent is larger than 512 byes, then
named will pointlessly alternate between sending UDP queries with EDNS
UDP payload size set to 512 bytes (which are responded to with truncated
answers) and TCP connections until the fetch context retry limit is
reached.  Prevent such query loops by marking the server as bad for a
given fetch context if the advertised EDNS UDP payload size for that
server gets reduced to 512 bytes and it is impossible to reach it using
TCP.

(cherry picked from commit 6cd115994e)
2019-10-31 08:49:09 +01:00
Mark Andrews
cdf114078b Log DNS_R_UNCHANGED from sync_secure_journal() at info level in receive_secure_serial()
(cherry picked from commit 8eb09f3232)
2019-10-30 12:13:01 +11:00
Tinderbox User
6330f2c6c8 Merge branch 'security-v9_14' into v9_14 2019-10-19 23:34:28 +00:00
Michał Kępień
c62c7c2f86 Suppress cppcheck 1.89 false positive
cppcheck 1.89 emits a false positive for lib/dns/spnego_asn1.c:

    lib/dns/spnego_asn1.c:700:9: error: Uninitialized variable: data [uninitvar]
     memset(data, 0, sizeof(*data));
            ^
    lib/dns/spnego.c:1709:47: note: Calling function 'decode_NegTokenResp', 3rd argument '&resp' value is <Uninit>
     ret = decode_NegTokenResp(buf + taglen, len, &resp, NULL);
                                                  ^
    lib/dns/spnego_asn1.c:700:9: note: Uninitialized variable: data
     memset(data, 0, sizeof(*data));
            ^

This message started appearing with cppcheck 1.89 [1], but it will be
gone in the next release [2], so just suppress it for the time being.

[1] af214e8212

[2] 2595b82634

(cherry picked from commit db7fd16346)
2019-10-17 10:52:19 +02:00
Ondřej Surý
3c20623436 Move the failure handling block closer to the only place where it could fail
(cherry picked from commit 69ecc711ac)
2019-10-04 14:08:26 +10:00
Ondřej Surý
aebea22fab Replace RUNTIME_CHECK(dns_name_copy(..., NULL)) with dns_name_copynf()
Use the semantic patch from the previous commit to replace all the calls to
dns_name_copy() with NULL as third argument with dns_name_copynf().

(cherry picked from commit c2dad0dcb2)
2019-10-04 14:08:26 +10:00
Ondřej Surý
a1ef76cd78 Split dns_name_copy() into dns_name_copy() and dns_name_copynf()
The dns_name_copy() function followed two different semanitcs that was driven
whether the last argument was or wasn't NULL.  This commit splits the function
in two where now third argument to dns_name_copy() can't be NULL and
dns_name_copynf() doesn't have third argument.

(cherry picked from commit f7aef3738a)
2019-10-04 14:08:25 +10:00
Ondřej Surý
660307283e The final round of adding RUNTIME_CHECK() around dns_name_copy() calls
This commit was done by hand to add the RUNTIME_CHECK() around stray
dns_name_copy() calls with NULL as third argument.  This covers the edge cases
that doesn't make sense to write a semantic patch since the usage pattern was
unique or almost unique.

(cherry picked from commit 5efa29e03a)
2019-10-04 14:08:25 +10:00
Ondřej Surý
77fe5da647 Add RUNTIME_CHECK() around result = dns_name_copy(..., NULL) calls
This second commit uses second semantic patch to replace the calls to
dns_name_copy() with NULL as third argument where the result was stored in a
isc_result_t variable.  As the dns_name_copy(..., NULL) cannot fail gracefully
when the third argument is NULL, it was just a bunch of dead code.

Couple of manual tweaks (removing dead labels and unused variables) were
manually applied on top of the semantic patch.

(cherry picked from commit 89b269b0d2)
2019-10-04 14:08:25 +10:00
Ondřej Surý
9adb3ae2d5 Add RUNTIME_CHECK() around plain dns_name_copy(..., NULL) calls using spatch
This commit add RUNTIME_CHECK() around all simple dns_name_copy() calls where
the third argument is NULL using the semantic patch from the previous commit.

(cherry picked from commit 35bd7e4da0)
2019-10-04 14:08:25 +10:00
Mark Andrews
fcebc4f15b Address cppcheck reports 2019-10-04 13:06:00 +10:00
Ondřej Surý
fedfd48a08 lib/dns/zone.c: Fix invalid order of DbC checks that could cause dereference before NULL check 2019-10-03 10:16:03 +02:00
Ondřej Surý
6a82289e35 lib/dns/sdlz.c: Use the referenced variable in the DbC check 2019-10-03 10:15:35 +02:00
Ondřej Surý
9ffcc8f165 lib/dns/sdb.c: Fix invalid order of DbC checks that could cause dereference before NULL check 2019-10-03 10:14:43 +02:00
Ondřej Surý
9f75d17e95 Remove randomly scattered additional style check suppressions that caused unmatchedSuppression
(cherry picked from commit a0d3614a60)
2019-10-03 09:50:27 +02:00
Ondřej Surý
8b32d11206 lib/dns/tsig.c: Suppress Cppcheck false positive error uninitStructMember
(cherry picked from commit 8f2ad12d0a)
2019-10-03 09:50:26 +02:00
Ondřej Surý
8db221d97a lib/dns/tests/rbt_serialize_test.c: Fix dereference before DbC check
(cherry picked from commit 14c174d921)
2019-10-03 09:50:26 +02:00
Ondřej Surý
4ef534aa90 Instead of declaring unused va_list, just don't declare it at all
(cherry picked from commit 269d507ccc)
2019-10-03 09:50:26 +02:00