2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
Commit Graph

30928 Commits

Author SHA1 Message Date
Witold Kręcicki
1beba0fa59 Unit test for the taskmgr pause/unpause race 2020-01-21 10:06:19 +01:00
Witold Kręcicki
e1c4a69197 Fix a race in taskmgr between worker and task pausing/unpausing.
To reproduce the race - create a task, send two events to it, first one
must take some time. Then, from the outside, pause(), unpause() and detach()
the task.
When the long-running event is processed by the task it is in
task_state_running state. When we called pause() the state changed to
task_state_paused, on unpause we checked that there are events in the task
queue, changed the state to task_state_ready and enqueued the task on the
workers readyq. We then detach the task.
The dispatch() is done with processing the event, it processes the second
event in the queue, and then shuts down the task and frees it (as it's not
referenced anymore). Dispatcher then takes the, already freed, task from
the queue where it was wrongly put, causing an use-after free and,
subsequently, either an assertion failure or a segmentation fault.
The probability of this happening is very slim, yet it might happen under a
very high load, more probably on a recursive resolver than on an
authoritative.
The fix introduces a new 'task_state_pausing' state - to which tasks
are moved if they're being paused while still running. They are moved
to task_state_paused state when dispatcher is done with them, and
if we unpause a task in paused state it's moved back to task_state_running
and not requeued.
2020-01-21 10:06:19 +01:00
Mark Andrews
684a44b469 Merge branch 'marka-Psync-future' into 'master'
dnssec: do not publish CDS records when -Psync is in the future

See merge request isc-projects/bind9!2925
2020-01-21 06:11:15 +00:00
Mark Andrews
0cd10c7763 add CHANGES 2020-01-21 16:42:51 +11:00
Tony Finch
4227b7969b dnssec: do not publish CDS records when -Psync is in the future
This is a bug I encountered when trying to schedule an algorithm
rollover. My plan, for a zone whose maximum TTL is 48h, was to sign
with the new algorithm and schedule a change of CDS records for more
than 48 hours in the future, roughly like this:

    $ dnssec-keygen -a 13 -fk -Psync now+50h $zone
    $ dnssec-keygen -a 13 $zone
    $ dnssec-settime -Dsync now+50h $zone_ksk_old

However the algorithm 13 CDS was published immediately, which could
have made the zone bogus.

To reveal the bug using the `smartsign` test, this change just adds a
KSK with all its times in the future, so it should not affect the
existing checks at all. But the final check (that there are no CDS or
CDSNSKEY records after -Dsync) fails with the old `syncpublish()`
logic, because the future key's sync records appear early. With the
new `syncpublish()` logic the future key does not affect the test, as
expected, and it now passes.
2020-01-21 16:39:31 +11:00
Mark Andrews
ccf7bbab5d Merge branch 'marka-omit-spurious-newlines' into 'master'
Omit spurious newlines when reporting DNSKEY changes

See merge request isc-projects/bind9!2922
2020-01-21 05:16:25 +00:00
Tony Finch
3b1bd3f48b Omit spurious newlines when reporting DNSKEY changes
These caused blank lines to appear in the logs.
2020-01-21 15:55:24 +11:00
Mark Andrews
aafb804eb8 Merge branch 'marka-document-authors-bind' into 'master'
document that version also controls authors.bind

See merge request isc-projects/bind9!2919
2020-01-21 03:54:51 +00:00
Mark Andrews
05c6a29c87 document that version also controls authors.bind 2020-01-21 14:36:06 +11:00
Witold Krecicki
6d8d06e82e Merge branch 'fix-shutdown-issues' into 'master'
Fix shutdown issues

See merge request isc-projects/bind9!2907
2020-01-20 22:01:44 +00:00
Witold Kręcicki
fd8788eb94 Fix possible race in socket destruction.
When two threads unreferenced handles coming from one socket while
the socket was being destructed we could get a use-after-free:
Having handle H1 coming from socket S1, H2 coming from socket S2,
S0 being a parent socket to S1 and S2:

Thread A                             Thread B
Unref handle H1                      Unref handle H2
Remove H1 from S1 active handles     Remove H2 from S2 active handles
nmsocket_maybe_destroy(S1)           nmsocket_maybe_destroy(S2)
nmsocket_maybe_destroy(S0)           nmsocket_maybe_destroy(S0)
LOCK(S0->lock)
Go through all children, figure
out that we have no more active
handles:
sum of S0->children[i]->ah == 0
UNLOCK(S0->lock)
destroy(S0)
                                     LOCK(S0->lock)
                                      - but S0 is already gone
2020-01-20 22:28:36 +01:00
Witold Kręcicki
42f0e25a4c calling isc__nm_udp_send() on a non-udp socket is not 'unexpected', it's a critical failure 2020-01-20 22:28:36 +01:00
Witold Kręcicki
8d6dc8613a clean up some handle/client reference counting errors in error cases.
We weren't consistent about who should unreference the handle in
case of network error. Make it consistent so that it's always the
client code responsibility to unreference the handle - either
in the callback or right away if send function failed and the callback
will never be called.
2020-01-20 22:28:36 +01:00
Witold Kręcicki
dcc0835a3a cleanup properly if we fail to initialize ns_client structure
If taskmgr is shutting down ns_client_setup will fail to create
a task for the newly created client, we weren't cleaning up already
created/attached things (memory context, server, clientmgr).
2020-01-20 22:28:36 +01:00
Witold Kręcicki
f75a9e32be netmgr: fix a non-thread-safe access to libuv structures
In tcp and udp stoplistening code we accessed libuv structures
from a different thread, which caused a shutdown crash when named
was under load. Also added additional DbC checks making sure we're
in a proper thread when accessing uv_ functions.
2020-01-20 22:28:36 +01:00
Witold Kręcicki
16908ec3d9 netmgr: don't send to an inactive (closing) udp socket
We had a race in which n UDP socket could have been already closing
by libuv but we still sent data to it. Mark socket as not-active
when stopping listening and verify that socket is not active when
trying to send data to it.
2020-01-20 22:28:36 +01:00
Mark Andrews
402f067fc0 Merge branch '1537-nslookup-manual-page-needs-update-for-default-querytype-a-and-aaaa' into 'master'
Resolve "nslookup manual page needs update for default querytype (A and AAAA)"

Closes #1537

See merge request isc-projects/bind9!2894
2020-01-19 23:43:47 +00:00
Mark Andrews
938fc81493 document that nslookup defaults to A + AAAA lookups 2020-01-19 23:14:07 +00:00
Mark Andrews
df709dcf8a Merge branch 'marka-check-CHANGES-SE-in-CI' into 'master'
Check CHANGES.SE in CI

See merge request isc-projects/bind9!2912
2020-01-17 21:09:16 +00:00
Mark Andrews
05f2ba973f check that CHANGES.SE entries are correctly ordered and that whitespace is correct 2020-01-17 09:31:10 +11:00
Michał Kępień
9c5547b118 Merge branch 'michal/fix-the-dnssec-system-test-on-windows' into 'master'
Fix the "dnssec" system test on Windows

See merge request isc-projects/bind9!2902
v9.15.8
2020-01-16 08:49:13 +00:00
Michał Kępień
451484b870 Fix the "dnssec" system test on Windows
Make sure carriage return characters are stripped from awk input to
enable the "dnssec" system test to pass on Windows.
2020-01-16 09:48:01 +01:00
Evan Hunt
aac8736998 Merge branch 'prep-v9_15_8' into 'master'
prep 9.15.8

See merge request isc-projects/bind9!2901
2020-01-16 08:21:28 +00:00
Tinderbox User
05f2241fcb prep 9.15.8 2020-01-16 08:01:20 +00:00
Evan Hunt
48989e9426 Merge branch 'each-add-relnotes-v9_15_8' into 'master'
add release notes for  9.15.8

See merge request isc-projects/bind9!2900
2020-01-16 07:41:10 +00:00
Evan Hunt
1af6de6b62 add release notes for 9.15.8 bugs and changes, and fix CHANGES errors 2020-01-16 08:33:31 +01:00
Evan Hunt
95c76e537f Add empty release notes section for BIND 9.15.8 2020-01-16 08:32:34 +01:00
Evan Hunt
e19819457b Merge branch '1561-ncache-validation-crash' into 'master'
fix a bug when validating negative cache entries

Closes #1561

See merge request isc-projects/bind9!2899
2020-01-15 22:15:36 +00:00
Evan Hunt
8b9a3314b1 CHANGES 2020-01-15 13:55:33 -08:00
Evan Hunt
fa04c87578 add system test of insecurity proof from negative cache 2020-01-15 13:55:33 -08:00
Evan Hunt
6a1c41143f fix a bug when validating negative cache entries
if validator_start() is called with validator->event->message set to
NULL, we can't use message->rcode to decide which negative proofs are
needed, so we use the rdataset attributes instead to determine whether
the rdataset was cached as NXDOMAIN or NODATA.
2020-01-15 13:55:33 -08:00
Witold Krecicki
4c1adf96de Merge branch 'wpk/fix-interface-reconfig-crashes' into 'master'
Fix interface reconfig crashes

See merge request isc-projects/bind9!2898
2020-01-15 16:56:55 +00:00
Witold Kręcicki
eda4300bbb netmgr: have a single source of truth for tcpdns callback
We pass interface as an opaque argument to tcpdns listening socket.
If we stop listening on an interface but still have in-flight connections
the opaque 'interface' is not properly reference counted, and we might
hit a dead memory. We put just a single source of truth in a listening
socket and make the child sockets use that instead of copying the
value from listening socket. We clean the callback when we stop listening.
2020-01-15 17:22:13 +01:00
Witold Kręcicki
0d637b5985 netmgr: we can't uv_close(sock->timer) when in sock->timer close callback 2020-01-15 14:56:40 +01:00
Ondřej Surý
1bee87a364 Merge branch 'wpk/fix-uvtransfers-on-windows' into 'master'
Fixes for netmgr on Windows after recent TCP changes

See merge request isc-projects/bind9!2896
2020-01-15 13:50:10 +00:00
Witold Kręcicki
525c583145 netmgr:
- isc__netievent_storage_t was to small to contain
   isc__netievent__socket_streaminfo_t on Windows
 - handle isc_uv_export and isc_uv_import errors properly
 - rewrite isc_uv_export and isc_uv_import on Windows
2020-01-15 14:08:44 +01:00
Michał Kępień
0cf47ed363 Merge branch '1493-make-hazard-pointers-dynamic' into 'master'
Make hazard pointers max_threads configurable at runtime.

Closes #1493

See merge request isc-projects/bind9!2885
2020-01-15 07:56:58 +00:00
Witold Kręcicki
ea7cc30f7c CHANGES 2020-01-15 08:55:39 +01:00
Witold Kręcicki
493b6a9f33 Make hazard pointers max_threads configurable at runtime.
hp implementation requires an object for each thread accessing
a hazard pointer. previous implementation had a hardcoded
HP_MAX_THREAD value of 128, which failed on machines with lots of
CPU cores (named uses 3n threads). We make isc__hp_max_threads
configurable at startup, with the value set to 4*named_g_cpus.
It's also important for this value not to be too big as we do
linear searches on a list.
2020-01-14 21:26:57 +01:00
Evan Hunt
1639dc8dca Merge branch 'each-allow-ds-with-key' into 'master'
allow DS with key trust anchors

See merge request isc-projects/bind9!2892
2020-01-14 19:56:16 +00:00
Evan Hunt
fc36798a81 allow both key and DS trust anchors to be used for the same name. 2020-01-14 11:17:30 -08:00
Evan Hunt
72b3b458d3 Merge branch '1237-keytable-refactoring' into 'master'
Resolve "refactor dns_keytable"

Closes #1237

See merge request isc-projects/bind9!2798
2020-01-14 18:10:16 +00:00
Evan Hunt
6799a222d1 keep the keynode attached as long as dsset is in use
when using the trust anchor dsset as val->dsset, keep a reference
to the keynode so dsset can't be freed.
2020-01-14 09:26:19 -08:00
Evan Hunt
2d249ebeae make dns_keytable_deletekey() work correctly
it now removes matching trust anchors from from the dslist while leaving
the other trust anchors in place.

also cleaned up the API to remove functions that were never being used.
2020-01-14 09:26:13 -08:00
Evan Hunt
678e2d3cfa fix a bug with the insertion of DS records into existing keynodes
NOTE: the keytable test is still failing because dns_keytable_deletekey()
is looking for exact matches in keynodes containing dst_key objects,
which no keynode has anymore.
2020-01-14 09:24:23 -08:00
Evan Hunt
b984a4b647 disable adding keys to keytable; only DS trust anchors can now be added
the internal keytable structure has not yet been changed, but
insertion of DS anchors is the only method now available.

NOTE: the keytable unit test is currently failing because of tests
that expect individual keynode objects to contain single DST key
objects.
2020-01-14 09:24:22 -08:00
Evan Hunt
7fdf40770f remove all code that uses non-DS trust anchors
as initial-key and static-key trust anchors will now be stored as a
DS rrset, code referencing keynodes storing DNSKEY trust anchors will
no longer be reached.
2020-01-14 09:24:13 -08:00
Evan Hunt
21d3f66f1c rename dns_keytable_deletekeynode to dns_keytable_deletekey
this function is used by dns_view_untrust() to handle revoked keys, so
it will still be needed after the keytable/validator refactoring is
complete, even though the keytable will be storing DS trust anchors
instead of keys. to simplify the way it's called, it now takes a DNSKEY
rdata struct instead of a DST key.
2020-01-14 09:23:21 -08:00
Ondřej Surý
8f902a72ff Merge branch '1396-document-bind-9-15-x-need-for-pkg-config' into 'master'
Fail the autoconf script early if pkg-config is not present.

Closes #1396

See merge request isc-projects/bind9!2889
2020-01-14 13:31:17 +00:00
Ondřej Surý
fc9c7025bc Fail the autoconf script early if pkg-config is not present. 2020-01-14 14:07:36 +01:00